Solaris Infrequently Asked and Obscure Questions Composed by Argoth (2001.11.02)
------------------------- 2001.06.13 A changelog has been implemented to keep track of recent additions and corrections to the site. ------------------------- Table of Contents I. System A. General 1. How do I untar a file with absolute paths to a relative location? 2. How do I do a recursive grep? 3. How do I find out the number of files used on local filesystems? 4. How do I use a FIFO? 5. How do I list available signals? 6. How do I show how a process will respond to a given signal? 7. How do I remove a file that begins with a - ? 8. ls(1) no longer works, how can I view directory contents? 9. How can I tell what the various ERROR codes mean? 10. How can I create a file of arbitrary size? 11. How can I get seconds from epoch? 12. How do I get yesterdays date? 13. How do I get access, modify, creation time of a file? 14. What is load average? 15. What is the run queue? 16. How can I copy directory contents to a remote machine? 17. How do I archive directories with 155+ character directory names or 100+ character file names? 18. How do I convert hexadecimal to decimal and vice versa? B. Shell 1. My setuid shell script keeps running as the real user, why? 2. Why is cd() a shell built-in rather than an executable? 3. How do I redirect stderr into stdout? 4. How do I get return codes from within a pipeline? C. General Kernel 1. Where do I put kernel configuration? 2. How do I add more PTYs? 3. What is shared memory? 4. How do I know the limits for shared memory kernel tunables? 5. What is a semaphore? 6. How do I know the limits for semaphore kernel tunables? 7. What is a door? 8. add_drv(1m) fails with "add_drv/rem_drv currently busy; try later". 9. How do I increase the number of file descriptors available to an application? D. Devices 1. How do I add a disk to the system? (Everything attached correctly) 2. How do I know what the video configuration for my adapter/display is? 3. How do I know what the adapter/display is capable of? 4. How do I change color depth? 5. How can I prevent my system from halting when my terminal server is rebooted? 6. What does hme stand for in /dev/hme? E. Filesystem 1. How do I get a list of superblocks on a filesystem? 2. How do I grow a ufs filesystem? 3. How do I determine what type of filesystem a given device has? 4. What are inodes 0, 1, and 2 used for? 5. What do I do if I have a corrupt boot block? 6. What is the DNLC? 7. How does the DNLC relate to the kernel vfs layer? 8. How do I get statistics about DNLC performance? 9. How do I prevent the ufs filesystem from buffering my database files? 10. How do I disable "access time" updates for file? 11. What's the difference between file mode 1 and 5? 12. How can i force an unmount of a hung nfs filesystem? F. X11 1. How do I use an alternate window manager? 2. How do I disable X Windows from starting at boot? 3. How do I disable that annoying beep? 4. How do I disable the CDE front panel? G. Crash dump Analysis 1. When did it happen? 2. How do I get information about what was going on? H. Veritas Volume Manager 1. How do I allow a user/group to write to a managed raw volume? 2. How do I move rootdg from one system to another? 3. What's the difference between Disk Suite (with ufs logging) and Veritas Volume Manager (with vxfs)? 4. What's the difference between RAID 0+1 and 1+0? I. Veritas Filesystem 1. How do I make vxfs support large files? 2. How do I defragment a vxfs filesystem? 3. How do I grow/shrink a vxfs filesystem? 4. How do I prevent the vxfs filesystem from buffering my database files? 5. How do I create a Quick I/O file? II. Network A. Physical Layer 1. How do I find the speed my network card is at? 2. How do I configure what my network card is capable of? 3. How do I configure what my link partner is capable of? 4. How can I tell if my card is active on the network? 5. How do I use multiple ethernet interfaces on the same network segment? 6. How do I determine if local mac addresses are in use on my host? B. Transport Layer 1. How do I configure stronger sequence number generation? 2. I have a large amount of connections in state CLOSE_WAIT, what can be done to reduce this number in the future? 3. How can I increase my TCP Window size? 4. What do all the TCP states actually mean? III. Programming A. System 1. What is a register window? B. Network ------------------------- Questions and Answers I. System A. General 1. How do I untar a file with absolute paths to a relative location? a. Method 1 (user) 1. /usr/bin/pax -r -s ',^/,,' -f file.tar b. Method 2 (root) 1. /usr/bin/cp /usr/sbin/static/tar /tmp 2. /usr/bin/dd if=file.tar | /usr/bin/chroot /tmp ./tar xf - 2. How do I do a recursive grep? a. Method 1 (recommended) 1. /usr/bin/find . | /usr/bin/xargs /usr/bin/grep PATTERN 2. displays filename:match b. Method 2 (recommended) 1. /usr/bin/find . -exec /usr/bin/grep PATTERN {} /dev/null \; 2. displays filename:match 3. How do I find out the number of files used on local filesystems? a. System V 1. /usr/bin/df -F ufs -o i b. Berkeley 1. /usr/ucb/df -i 4. How do I use a FIFO? a. /usr/bin/mkfifo fifo b. /usr/bin/compress < fifo > file.Z & c. /usr/bin/cat file > fifo 1. compresses file into file.Z 5. How do I list available signals? a. /usr/bin/kill -l b. Read /usr/include/sys/signal.h c. Solaris 2.6/7 1. /usr/bin/man -s 5 signal d. Solaris 8 1. /usr/bin/man -s 3HEAD signal 6. How do I show how a process will respond to a given signal? a. /usr/proc/bin/psig pid 1. you must be root or own the process to read /proc/pid 7. How do I remove a file that begins with a - ? a. This problem, contrary to popular belief, has nothing to do with the shell. It has to do with how rm(1) parses options. b. Method 1 1. /usr/bin/rm ./-file c. Method 2 1. /usr/bin/rm -- -file a. many programs use getopt(), thus they'll interpret - as an argument, to tell getopt() there are no more arguments to parse, use -- 8. ls(1) no longer works, how can i view directory contents? a. echo * 1. This method uses the shell built-in echo() in conjunction with the * matching properties to generate listing of current directory. 9. How can I tell what the various ERROR codes mean? a. Read /usr/include/sys/errno.h 10. How can I create a file of arbitrary size? a. Method 1 1. /usr/sbin/mkfile 10m file a. Creates a 10 Megabyte file b. For each write() operation, there is no accompanying read() operation, making this method very efficient b. Method 2 (recommended) 1. /usr/bin/dd < /dev/zero > file bs=1024 seek=10240 count=1 a. Creates a 10 Megabyte file b. This method does not require many reads and writes since the file is sparse. 11. How can I get seconds from epoch? a. Solaris 2.6/7 1. /usr/bin/truss /usr/bin/date 2>&1 | /usr/bin/awk '/^time/ {print $NF}' b. Solaris 8 1. /usr/bin/perl -e 'printf "%d\n", time;' 12. How do I get yesterdays date? a. Solaris 2.6/7 1. TZ=timezone+shift date a. replace timezone with EST,CST,PST,etc b. replace shift with 24-(shift from GMT) c. Example 1. EST=-5 2. 24-(-5)=29 3. TZ=EST+29 date 2. echo `echo '*time-0t86400=Y' | /usr/bin/adb -k | tail -2` b. Solaris 8 1. /usr/bin/perl -e 'printf "%s\n",scalar localtime(time-86400)' 2. This breaks twice a year during the DST transition. 3. From perlfaq4; Note very carefully that the code above assumes that your days are twenty-four hours each. For most people, there are two days a year when they aren't: the switch to and from summer time throws this off. A solution to this issue is offered by Russ Allbery. sub yesterday { my $now = defined $_[0] ? $_[0] : time; my $then = $now - 60 * 60 * 24; my $ndst = (localtime $now)[8] > 0; my $tdst = (localtime $then)[8] > 0; $then - ($tdst - $ndst) * 60 * 60; } # Should give you "this time yesterday" in seconds since epoch relative to # the first argument or the current time if no argument is given and # suitable for passing to localtime or whatever else you need to do with # it. $ndst is whether we're currently in daylight savings time; $tdst is # whether the point 24 hours ago was in daylight savings time. If $tdst # and $ndst are the same, a boundary wasn't crossed, and the correction # will subtract 0. If $tdst is 1 and $ndst is 0, subtract an hour more # from yesterday's time since we gained an extra hour while going off # daylight savings time. If $tdst is 0 and $ndst is 1, subtract a # negative hour (add an hour) to yesterday's time since we lost an hour. # # All of this is because during those days when one switches off or onto # DST, a "day" isn't 24 hours long; it's either 23 or 25. # # The explicit settings of $ndst and $tdst are necessary because localtime # only says it returns the system tm struct, and the system tm struct at # least on Solaris doesn't guarantee any particular positive value (like, # say, 1) for isdst, just a positive value. And that value can # potentially be negative, if DST information isn't available (this sub # just treats those cases like no DST). # # Note that between 2am and 3am on the day after the time zone switches # off daylight savings time, the exact hour of "yesterday" corresponding # to the current hour is not clearly defined. Note also that if used # between 2am and 3am the day after the change to daylight savings time, # the result will be between 3am and 4am of the previous day; it's # arguable whether this is correct. # # This sub does not attempt to deal with leap seconds (most things don't). # # Copyright relinquished 1999 by Russ Allbery # This code is in the public domain 13. How do I get access, modify, creation time of a file? a. Access time (atime) 1. /usr/bin/ls -ul filename b. Modify time (mtime) 1. /usr/bin/ls -l filename c. Creation time 1. There is no way to determine creation time in the ufs filesystem d. Change time (ctime) 1. /usr/bin/ls -cl filename 2. this includes status changes (like permissions) e. All in one (root) 1. /usr/bin/ls -i filename | /usr/bin/awk \ '{print "0t"$1":ino?i"}' | /usr/sbin/fsdb -F ufs /dev/rdsk/c0t0d0s0 a. assumes raw device of filesystem for filename is c0t0d0s0 14. What is load? a. Load is the number of processes currently in the run queue. b. Method 1 1. /usr/bin/w -u 2. displays load average over last 1, 5 and 15 minutes c. Method 2 1. /usr/bin/uptime 2. displays load average over last 1, 5 and 15 minutes 15. What is the run queue? a. The run queue consists of processes ready to run, i.e not otherwise blocked or waiting for i/o, that are contending for cpu resources to become available. b. /usr/bin/vmstat 1 2 1. Current run queue is indicated by the "r" heading 2. First line of output is average since system boot 16. How can I copy directory contents to a remote machine (without nfs)? a. /usr/bin/tar -cf - sourcepath | /usr/bin/rsh remote " cd /targetpath ; /usr/bin/tar -xBf - " b. /usr/bin/find sourcepath | /usr/bin/cpio -o | /usr/bin/rsh remote "cd /targetpath ; /usr/bin/cpio -id" 17. How do I archive directories with 155+ character directory names or 100+ character file names? a. Sun's version of tar does not support this, use cpio b. /usr/bin/find . | /usr/bin/cpio -o > file.cpio 1. -H tar produces warning on files with the aforementioned attributes 18. How do I convert hexadecimal to decimal and vice versa? a. echo "0xff=d" | /usr/bin/adb 1. converts ff into 255 b. echo "0t255=x | /usr/bin/adb 1. converts 255 to ff B. Shell 1. My setuid shell script keeps running as the real user, why? a. Bourne Shell 1. The use of setuid shell scripts is discouraged a. If you must, protect yourself with trap() 2. Bourne shell always sets the effective user and group IDs to the real user and group IDs. 3. /bin/sh -p b. C Shell 1. The use of setuid shell scripts is discouraged 2. C shell does not run setuid/setgid shell scripts by default a. "/dev/fd/3: Bad file number" is a common error 3. /bin/csh -b 2. Why is cd() a shell built-in rather than an executable? a. Quick Answer 1. a child process cannot modify the environment of the parent b. Long Answer 1. a shell fork()s and then exec()s the requested executable. in doing so, the newly created process begins life with the environment of the parent process. the new child process then manipulates the environment in the manner requested, in this case a modification of the directory stack, and returns to the parent. however, since this change occurred in the child address space, the parent's environment was never changed, and therefore the requested operation did not take place. 3. How do I redirect stderr? a. Bourne Shell 1. to stdout a. command 2>&1 2. to file a. command 2> file 3. to null a. command 2> /dev/null b. C Shell 1. to stdout a. command >& /dev/tty 2. to file (without affecting stdout) a. ( command > /dev/tty ) >& file 3. to null (without affecting stdout) a. ( command > /dev/tty ) >& /dev/null 4. How do I get return codes from within a pipeline? a. Bourne Shell 1. Method 1 (return correct after pipeline execution) a. /usr/sbin/mknod file_pipe p 1. same as /usr/sbin/mkfifo b. /usr/bin/tee -a logfile < file_pipe & 1. moves to background, awaiting information from pipe 2. 'tee' is just an example of any program that is on the receiving end of a pipe c. ./program > file_pipe 1. since command is now at the end of execution, $? is populated correctly. Otherwise, pipelines always return the return code of the final command in the pipeline 2. upon completion, the pipe is closed and receiving program will exit 2. Method 2 (return correct during pipeline execution) a. ( ./program || echo $? 1>&2 ) | /usr/bin/tee -a logfile 1. the key here is that each step in the pipeline is seperated into its own subshell, thus allowing flexibility on what to do after program execution 2. one thing to remember is that the subsequent programs in the subshell will execute after completion of the first and their output will be subject to the pipeline at that time 3. this method prevents variables from being populated after execution in the parent shell (however, variables can be passed within the subshell and its children individually) C. General Kernel 1. Where do I put kernel configuration? a. /etc/system 2. How do I add more PTYs? a. Do not attempt to do this with '/usr/bin/adb -k'. b. Solaris <= 7 1. Modify /etc/system a. set pt_cnt = X 2. /usr/sbin/reboot -- -r c. Solaris 8 1. Dynamically allocated. 2. Limit is forced by modifying /etc/system a. set pt_max_pty = X 3. What is shared memory? a. Just as it sounds. Shared memory is an Interprocess Communication (IPC) mechanism used by multiple processes to access common memory segments. 4. How do I know the limits for shared memory kernel tunables? a. Read /usr/include/sys/shm.h 5. What is a semaphore? a. A non-negative integer that is incremented or decremented relative to available resources. 6. How do I know the limits for semaphore kernel tunables? a. Read /usr/include/sys/sem.h 7. What is a door? a. A door is a file descriptor that describes a method for interprocess communication between client and server threads. b. A door file appears with file mode D---------. 8. add_drv(1m) fails with "add_drv/rem_drv currently busy; try later". a. /usr/bin/rm /tmp/AdDrEm.lck 9. How do I increase the number of file descriptors available to an application? a. File descriptors are used for more than just open files, they also provide the framework for socket i/o. b. The kernel dynamically allocates resources for open files. There is no maximum number of file descriptors per system. c. Depending on the programming interface used, an application may not be able to reach the file descriptor limit. d. API limits (ref:Solaris Internals) 1. Solaris <= 2.6 a. stdio(3S) - 256 1. From stdio(3S); no more than 255 files may be opened using fopen(), and only file descriptors 0 through 255 can be used in a stream. b. select(3c) - 1024 1. From select(3c); The default value for FD_SETSIZE (currently 1024) is larger than the default limit on the number of open files. It is not possible to increase the size of the fd_set data type when used with select(). 2. Solaris >= 7 a. stdio(3s) - 256 (32-bit) / 65536 (64-bit) b. select(3c) - 1024 (32-bit) / 65536 (64-bit) 1. 65536 limit is attainable on 32-bit Solaris 7 2. #define FD_SETSIZE 65536 ; prior to includes e. System defaults 1. Solaris 2.6/7 a. rlim_fd_max 1024 b. rlim_fd_cur 64 2. Solaris 8 a. rlim_fd_max 1024 b. rlim_fd_cur 256 f. Modify /etc/system 1. set rlim_fd_max=8192 ; hard limit (per process) 2. set rlim_fd_cur=1024 ; soft limit (per process) D. Devices 1. How do I add a disk to the system? (Everything attached correctly) a. While the system is up ( no fcal) 1. Solaris <= 7 a. Generate /devices structure 1. /usr/sbin/drvconfig b. Generate /dev structure 1. /usr/sbin/devlinks c. Generate /dev/dsk and /dev/rdsk links 1. /usr/sbin/disks 2. Solaris 8 a. Generate /devices, /dev, /dev/dsk, /dev/rdsk links 1. /usr/sbin/devfsadm b. While the system is up ( fcal ) 1. Get the enclosure name a. /usr/sbin/luxadm probe 2. Add the disk a. /usr/sbin/luxadm insert_device enclosure,slot c. With a reboot 1. Method 1 a. /usr/sbin/shutdown -g0 -i0 "disk addition" b. Reconfigure Boot (From OpenBoot PROM monitor) 1. boot -r 2. Method 2 a. /usr/bin/touch /reconfigure b. /usr/sbin/shutdown -g0 -i6 "disk addition" 2. How do I know what the video configuration for my adapter/display is? a. M64 Adapter 1. /usr/sbin/m64config -propt b. Creator 3D Adapter 1. /usr/sbin/ffbconfig -propt 3. How do I know what the adapter/display is capable of? a. M64 Adapter 1. Display what the card is capable of a. /usr/sbin/m64config -res \? 2. Display what the card and display are capable of a. /usr/sbin/m64config -prconf b. Creator 3D Adapter 1. Display what the card is capable of a. /usr/sbin/ffbconfig -res \? 2. Display what the card and display are capable of a. /usr/sbin/ffbconfig -prconf 4. How do I change color depth? a. M64 Adapter 1. /usr/sbin/m64config -depth 24 a. Attempts to set the default color depth to 24. b. Creator 3D Adapter 1. /usr/sbin/ffbconfig -depth 24 a. Attempts to set the default color depth to 24. 5. How can I prevent my system from halting when my terminal server is rebooted? a. Patches 1. Solaris 2.6 a. Install patch 105924-10 or later 2. Solaris 7 a. Install patch 107589-02 or later 3. Solaris 8 a. Integrated b. Method 1 (persistent) 1. Modify /etc/default/kbd a. KEYBOARD_ABORT=alternate 2. /usr/sbin/init 6 3. New break sequence is "~^b" c. Method 2 (not persistent, system up) 1. Solaris 2.6 / 7 a. /usr/bin/kbd -a disable b. This disables keyboard abort (L1-A / Stop-A) until you perform Method 1 2. Solaris 8 a. /usr/bin/kbd -a alternate b. This allows for the alternate sequence to be immediately available until you perform Method 1 6. What does hme stand for in /dev/hme? a. Happy Meal E. Filesystem 1. How do I get a list of superblocks on a filesystem? a. /usr/sbin/newfs -N device | awk '/^ [0-9]/' 2. How do I grow a ufs filesystem? a. Unmounted filesystem (not /, /usr, /var) 1. Allocate additional contiguous disk space with format(1m) a. Unnecessary if you are using a volume manager 2. /usr/lib/fs/ufs/mkfs -G rawdevice newsize b. Mounted filesytem (not /, /usr, /var) 1. Allocate additional contiguous disk space with format(1m) a. Unnecessary if you are using a volume manager 2. /usr/lib/fs/ufs/mkfs -G -M mountpoint rawdevice newsize 3. How do I determine what type of filesystem a given device has? a. Method 1 (root) 1. /usr/sbin/fstyp blockdevice 4. What are inodes 0, 1, and 2 used for? a. Inode 0 is unusable. It is used to mark unused inodes. b. Inode 1 is unusable. Use of this inode for bad block information is deprecated. c. Inode 2 is "/" or "root" of the filesystem. 5. What do I do if I have a corrupt boot block? a. ok boot cdrom -s b. /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c#t#d#s# 6. What is the DNLC? a. DNLC is the directory name look up cache b. It is a hash table bucket structure of name cache entries for fast lookup. The elements in this cache are directory vnode, file name, and credential. c. Solaris also employs a directory cache mechanism for large directories. This is an unordered linked list of free space entries. d. Solaris caches names up to 30 characters. Longer names are read using the standard, slower method, by traversing the directory structure. e. Read /usr/include/sys/dnlc.h 7. How does the DNLC relate to the kernel vfs layer? a. Since the DNLC is a reference to recently used vnodes, the filesystem will read from the DNLC prior to the underlying filesystem. This is due to the fact that every inode/rnode has a corresponding vnode. vfs is a layer of abstraction in the kernel that allows the kernel to support multiple filesystem types by presenting all filesystems in a uniform manner. 8. How do I get statistics about DNLC performance? a. A value of 90% or less requires tuning. b. Method 1 (recommended) 1. /usr/bin/vmstat -s | /usr/bin/grep "name lookup" c. Method 2 1. echo '*ncstats*0t100%(*ncstats+*(ncstats+4)+*(ncstats+14))=D' | /usr/bin/adb -k 9. How do I prevent the ufs filesystem from buffering my database files? a. ufs now has the ability to provide direct access to a file. This new method is not as effective as RAW access because the filesystem still allocates the file by indirect blocks which can fragment. b. this is done on a per filesystem, rather than per file basis c. direct i/o can be dangerous when used on filesystems that are accessed by appplications that do not buffer data internally d. Method 1 (persistent) 1. Add "forcedirectio" to mount options in /etc/vfstab e. Method 2 (not persistent, system up) 1. /usr/sbin/mount -o remount,forcedirectio,(other options) /mountpoint 10. How do I disable "access time" updates for file? a. This is useful for web servers and news servers b. Add "noatime" to mount options in /etc/vfstab 11. What's the difference between file mode 1 and 5? a. mode 1 allows exec() of the binary b. mode 5 allows exec() of the binary and processes to mmap() pages from within userspace b. this is why shared libraries generally need to be PROT_READ and PROT_EXEC at page level and -r-x at file level 12. How can i force an unmount of a hung nfs filesystem? a. Solaris 2.6/7 1. there is no special flag to the umount() system call that allows this b. Solaris 8 1. /usr/sbin/umount -f /mount F. X11 1. How do I use an alternate window manager? a. Bypassing CDE 1. echo "exec /path/to/alternate/window/manager" > .xsession b. Maintaining CDE 1. Xresources a. cd /usr/dt/config/C/Xresources.d b. /usr/bin/cp Xresources.ow Xresources.wm c. Modify Xresources.wm 1. Dtlogin*altDtName: Alternate WindowManager 2. Dtlogin*altDtKey: /path/to/alternate/window/manager 3. Dtlogin*altDtStart: /usr/dt/config/Xsession.wm 4. Dtlogin*altDtLogo: WMlogo 2. Xsession a. cd /usr/dt/config b. /usr/bin/cp Xsession.ow Xsession.wm c. Modify Xsession.wm 1. Place windowmanager environment 3. Logo (for display in CDE login) a. cd /usr/dt/appconfig/icons/C b. /usr/bin/cp OWlogo.pm WMlogo.pm 1. Replace this with your own XPM file 2. How do I disable X Windows from starting at boot? a. Method 1 (recommended) 1. /usr/dt/bin/dtconfig -d b. Method 2 1. /usr/bin/mv /etc/rc2.d/S99dtlogin /etc/rc2.d/s99dtlogin 3. How do I disable that annoying beep? a. Method 1 1. /usr/openwin/bin/xset b 0 b. Method 2 1. /usr/openwin/bin/xset b off c. Method 3 1. /usr/openwin/bin/xset -b 4. How do I disable the CDE front panel? a. Modify $HOME/.Xdefaults b. Dtwm*useFrontPanel: false G. Crash dump Analysis 1. When did it happen? a. Method 1 (to the minute) 1. /usr/bin/who -b b. Method 2 (to the second) 1. Become root 2. echo '*time-(*lbolt%64)=Y' | /usr/bin/adb -k 2. How do I get information about what was going on? a. Enable savecore 1. Solaris 2.6 a. disabled by default b. Modify /etc/init.d/sysetup 1. Uncomment last 6 lines 2. Solaris 7/8 a. enabled by default b. enable with '/usr/bin/dumpadm -y' b. Default file locations 1. corefile is /var/crash/`uname -n`/vmcore.n 2. namelist is /var/crash/`uname -n`/unix.n c. Process status 1. Open the crash interpreter a. /usr/sbin/crash -d corefile -n namelist 2. p -e a. the "p" command reads the process table. d. Network status 1. /usr/bin/netstat namelist corefile e. IPC status 1. /usr/sbin/ipcs -C corefile -N namelist H. Veritas Volume Manager 1. How do I allow a user to write to a managed raw device? a. /usr/bin/chown is not persistent across reboots b. /usr/sbin/vxedit set user=oracle group=dba mode=600 volume 2. How do I move rootdg from one system to another? a. without this procedure, you will get error messages at boot because the system sees two instances of rootdg b. /etc/vx/diag.d/vxprivutil list /dev/rdsk/c#t#d#s# | awk '/^group/' 1. note the disk group id number c. /usr/sbin/vxdg -C -n newdg import dgid 1. dgid is group id from (a) 2. this command creates disk group newdg and imports the disk 3. What's the difference between Disk Suite (with ufs logging) and Veritas Volume Manager (with vxfs)? a. Veritas Volume Manager logs metadata and filesystem data, whereas Disk Suite logs only metadata 4. What's the difference between RAID 0+1 and 1+0? a. Diagram A (RAID 0+1) 1. [ v] || [ p] || [sv] || =======================[v2]======================= | | ==========[p2]========== ==========[p2]========== | | | | =[s2]==[s2]==[s2]==[s2]= =[s2]==[s2]==[s2]==[s2]= 2. Striping occurs at the subvolume(p2) layer. 3. Mirroring occurs at the subplex (v2) layer. b. Diagram B (RAID 1+0) 1. [ v] || [ p] || ==========================[sv]========================== | | ===========[v2]=========== ===========[v2]=========== | | | | ====[p2]==== ====[p2]==== ====[p2]==== ====[p2]==== | | | | | | | | =[s2]==[s2]= =[s2]==[s2]= =[s2]==[s2]= =[s2]==[s2]= 2. Striping occurs at the subvolume(sv) layer. 3. Mirroring occurs at the subplex (p2) layer. c. The diagrams above use the Veritas 3.x nomenclature. d. Volume Resynchronization 1. There is an additional layer of abstraction in RAID 1+0 that allows for isolation of the subdisks into subplexes. Since the subplexes are smaller than the plexes in RAID 0+1, time to resynchronize is reduced. e. Fault Tolerance 1. There is an additional layer of abstraction in RAID 1+0 that allows for isolation of the subdisks into subplexes. Since the subplexes now contain reduced amounts of disks, and are composed solely of single subdisk mirrors, the RAID 1+0 volume can sustain the loss of multiple disks pending all of the disks within a given subplex do not fail. I. Veritas Filesystem 1. How do I make vxfs support large files? a. /usr/lib/fs/vxfs/fsadm -o largefiles /mountpoint 2. How do I defragment a vxfs filesystem? a. Determine if necessary 1. Method 1 a. /usr/lib/fs/vxfs/df -o s /mountpoint 2. Method 2 a. /usr/lib/fs/vxfs/fsadm -ED /mountpoint 1. reports on both extent and directory fragmentation b. /usr/lib/fs/vxfs/fsadm -ed /mountpoint 1. reorganizes extents and directories 3. How do I grow/shrink a vxfs filesystem? a. vxfs, unlike ufs, filesystems can be shrunk. b. Mounted filesystem (not /, /usr, /var) 1. /usr/lib/fs/vxfs/fsadm -b size /mountpoint 4. How do I prevent the vxfs filesystem from buffering my database files? a. Method 1 (persistent) 1. Add "mincache=direct,convosync=direct" to mount options in /etc/vfstab b. Method 2 (not persistent, system up) 1. /usr/sbin/mount -o remount,mincache=direct,convosync=direct,<other options> /mountpoint 2. [UNVERIFIED] please email if you can confirm c. Method 3 (Quick I/O) 1. This is presented as an add-on module for filesystem and ships with Veritas Database Edition. 2. Quick I/O presents files with preallocated extents as character devices to the application in the form of ".filename::cdev:vxfs" by use of the vxqio device driver 3. Quick I/O is enabled per filesystem, by default, but is configured on a per file basis 5. How do I create a Quick I/O file? a. Oracle 1. /usr/sbin/qiomkfile -h <header size> -s <extent size> /path/to/dbfile a. <header size> should correspond to DB_BLOCK_SIZE, 32k by default b. <extent size> should correspond to the size of the database. by allocating appropriate extents you can prevent fragmentation II. Networking A. Physical Layer 1. How do I find the speed my network card is at? a. /usr/sbin/ndd -set /dev/hme instance 0 1. instance 0 - hme0 2. instance 1 - hme1 b. /usr/sbin/ndd -get /dev/hme transciever_inuse 1. 0 - onboard 2. 1 - offboard card (mii) c. /usr/sbin/ndd -get /dev/hme link_status 1. 0 - down 2. 1 - up d. /usr/sbin/ndd -get /dev/hme link_speed 1. 0 - 10Mb 2. 1 - 100Mb e. /usr/sbin/ndd -get /dev/hme link_mode 1. 0 - half duplex 2. 1 - full duplex 2. How do I configure what my network card is capable of? a. Method 1 1. /etc/system a. this sets global defaults for the driver, therefore it is effective for all instances of the card b. HME/QFE/GE interfaces 1. set hme:hme_adv_autoneg_cap=0 a. advertise auto negotiate capability b. 0 - off c. 1 - on 2. set hme:hme_adv_100T4=0 a. advertise deprecated 100Mbit T4 capability b. 0 - off c. 1 - on 3. set hme:hme_adv_100fdx=0 a. advertise 100Mbit full duplex capability b. 0 - off c. 1 - on 4. set hme:hme_adv_100hdx=0 a. advertise 100Mbit half duplex capability b. 0 - off c. 1 - on 5. set hme:hme_adv_10fdx=0 a. advertise 10Mbit full duplex capability b. 0 - off c. 1 - on 6. set hme:hme_adv_10hdx=0 a. advertise 10Mbit half duplex capability b. 0 - off c. 1 - on c. ERI interface 1. set eri:adv_autoneg_cap=0 a. advertise auto negotiate capability b. 0 - off c. 1 - on 2. set eri:adv_100T4=0 a. advertise deprecated 100Mbit T4 capability b. 0 - off c. 1 - on 3. set eri:adv_100fdx=0 a. advertise 100Mbit full duplex capability b. 0 - off c. 1 - on 4. set eri:adv_100hdx=0 a. advertise 100Mbit half duplex capability b. 0 - off c. 1 - on 5. set eri:adv_10fdx=0 a. advertise 10Mbit full duplex capability b. 0 - off c. 1 - on 6. set eri:adv_10hdx=0 a. advertise 10Mbit half duplex capability b. 0 - off c. 1 - on c. QE/LE interfaces 1. these 10mbit interfaces dont support full duplex operation b. Method 2 1. This method allows more granular control over the interface driver. You can specify configuration by port. 2. /usr/sbin/ndd -set /dev/hme instance 0 a. instance 0 - hme0 b. instance 1 - hme1 b. /usr/sbin/ndd -set /dev/hme adv_autoneg_cap 0 1. advertise auto negotiate capability 2. 0 - off 3. 1 - on c. /usr/sbin/ndd -set /dev/hme adv_100fdx_cap 0 1. advertise 100Mbit full duplex capability 2. 0 - off 3. 1 - on d. /usr/sbin/ndd -set /dev/hme adv_100hdx_cap 0 1. advertise 100Mbit half duplex capability 2. 0 - off 3. 1 - on e. /usr/sbin/ndd -set /dev/hme adv_100T4_cap 0 1. advertise deprecated 100Mbit T4 capability 2. 0 - off 3. 1 - on f. /usr/sbin/ndd -set /dev/hme adv_10fdx_cap 0 1. advertise 10Mbit full duplex capability 2. 0 - off 3. 1 - on g. /usr/sbin/ndd -set /dev/hme adv_10hdx_cap 0 1. advertise 10Mbit half duplex capability 2. 0 - off 3. 1 - on 3. How do I configure what my link partner is capable of? a. /usr/sbin/ndd -set /dev/hme instance 0 1. instance 0 - hme0 2. instance 1 - hme1 b. /usr/sbin/ndd -get /dev/hme lp_autoneg_cap 1. link partner has auto negotiate capability 2. 0 - off 3. 1 - on c. /usr/sbin/ndd -get /dev/hme lp_100fdx_cap 1. link partner has 100Mbit full duplex capability 2. 0 - off 3. 1 - on d. /usr/sbin/ndd -get /dev/hme lp_100hdx_cap 1. link partner has 100Mbit half duplex capability 2. 0 - off 3. 1 - on e. /usr/sbin/ndd -get /dev/hme lp_100T4_cap 1. link partner has deprecated 100Mbit T4 capability 2. 0 - off 3. 1 - on f. /usr/sbin/ndd -get /dev/hme lp_10fdx_cap 1. link partner has 10Mbit full duplex capability 2. 0 - off 3. 1 - on g. /usr/sbin/ndd -get /dev/hme lp_10hdx_cap 1. link partner has 10Mbit half duplex capability 2. 0 - off 3. 1 - on 4. How can I tell if my card is active on the network? a. Method 1 (Openboot PROM) 1. watch-net 5. How do I use multiple ethernet interfaces on the same network segment? a. Method 1 (modern cards, 1997+) 1. Modern Sun Adapters have unique mac addresses encoded in the FCode Prom. 2. /usr/sbin/eeprom local-mac-address?=true b. Method 2 (older cards) 1. From InfoDoc 16733; "Section 3.2.3(4) of the IEEE 802.3 spec defines a reserved bit in the Ethernet Address that can be used to administer a universally assigned ethernet addresses. A Locally administered address (LAA) can be implemented to ensure a unique HW address." 2. Setting the LAA bit can be done by using a 0A hex as the first digit instead of 08. 3. /usr/sbin/ifconfig hme1 ether 0a:0:20:00:01 6. How do I determine if local mac addresses are in use on my host? a. /usr/sbin/prtconf -pv | /usr/bin/grep local-mac-address B. Transport Layer 1. How do I configure stronger sequence number generation? a. From RFC 1948; "The initial sequence numbers are intended to be more or less random. More precisely, RFC 793 specifies that the 32-bit counter be incremented by 1 in the low-order position about every 4 microseconds. Instead, Berkeley-derived kernels increment it by a constant every second, and by another constant for each new connection. Thus, if you open a connection to a machine, you know to a very high degree of confidence what sequence number it will use for its next connection. And therein lies the attack." b. /usr/sbin/ndd -set /dev/tcp tcp_strong_iss 2 1. 0 - Sequential 2. 1 - Random increment variance (Default) 3. 2 - RFC 1948, unique-per-connection-ID. c. Modify /etc/default/inetinit. 1. TCP_STRONG_ISS=2 2. I have a large amount of connections in state CLOSE_WAIT, what can be done to reduce this number in the future? a. Increase Connection Hash Table 1. Used for faster connection lookups 2. Default is 256, Max is 262144 3. Must be set at boot time 3. Modify /etc/system a. set tcp:tcp_conn_hash_size=8192 4. /usr/sbin/init 6 b. Decrease Close Wait Interval 1. Default is 240000, Minimum Recommended is 60000 2. Can be modified on the fly at any time 3. /usr/sbin/ndd -set /dev/tcp tcp_close_wait_interval 60000 3. How can I increase my TCP Window size? a. Increase Transmit Buffer 1. Increasing this value in excess of the 16bit window defined in RFC793, as SEG.WND, causes the Window Scaling option as defined in RFC1323. 2. Increasing this value takes additional memory 3. /usr/sbin/ndd -set /dev/tcp tcp_xmit_hiwat 32768 b. Increase Receive Window 1. Increasing this value in excess of the 16bit window defined in RFC793, as SEG.WND, causes the Window Scaling option as defined in RFC1323. 2. Increasing this value takes additional memory 3. /usr/sbin/ndd -set /dev/tcp tcp_recv_hiwat 32768 4. What do all the TCP states actually mean? a. CLOSED (0) 1. Socket is closed b. LISTEN (1) 1. Socket is passive, awaiting a connection request c. SYN_SENT (2) 1. Socket is active, has sent a SYN 2. Session not yet active d. SYN_RECEIVED (3) 1. Socket is active, has sent and received SYN 2. Session not yet active e. ESTABLISHED (4) 1. Socket is active 2. Session is active, has completed handshake f. CLOSE_WAIT (5) 1. Socket is closed, received FIN, waiting for close 2. Session is terminating g. FIN_WAIT (6) 1. Socket is closed, sent FIN, waiting for FIN ACK 2. Session is terminating h. CLOSING (7) 1. Socket is closed, exchanged FIN, waiting for FIN ACK 2. Session is terminating i. LAST_ACK (8) 1. Socket is closed, received FIN, waiting for FIN ACK 2. Session is terminating j. FIN_WAIT_2 (9) 1. Socket is closed, received FIN ACK 2. Session is complete k. TIME_WAIT (10) 1. Socket is closed, waits for ( 2 * max segment life ) 2. Session is complete III. Programming A. System 1. What is a register window? a. A register window is used by the operating system to store the current local and in registers upon a system interupt, exception, or trap instruction. b. register windows are important to preserve the state of the stack between function calls. B. Network ------------------------- Have an obscure question not covered by this IAOQ? iaoq-requests@devunix.org - Requests iaoq-comments@devunix.org - Comments ------------------------- Additional feedback provided by; handles : arp, jobe, masters, rfc-768, sporkness, unixos people : dan d'andrea, scott edlund (torment), sam grey, josh grubman, sean o'neill, jeff tarnok, andrew wilson, scott d. yelich (absentia) ------------------------- Bibliography; Cockroft, A., Sun Performance and Tuning - Java and the Internet, 2nd Edition, Sun Microsystems Press/Prentice Hall, 1998. Drake, C., Brown, K., Panic! - Unix System Crash Dump Analysis, SunSoft Press/Prentice Hall, 1995. McDougall, R., Solaris Internals, Sun Microsystems Press/Prentice Hall, 2001. Vahalia, U., Unix Internals - The New Frontiers, Prentice Hall, 1996. ------------------------- Disclaimer; This document is not supported by Sun Microsystems. Errors in certain commands executed as root can cause system failure and data corruption. Please exercise caution and remember to backup your data.