+ All Categories
Home > Documents > Unix Commands on Solaris Aix Hp Linux

Unix Commands on Solaris Aix Hp Linux

Date post: 12-Mar-2015
Category:
Upload: pleasantpartner
View: 609 times
Download: 11 times
Share this document with a friend
667
/****************************************************************************/ /* Document : UNIX command examples, mainly based on Solaris, AIX, HP */ /* and ofcourse, also Linux. */ /* Doc. Version : 102 */ /* File : unix.txt */ /* Purpose : some usefull examples for the Oracle, DB2, SQLServer DBA */ /* Date : 10-03-2008 */ /* Compiled by : Albert van der Sel */ /* Best use : Use find/search in your editor to find a string, command, */ /* or any identifier */ /* http://antapex.org/unix.txt */ /****************************************************************************/ ##################################### SECTION 1. COMMANDS AND ARCHITECTURE: ##################################### ========================== 1. HOW TO GET SYSTEM INFO: ========================== 1.1 Short version: ================== See section 1.2 for more detailed commands and options. Memory: ------- AIX: bootinfo -r /usr/sbin/lsattr -E -l sys0 -a realmem or use a tool as "topas" or "nmon" (these are utilities) Linux: cat /proc/meminfo /usr/sbin/dmesg | grep "Physical" HP: /usr/sam/lbin/getmem grep MemTotal /proc/meminfo /etc/dmesg | grep -i phys wc -c /dev/mem or us a tool as "glance", like entering "glance -m" from prompt (is a utility) Solaris: /usr/sbin/prtconf | grep "Memory size" Tru64: /bin/vmstat -P | grep "Total Physical Memory" Swap: ----- AIX: /usr/sbin/lsps -a HP: /usr/sbin/swapinfo -a Solaris: /usr/sbin/swap -l Linux: /sbin/swapon -s cat /proc/swaps cat /proc/meminfo OS version: ----------- HP: uname -a Linux: cat /proc/version Solaris: uname -a Tru64: /usr/sbin/sizer -v AIX: oslevel -r lslpp -h bos.rte AIX firmware: lsmcode -c display the system firmware level and service processor lsmcode -r -d scraid0 display the adapter microcode levels for a RAID adapter scraid0 lsmcode -A display the microcode level for all supported devices prtconf shows many setting including memory, firmware, serial# etc.. cpu: ---- HP: ioscan -kfnC processor getconf CPU_VERSION getconf CPU_CHIP_TYPE model AIX: prtconf | grep proc pmcycles -m http://www.4bcad.com/doc/notes/sysinfo-unix.txt 1 of 667 28-09-10 01:52 PM
Transcript

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

/****************************************************************************/ /* Document : UNIX command examples, mainly based on Solaris, AIX, HP */ /* and ofcourse, also Linux. */ /* Doc. Version : 102 */ /* File : unix.txt */ /* Purpose : some usefull examples for the Oracle, DB2, SQLServer DBA */ /* Date : 10-03-2008 */ /* Compiled by : Albert van der Sel */ /* Best use : Use find/search in your editor to find a string, command, */ /* or any identifier */ /* http://antapex.org/unix.txt */ /****************************************************************************/ ##################################### SECTION 1. COMMANDS AND ARCHITECTURE: ##################################### ========================== 1. HOW TO GET SYSTEM INFO: ==========================

1.1 Short version: ================== See section 1.2 for more detailed commands and options. Memory: ------AIX:

bootinfo -r /usr/sbin/lsattr -E -l sys0 -a realmem or use a tool as "topas" or "nmon" (these are utilities) Linux: cat /proc/meminfo /usr/sbin/dmesg | grep "Physical" HP: /usr/sam/lbin/getmem grep MemTotal /proc/meminfo /etc/dmesg | grep -i phys wc -c /dev/mem or us a tool as "glance", like entering "glance -m" from prompt (is a utility) Solaris: /usr/sbin/prtconf | grep "Memory size" Tru64: /bin/vmstat -P | grep "Total Physical Memory" Swap: ----AIX: HP: Solaris: Linux: /usr/sbin/lsps -a /usr/sbin/swapinfo -a /usr/sbin/swap -l /sbin/swapon -s cat /proc/swaps cat /proc/meminfo

OS version: ----------HP: Linux: Solaris: Tru64: AIX: uname -a cat /proc/version uname -a /usr/sbin/sizer -v oslevel -r lslpp -h bos.rte display the system firmware level and service processor display the adapter microcode levels for a RAID adapter scraid0 display the microcode level for all supported devices shows many setting including memory, firmware, serial# etc..

AIX firmware: lsmcode -c lsmcode -r -d scraid0 lsmcode -A prtconf cpu: ---HP:

ioscan -kfnC processor getconf CPU_VERSION getconf CPU_CHIP_TYPE model prtconf | grep proc pmcycles -m

AIX:

1 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

lsattr -El procx (x is 0,2, etc..) lscfg | grep proc Linux: Solaris: cat /proc/cpuinfo psrinfo -v prtconf

Notes about lpars: -----------------For AIX: The uname -L command identifies a partition on a system with multiple LPARS. The LPAR id can be useful for writing shell scripts that customize system settings such as IP address or hostname. The output of the command looks like: # uname -L 1 lpar01 The output of uname -L varies by maintenance level. For consistent output across maintenance levels, add a -s flag. For illustrate, the following command assigns the partition number to the variable "lpar_number" and partiton name to "lpar_name". For HP-UX: Use commands like "parstatus" or "getconf PARTITION_IDENT" to get npar information.

patches: -------AIX: Is a certain fix (APAR) installed? instfix -ik APAR_number instfix -a -ivk APAR_number To determine your platform firmware level, at the command prompt, type: lscfg -vp | grep -p Platform The last six digits of the ROM level represent the platform firmware date in the format, YYMMDD. HP: /usr/sbin/swlist -l patch swlist | grep patch Linux: rpm -qa Solaris: showrev -p pkginfo -i package_name Tru64: /usr/sbin/dupatch -track -type kit Netcards: --------AIX: lsdev -Cc adapter lsdev -Cc adapter | grep ent lsdev -Cc if lsattr -E -l ent1 ifconfig -a Solaris: prtconf -D / prtconf -pv prtdiag | grep "card" svcs -x ifconfig -a (up plumb)

/

prtconf | grep "card"

1.2 More Detail: ================ 1.2.1 Show memory in Solaris: ============================= prtconf: -------Use this command to obtain detailed system information about your Sun Solaris installation # /usr/sbin/prtconf # prtconf -v Displays the size of the system memory and reports information about peripheral devices Use this command to see the amount of memory: # /usr/sbin/prtconf | grep "Mem" sysdef -i reports on several system resource limits. Other parameters can be checked on a running system

2 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

using adb -k : # adb -k /dev/ksyms /dev/mem parameter-name/D ^D (to exit)

1.2.2 Show memory in AIX: ========================= >> Show Total memory: --------=====-------# bootinfo -r # lsattr -El sys0 -a realmem # prtconf (you can grep it on memory) >> Show Details of memory: -------------------------You can have a more detailed and comprehensive look at AIX memory by using "vmstat -v" and "vmo -L" or "vmo -a": For example: # vmstat -v 524288 493252 67384 7 131820 80.0 20.0 80.0 25.4 125727 0.0 0 25.4 80.0 125575 0 14557 6526890 18631 0 49038 0 0.00 memory pages lruable pages free pages memory pools pinned pages maxpin percentage minperm percentage maxperm percentage numperm percentage file pages compressed percentage compressed pages numclient percentage maxclient percentage client pages remote pageouts scheduled pending disk I/Os blocked with no pbuf paging space I/Os blocked with no psbuf filesystem I/Os blocked with no fsbuf client filesystem I/Os blocked with no fsbuf external pager filesystem I/Os blocked with no fsbuf Virtualized Partition Memory Page Faults Time resolving virtualized partition memory page faults

The vmo command really gives lots of output. In the following example only a small fraction of the output is shown: # vmo -L .. lrubucket 128K 128K 128K 64K 4KB pages D -------------------------------------------------------------------------------maxclient% 80 80 80 1 100 % memory D maxperm% minperm% -------------------------------------------------------------------------------maxfree 1088 1088 1088 8 200K 4KB pages D minfree memory_frames -------------------------------------------------------------------------------maxperm 394596 394596 S -------------------------------------------------------------------------------maxperm% 80 80 80 1 100 % memory D minperm% maxclient% -------------------------------------------------------------------------------maxpin 424179 424179 S .. .. >> To further look at your virtual memory and its causes, you can use a combination of: --------------------------------------------------------------------------------------# ipcs -bm # lsps -a # vmo -a or vmo -L (shared memory) (paging) (virtual memory options)

3 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

# svmon -G # svmon -U

(basic memory allocations) (virtual memory usage by user)

To print out the memory usage statistics for the users root and steve taking into account only working segments, type: svmon -U root steve -w To print out the top 10 users of the paging space, type: svmon -U -g -t 10 To print out the memory usage statistics for the user steve, including the list of the process identifiers, type: svmon -U steve -l svmon -U emcdm -l

Note: sysdumpdev -e Although the sysdumpdev command is used to show or alter the dumpdevice for a system dump, you can also use it to show how much real memory is used. The command # sysdumpdev -e provides an estimated dump size taking into account the current memory (not pagingspace) currently in use by the system. Note: the rmss command: The rmss (Reduced-Memory System Simulator) command is used to ascertain the effects of reducing the amount of available memory on a system without the need to physically remove memory from the system. It is useful for system sizing, as you can install more memory than is required and then use rmss to reduce it. Using other performance tools, the effects of the reduced memory can be monitored. The rmss command has the ability to run a command multiple times using different simulated memory sizes and produce statistics for all of those memory sizes. The rmss command resides in /usr/bin and is part of the bos.perf.tools fileset, which is installable from the AIX base installation media. Syntax rmss -p -c -r Options -p Print the current value -c MB Change to M size (in Mbytes) -r Restore all memory to use -p Print the current value Example: find out how much memory you have online rmss -p Example: Change available memory to 256 Mbytes rmss -c 256 Example: Undo the above rmss -r Warning: rmss can damage performance very seriously Don't go below 25% of the machines memory Never forget to finish with rmss -r

1.2.3 Show memory in Linux: =========================== # /usr/sbin/dmesg | grep "Physical:" # cat /proc/meminfo The ipcs, vmstat, iostat and that type of commands, are ofcourse more or less the same in Linux as they are in Solaris or AIX.

1.2.4 Show aioservers in AIX: ============================= # lsattr -El aio0 autoconfig available fastpath enable kprocprio 39 maxreqs 4096 maxservers 10 STATE to be configured at system restart State of fast path Server PRIORITY Maximum number of REQUESTS MAXIMUM number of servers per cpu True True True True True

4 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

minservers 1

MINIMUM number of servers

True

# pstat -a | grep -c aios 20 # ps -k | grep aioserver 331962 - 0:15 aioserver 352478 - 0:14 aioserver 450644 - 0:12 aioserver 454908 - 0:10 aioserver 565292 - 0:11 aioserver 569378 - 0:10 aioserver 581660 - 0:11 aioserver 585758 - 0:17 aioserver 589856 - 0:12 aioserver 593954 - 0:15 aioserver 598052 - 0:17 aioserver 602150 - 0:12 aioserver 606248 - 0:13 aioserver 827642 - 0:14 aioserver 991288 - 0:14 aioserver 995388 - 0:11 aioserver 1007616 - 0:12 aioserver 1011766 - 0:13 aioserver 1028096 - 0:13 aioserver 1032212 - 0:13 aioserver What are aioservers in AIX5?: With IO on filesystems, for example if a database is involved, you may try to tune the number of aioservers (asynchronous IO) AIX 5L supports asynchronous I/O (AIO) for database files created both on file system partitions and on raw devices. AIO on raw devices is implemented fully into the AIX kernel, and does not require database processes to service the AIO requests. When using AIO on file systems, the kernel database processes (aioserver) control each request from the time a request is taken off the queue until it completes. The kernel database processes are also used with I/O with virtual shared disks (VSDs) and HSDs with FastPath disabled. By default, FastPath is enabled. The number of aioserver servers determines the number of AIO requests that can be executed in the system concurrently, so it is important to tune the number of aioserver processes when using file systems to store Oracle Database data files. - Use one of the following commands to set the number of servers. This applies only when using asynchronous I/O on file systems rather than raw devices: # smit aio # chdev -P -l aio0 -a maxservers='128' -a minservers='20' - To set asynchronous IO to Available: # chdev -l aio0 -P -a autoconfig=available You need to restart the Server: # shutdown -Fr 1.2.5 aio on Linux distro's: ============================ On some Linux distro's, Oracle 9i/10g supports asynchronous I/O but it is disabled by default because some Linux distributions do not have libaio by default. For Solaris, the following configuration is not required - skip down to the section on enabling asynchronous I/O. On Linux, the Oracle binary needs to be relinked to enable asynchronous I/O. The first thing to do is shutdown the Oracle server. After Oracle has shutdown, do the following steps to relink the binary: su - oracle cd $ORACLE_HOME/rdbms/lib make -f ins_rdbms.mk async_on make -f ins_rdbms.mk ioracle

1.2.6 The ipcs and ipcrm commands: ================================== The "ipcs" command is really a "listing" command. But if you need to intervene in memory structures, like for example if you need to "clear" or remove a shared memory segment, because a faulty or crashed application left semaphores, memory identifiers, or queues in place, you can use to "ipcrm" command to remove those structures. Example ipcrm command usage: ----------------------------

5 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

Suppose an application crashed, but it cannot be started again. The following might help, if you happened to know which IPC identifier it used. Suppose the app used 47500 as the IPC key. Calcultate this decimal number to hex which is, in this example, B98C. No do the following: # ipcs -bm | grep B89C This might give you, for example, the shared memory identifier "50855977". Now clear the segment: # ipcrm -m 50855977 It might also be, that still a semaphore and/or queue is still "left over". In that case you might also try commands like the following example: ipcs -q ipcs -s # ipcrm -s 2228248 # ipcrm -q 5111883 (remove semaphore) (remove queue)

Note: in some cases the "slibclean" command can be used to clear unused modules in kernel and library memory. Just give as root the command: # slibclean Other Example: -------------If you run the following command to remove a shared memory segment and you get this error: # ipcrm -m 65537 ipcrm: 0515-020 shmid(65537) was not found. However, if you run the ipcs command, you still see the segment there: # ipcs | grep 65537 m 65537 0x00000000 DCrw------- root system If you look carefully, you will notice the "D" in the forth column. The "D" means: D If the associated shared memory segment has been removed. It disappears when the last process attached to the segment detaches it. So, to clear the shared memory segment, find the process which is still associated with the segment: # ps -ef | grep process_owner where process_owner is the name of the owner using the shared segment Now kill the process found from the ps command above # kill -9 pid Running another ipcs command will show the shared memory segment no longer exists: # ipcs | grep 65537 Example ipcrm -m 65537

1.2.7 Show patches, version, systeminfo: ======================================== Solaris: ======== showrev: -------#showrev Displays system summary information. #showrev -p Reports which patches are installed sysdef and dmesg: -----------------

6 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

The follwing commands also displays configuration information # sysdef # dmesg versions: --------==> To check your Solaris version: # uname -a or uname -m # cat /etc/release # isainfo -v ==> To check your AIX version: # oslevel # oslevel -r tells you which maintenance level you have.

>> To find the known recommended maintenance levels: # oslevel -rq >> To find all filesets lower than a certain maintenance level: # oslevel -rl 5200-06 >> To find all filesets higher than a certain maintenance level: # oslevel -rg 5200-05 >> To list all known recommended maintenance and technology levels on the system, type: # oslevel -q -s Known Service Packs ------------------5300-05-04 5300-05-03 5300-05-02 5300-05-01 5300-05-00 5300-04-CSP 5300-04-03 5300-04-02 5300-04-01 5300-03-CSP >> How can I determine which fileset updates are missing from a particular AIX level? To determine which fileset updates are missing from 5300-04, for example, run the following command: # oslevel -rl 5300-04 >> What SP (Service Pack) is installed on my system? To see which SP is currently installed on the system, run the oslevel -s command. Sample output for an AIX 5L Version 5.3 system, with TL4, and SP2 installed would be: # oslevel s 5300-04-02 >> Is a CSP (Concluding Service Pack) installed on my system? To see if a CSP is currently installed on the system, run the oslevel -s command. Sample output for an AIX 5L Version 5.3 system, with TL3, and CSP installed would be: # oslevel s 5300-03-CSP

==> To check your HP machine: # model 9000/800/rp7410 : machine info on AIX How do I find out the Chip type, System name, Node name, Model Number etc.? The uname command provides details about your system. uname -p For example, powerpc. uname uname uname uname uname -r -s -n -a -M Displays Displays Displays Displays Displays the the the the the Displays the chip type of the system.

release number of the operating system. system name. For example, AIX. name of the node. system name, nodename,Version, Machine id. system model name. For example, IBM, 7046-B50.

7 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

uname -v uname -m uname -u

Displays the operating system version Displays the machine ID number of the hardware running the system. Displays the system ID number.

Architecture: ------------To see if you have a CHRP machine, log into the machine as the root user, and run the following command: # lscfg | grep Architecture # lscfg -pl sysplanar0 | more or use:

The bootinfo -p command also shows the architecture of the pSeries, RS/6000 # bootinfo -p chrp 1.2.8 Check whether you have a 32 bit or 64 bit version: ======================================================== - Solaris: # iasinfo -vk If /usr/bin/isainfo cannot be found, then the OS only supports 32-bit process address spaces. (Solaris 7 was the first version that could run 64-bit binaries on certain SPARC-based systems.) So a ksh-based test might look something like if [ -x /usr/bin/isainfo ]; then bits=`/usr/bin/isainfo -b` else bits=32 fi - AIX: Command: -or/bin/lslpp -l bos.64bit /bin/locale64 ...to see if bos.64bit is installed & committed. ...error message if on 32bit machine such as: Could not load program /bin/locale64: Cannot run a 64-bit program on a 32-bit machine.

Or use: # bootinfo -K # bootinfo -y # bootinfo -p Or use: # /usr/bin/getconf HARDWARE_BITMODE This command should return the following output: 64 displays the current kernel wordsize of "32" or "64" tells if hardware is 64-bit capable If it returns the string 32 it is only capable of running the 32-bit kernel. If it returns the string chrp the machine is capable of running the 64-bit kernel or the 32-bit kernel.

Note: ----HOW TO CHANGE KERNEL MODE OF IBM AIX 5L (5.1) --------------------------------------------The AIX 5L has pre-configured kernels. These are listed below for Power processors: /usr/lib/boot/unix_up /usr/lib/boot/unix_mp /usr/lib/boot/unix_64 32 bit uni-processor 32 bit multi-processor kernel 64 bit multi-processor kernel

Switching between kernel modes means using different kernels. This is simply done by pointing the location that is referenced by the system to these kernels. Use symbolic links for this purpose. During boot AIX system runs the kernel in the following locations: /unix /usr/lib/boot/unix The base operating system 64-bit runtime fileset is bos.64bit. Installing bos.64bit also installs the /etc/methods/cfg64 file. The /etc/methods/cfg64 file provides the option of enabling or disabling

8 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

the 64-bit environment via SMIT, which updates the /etc/inittab file with the load64bit line. (Simply adding the load64bit line does not enable the 64-bit environment). The command lslpp -l bos.64bit reveals if this fileset is installed. The bos.64bit fileset is on the AIX media; however, installing the bos.64bit fileset does not ensure that you will be able to run 64-bit software. If the bos.64bit fileset is installed on 32-bit hardware, you should be able to compile 64-bit software, but you cannot run 64-bit programs on 32-bit hardware. The syscalls64 extension must be loaded in order to run a 64-bit executable. This is done from the load64bit entry in the inittab file. You must load the syscalls64 extension even when running a 64-bit kernel on 64-bit hardware. To determine if the 64-bit kernel extension is loaded, at the command line, enter genkex |grep 64. Information similar to the following displays: 149bf58 a3ec /usr/lib/drivers/syscalls64.ext To change the kernel mode follow steps below: 1. Create of the 2. Create 3. Reboot symbolic link from /unix and /usr/lib/boot/unix to the location desired kernel. boot image. AIX.

Below lists the detailed actions to change kernel mode: To change to 32 bit uni-processor mode: # # # # ln -sf /usr/lib/boot/unix_up ln -sf /usr/lib/boot/unix_up bosboot -ad /dev/ipldevice shutdown -r /unix /usr/lib/boot/unix

To change to 32 bit multi-processor mode: # # # # ln -sf /usr/lib/boot/unix_mp ln -sf /usr/lib/boot/unix_mp bosboot -ad /dev/ipldevice shutdown -r /unix /usr/lib/boot/unix

To change to 64 bit multi-processor mode: # # # # ln -sf /usr/lib/boot/unix_64 ln -sf /usr/lib/boot/unix_64 bosboot -ad /dev/ipldevice shutdown -r /unix /usr/lib/boot/unix

IMPORTANT NOTE: If you are changing the kernel mode to 32-bit and you will run 9.2 on this server, the following line should be included in /etc/inittab: load64bit:2:wait:/etc/methods/cfg64 >/dev/console 2>&1 # Enable 64-bit execs This allows 64-bit applications to run on the 32-bit kernel. Note that this line is also mandatory if you are using the 64-bit kernel. In AIX 5.2, the 32-bit kernel is installed by default. The 64-bit kernel, along with JFS2 (enhanced journaled file system), can be enabled at installation time. Checking if other unixes are in 32 or 64 mode: ---------------------------------------------- Digital UNIX/Tru64: This OS is only available in 64bit form.

- HP-UX(Available in 64bit starting with HP-UX 11.0): Command: /bin/getconf KERNEL_BITS ...returns either 32 or 64 - SGI: This OS is only available in 64bit form.

- The remaining supported UNIX platforms are only available in 32bit form. scinstall: ---------# scinstall -pv Displays Sun Cluster software release and package version information 1.2.9 Info about CPUs: ====================== Solaris:

9 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

-------# psrinfo -v Shows the number of processors and their status. # psrinfo -v|grep "Status of processor"|wc -l Shows number of cpu's Linux: -----# cat /proc/cpuinfo # cat /proc/cpuinfo | grep processor|wc l Especially with Linux, the /proc directory contains special "files" that either extract information from or send information to the kernel HP-UX: -----# # # # ioscan -kfnC processor /usr/sbin/ioscan -kf | grep processor grep processor /var/adm/syslog/syslog.log /usr/contrib/bin/machinfo (Itanium)

Several ways as, 1. 2. 3. 4. 5. 6. sam -> performance monitor -> processor print_manifest (if ignite-ux installed) machinfo (11.23 HP versions) ioscan -fnC processor echo "processor_count/D" | adb /stand/vmunix /dev/kmem top command to get cpu count

The "getconf" command can give you a lot of interesting info. The parameters are: ARG_MAX BS_SCALE_MAX CHAR_BIT CHILD_MAX CPU_CHIP_TYPE CS_PATH HW_CPU_SUPP_BITS INT_MIN LONG_BIT MACHINE_IDENT MB_LEN_MAX NL_LANGMAX NL_SETMAX OPEN_MAX _POSIX_ARG_MAX _POSIX_OPEN_MAX _POSIX_STREAM_MAX POSIX_ARG_MAX POSIX_LINK_MAX POSIX_NAME_MAX POSIX_PATH_MAX POSIX_SSIZE_MAX POSIX_VERSION POSIX2_BC_SCALE_MAX POSIX2_C_DEV POSIX_CHILD_MAX POSIX2_FORT_DEV POSIX2_LOCALEDEF POSIX2_UPE SC_XOPEN_VERSION SHRT_MAX Example: # getconf CPU_VERSION sample function in shell script: get_cpu_version() { case `getconf CPU_VERSION` in # ???) echo "Itanium[TM] 2" ;; 768) echo "Itanium[TM] 1" ;; 532) echo "PA-RISC 2.0" ;; 529) echo "PA-RISC 1.2" ;; 528) echo "PA-RISC 1.1" ;; _BC_BASE_MAX BC_STRING_MAX CHAR_MAX CLK_TCK CS_MACHINE_IDENT CS_MACHINE_SERIAL HW_32_64_CAPABLE KERNEL_BITS LONG_MAX MACHINE_MODEL NGROUPS_MAX NL_MSGMAX NL_TEXTMAX PARTITION_IDENT _POSIX_JOB_CONTROL _POSIX_SAVED_IDS _POSIX_TZNAME_MAX POSIX_CHILD_MAX POSIX_MAX_CANON POSIX_NGROUPS_MAX POSIX_PIPE_BUF POSIX_STREAM_MAX POSIX2_BC_BASE_MAX POSIX2_BC_STRING_MAX POSIX2_C_VERSION POSIX2_COLL_WEIGHTS_MAX POSIX2_FORT_RUN POSIX2_RE_DUP_MAX POSIX2_VERSION SCHAR_MAX SHRT_MIN BC_DIM_MAX CHARCLASS_NAME_MAX CHAR_MIN COLL_WEIGHTS_MAX CS_PARTITION_IDENT EXPR_NEST_MAX INT_MAX LINE_MAX LONG_MIN MACHINE_SERIAL NL_ARGMAX NL_NMAX NZERO PATH _POSIX_NGROUPS_MAX _POSIX_SSIZE_MAX _POSIX_VERSION POSIX_JOB_CONTROL POSIX_MAX_INPUT POSIX_OPEN_MAX POSIX_SAVED_IDS POSIX_TZNAME_MAX POSIX2_BC_DIM_MAX POSIX2_C_BIND POSIX2_CHAR_TERM POSIX2_EXPR_NEST_MAX POSIX2_LINE_MAX POSIX2_SW_DEV SC_PASS_MAX SCHAR_MIN SSIZE_MAX

10 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

523) echo "PA-RISC 1.0" ;; *) return 1 ;; esac return 0

AIX: ---# pmcycles Cpu 0 runs Cpu 1 runs Cpu 2 runs Cpu 3 runs -m at at at at 1656 1656 1656 1656 MHz MHz MHz MHz

# lscfg | grep proc More cpu information on AIX: # lsattr -El procx (where x is the number of the cpu) type powerPC_POWER5 Processor type False frequency 165600000 Processor speed False .. .. where False means that the value cannot be changed through an AIX command. To view CPU scheduler tunable parameters, use the schedo command: # schedo -a In AIX 5L on Power5, you can switch from Simultaneous Multithreading SMT, or Single Threading ST, as follows (smtcl) # smtctl -m off will set SMT mode to disabled # smtctl -m on will set SMT mode to enabled # smtctl -W boot makes SMT effective on next boot # smtctl -W now effects SMT now, but will not persist across reboots When you want to keep the setting across reboots, you must use the bosboot command in order to create a new boot image. 1.2.10 Other stuff: =================== runlevel: --------To show the init runlevel: # who -r Top users: ---------To get a quick impression about the top 10 users in the system at this time: ps auxw | sort r +3 |head 10 ps auxw | sort r +2 |head 10 -Shows top 10 memory usage by process -Shows top 10 CPU usage by process

shared memory: -------------To check shared memory segment, semaphore array, and message queue limits, issue the ipcs -l command. # ipcs The following tools are available for monitoring the performance of your UNIX-based system. pfiles: ------/usr/proc/bin/pfiles This shows the open files for this process, which helps you diagnose whether you are having problems caused by files not getting closed. lsof: ----This utility lists open files for running UNIX processes, like pfiles. However, lsof gives more useful information than pfiles. You can find lsof at ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/. Example of lsof usage: You can see CIO (concurrent IO) in the FILE-FLAG column if you run lsof +fg, e.g.:

11 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

tarunx01:/home/abielewi:# /p570build/LSOF/lsof-4.76/usr/local/bin/lsof +fg /baanprd/oradat COMMAND PID USER FD TYPE FILE-FLAG DEVICE SIZE/OFF NODE NAME oracle 434222 oracle 16u VREG R,W,CIO,DSYN,LG;CX 39,1 6701056 866 /baanprd/oradat (/dev/bprdoradat) oracle 434222 oracle 17u VREG R,W,CIO,DSYN,LG;CX 39,1 6701056 867 /baanprd/oradat (/dev/bprdoradat) oracle 442384 oracle 15u VREG R,W,CIO,DSYN,LG;CX 39,1 1174413312 875 /baanprd/oradat (/dev/bprdoradat) oracle 442384 oracle 16u VREG R,W,CIO,DSYN,LG;CX 39,1 734011392 877 /baanprd/oradat (/dev/bprdoradat) oracle 450814 oracle 15u VREG R,W,CIO,DSYN,LG;CX 39,1 1174413312 875 /baanprd/oradat (/dev/bprdoradat) oracle 450814 oracle 16u VREG R,W,CIO,DSYN,LG;CX 39,1 1814044672 876 /baanprd/oradat (/dev/bprdoradat) oracle 487666 oracle 15u VREG R,W,CIO,DSYN,LG;CX 39,1 1174413312 875 /baanprd/oradat (/dev/bprdoradat You should also see O_CIO in your file open calls if you run truss, e.g.: open("/opt/oracle/rcat/oradat/redo01.log", O_RDWR|O_CIO|O_DSYNC|O_LARGEFILE) = 18

VMSTAT SOLARIS: --------------# vmstat This command is ideal for monitoring paging rate, which can be found under the page in (pi) and page out (po) columns. Other important columns are the amount of allocated virtual storage (avm) and free virtual storage (fre). This command is useful for determining if something is suspended or just taking a long time. Example: kthr r b w 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 memory page disk faults cpu swap free re mf pi po fr de sr m0 m1 m3 m4 in sy cs us sy 2163152 1716720 157 141 1179 1 1 0 0 0 0 0 0 680 1737 855 10 3 2119080 1729352 0 1 0 0 0 0 0 0 0 1 0 345 658 346 1 1 2118960 1729232 0 167 0 0 0 0 0 0 0 0 0 402 1710 812 4 2 2112992 1723264 0 1261 0 0 0 0 0 0 0 0 0 1026 5253 1848 10 5 2112088 1722352 0 248 0 0 0 0 0 0 0 0 0 505 2822 1177 5 2 2116288 1726544 4 80 0 0 0 0 0 0 0 0 0 817 4015 1530 6 4 2117744 1727960 4 2 30 0 0 0 0 0 0 0 0 473 1421 640 2 2 id 87 98 94 85 92 90 97

procs/r: Run queue length. procs/b: Processes blocked while waiting for I/O. procs/w: Idle processes which have been swapped. memory/swap: Free, unreserved swap space (Kb). memory/free: Free memory (Kb). (Note that this will grow until it reaches lotsfree, at which point the page scanner is started. See "Paging" for more details.) page/re: Pages reclaimed from the free list. (If a page on the free list still contains data needed for a new request, it can be remapped.) page/mf: Minor faults (page in memory, but not mapped). (If the page is still in memory, a minor fault remaps the page. It is comparable to the vflts value reported by sar -p.) page/pi: Paged in from swap (Kb/s). (When a page is brought back from the swap device, the process will stop execution and wait. This may affect performance.) page/po: Paged out to swap (Kb/s). (The page has been written and freed. This can be the result of activity by the pageout scanner, a file close, or fsflush.) page/fr: Freed or destroyed (Kb/s). (This column reports the activity of the page scanner.) page/de: Freed after writes (Kb/s). (These pages have been freed due to a pageout.) page/sr: Scan rate (pages). Note that this number is not reported as a "rate," but as a total number of pages scanned. disk/s#: Disk activity for disk # (I/O's per second). faults/in: Interrupts (per second). faults/sy: System calls (per second). faults/cs: Context switches (per second). cpu/us: User CPU time (%). cpu/sy: Kernel CPU time (%). cpu/id: Idle + I/O wait CPU time (%). When analyzing vmstat output, there are several metrics to which you should pay attention. For example, keep an eye on the CPU run queue column. The run queue should never exceed the number of CPUs on the server. If you do notice the run queue exceeding the amount of CPUs, its a good indication that your server has a CPU bottleneck. To get an idea of the RAM usage on your server, watch the page in (pi) and page out (po) columns of vmstats output. By tracking common virtual memory operations such as page outs, you can infer the times that the Oracle database is performing a lot of work. Even though UNIX page ins must correlate with the vmstats refresh rate to accurately predict RAM swapping, plotting page ins can tell you when the server is having spikes of RAM usage. Once captured, it's very easy to take the information about server performance directly from the

12 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

Oracle tables and plot them in a trend graph. Rather than using an expensive statistical package such as SAS, you can use Microsoft Excel. Copy and paste the data from the tables into Excel. After that, you can use the Chart Wizard to create a line chart that will help you view server usage information and discover trends. # VMSTAT AIX: ------------This is virtually equal to the usage of vmstat under solaris. vmstat can be used to give multiple statistics on the system. For CPU-specific work, try the following command: # vmstat -t 1 3 This will take 3 samples, 1 second apart, with timestamps (-t). You can, of course, change the parameters as you like. The output is shown below. kthr ----r b 0 0 0 0 2 0 memory page faults cpu time ----------- ------------------------ ------------ ----------- -------avm fre re pi po fr sr cy in sy cs us sy id wa hr mi se 45483 221 0 0 0 0 1 0 224 326 362 24 7 69 0 15:10:22 45483 220 0 0 0 0 0 0 159 83 53 1 1 98 0 15:10:23 45483 220 0 0 0 0 0 0 145 115 46 0 9 90 1 15:10:24

In this output some of the things to watch for are: "avm", which is Active Virtual Memory. Ideally, under normal conditions, the largest avm value should in general be smaller than the amount of RAM. If avm is smaller than RAM, and still exessive paging occurs, that could be due to RAM being filled with file pages. avm x 4K = number of bytes Columns r (run queue) and b (blocked) start going up, especially above 10. This usually is an indication that you have too many processes competing for CPU. If cs (contact switches) go very high compared to the number of processes, then you may need to tune the system with vmtune. In the cpu section, us (user time) indicates the time is being spent in programs. Assuming Java is at the top of the list in tprof, then you need to tune the Java application). In the cpu section, if sys (system time) is higher than expected, and you still have id (idle) time left, this may indicate lock contention. Check the tprof for lock related calls in the kernel time. You may want to try multiple instances of the JVM. It may also be possible to find deadlocks in a javacore file. In the cpu section, if wa (I/O wait) is high, this may indicate a disk bottleneck, and you should use iostat and other tools to look at the disk usage. Values in the pi, po (page in/out) columns It may be possible that you have the stack It could also mean that you have allocated you may also have other applications using Other example: -------------# vmstat 1 System configuration: lcpu=2 mem=3920MB kthr ----r b 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 memory ----------avm fre 229367 332745 229367 332745 229367 332745 229367 332745 229367 332745 229367 332745 229367 332745 229367 332745 229367 332745 229367 332745 229367 332745 page faults cpu ------------------------ ------------ ----------re pi po fr sr cy in sy cs us sy id wa 0 0 0 0 0 0 3 198 69 0 0 99 0 0 0 0 0 0 0 3 33 66 0 0 99 0 0 0 0 0 0 0 2 33 68 0 0 99 0 0 0 0 0 0 0 80 306 100 0 1 97 1 0 0 0 0 0 0 1 20 68 0 0 99 0 0 0 0 0 0 0 2 36 64 0 0 99 0 0 0 0 0 0 0 2 33 66 0 0 99 0 0 0 0 0 0 0 2 21 66 0 0 99 0 0 0 0 0 0 0 1 237 64 0 0 99 0 0 0 0 0 0 0 2 19 66 0 0 99 0 0 0 0 0 0 0 6 37 76 0 0 99 0 are non-zero may indicate that you are paging and need more memory. size set too high for some of your JVM instances. a heap larger than the amount of memory on the system. Of course, memory, or that file pages may be taking up too much of the memory

The most important fields to look at here are:

13 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

r -- The average number of runnable kernel threads over whatever sampling interval you have chosen. b -- The average number of kernel threads that are in the virtual memory waiting queue over your sampling interval. r shoul fre -- The size of your memory free list. Do not worry so much if the amount is really small. More importantly, determine i pi -- Pages paged in from paging space. po -- Pages paged out to paging space. CPU section: us sy id wa Let's look at the last section, which also comes up in most other CPU monitoring tools, albeit with different headings: us sy id wa ----user time system time idle time waiting on I/O

# IOSTAT: --------This command is useful for monitoring I/O activities. You can use the read and write rate to estimate the amount of time required for certain SQL operations (if they are the only activity on the system). This command is also useful for determining if something is suspended or just taking a long time. Basic synctax is iostat interval count

option - let you specify the device for which information is needed like disk , cpu or terminal. (-d , -c , -t or -tdc ) . x options gives the extended statistics . interval count is time period in seconds between two samples . iostat 4 will give data at each 4 seconds interval.

- is the number of times the data is needed .

iostat 4 5 will give data at 4 seconds interval 5 times.

Example: $ iostat -xtc 5 2 disk r/s sd0 2.6 sd1 4.2 sd2 0.0 sd3 10.2 disk r/s w/s Kr/s Kw/s wait actv %w %b w/s 3.0 1.0 0.0 1.6 extended disk statistics Kr/s Kw/s wait actv svc_t %w %b 20.7 22.7 0.1 0.2 59.2 6 19 33.5 8.0 0.0 0.2 47.2 2 23 0.0 0.0 0.0 0.0 0.0 0 0 51.4 12.8 0.1 0.3 31.2 3 31 tty cpu tin tout us sy wt id 0 84 3 85 11 0

name of the disk reads per second writes per second kilobytes read per second kilobytes written per second average number of transactions waiting for service (Q length) average number of transactions actively being serviced (removed from the queue but not yet completed) percent of time there are transactions waiting for service (queue non-empty) percent of time the disk is busy (transactions in progress) are:

The values to look from the iostat output

Reads/writes per second (r/s , w/s) Percentage busy (%b) Service time (svc_t) If a disk shows consistently high reads/writes along with , the percentage busy (%b) of the disks is greater than 5 percent, and the average service time (svc_t) is greater than 30 milliseconds, then action needs to be taken. # netstat This command lets you know the network traffic on each node, and the number of error packets encountered. It is useful for isolating network problems. Example: To find out all listening services, you can use the command # netstat -a -f inet

1.2.11 Some other utilities for Solaris: ======================================== # top For example:

14 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

load averages: 0.66, 0.54, 0.56 11:14:48 187 processes: 185 sleeping, 2 on cpu CPU states: % idle, % user, % kernel, % iowait, Memory: 4096M real, 1984M free, 1902M swap in use, 2038M swap free PID 2795 2294 13907 14138 2797 2787 2799 2743 2011 2007 2009 2804 2013 2035 114 USERNAME THR PRI NICE SIZE RES STATE oraclown 1 59 0 265M 226M sleep root 11 59 0 8616K 7672K sleep oraclown 11 59 0 271M 218M cpu2 oraclown 12 59 0 270M 230M sleep oraclown 1 59 0 189M 151M sleep oraclown 11 59 0 191M 153M sleep oraclown 1 59 0 190M 151M sleep oraclown 11 59 0 191M 155M sleep oraclown 11 59 0 191M 149M sleep oraclown 11 59 0 191M 149M sleep oraclown 11 59 0 191M 149M sleep oraclown 1 51 0 1760K 1296K cpu2 oraclown 11 59 0 191M 148M sleep oraclown 11 59 0 191M 149M sleep root 10 59 0 5016K 4176K sleep TIME 0:13 10:54 4:02 9:03 0:01 0:06 0:02 0:25 2:50 2:22 1:54 0:00 0:36 2:44 23:34 CPU 4.38% 3.94% 2.23% 1.76% 0.96% 0.69% 0.45% 0.35% 0.27% 0.26% 0.20% 0.19% 0.14% 0.13% 0.05% COMMAND oracle bpbkar oracle oracle oracle oracle oracle oracle oracle oracle oracle top oracle oracle picld

% swap

Process ID This column shows the process ID (pid) of each process. The process ID is a positive number, usually less than 65536. It is used for identification during the life of the process. Once a process has exited or been killed, the process ID can be reused. Username This column shows the name of the user who owns the process. The kernel stores this information as a uid, and top uses an appropriate table (/etc/passwd, NIS, or NIS+) to translate this uid in to a name. Threads This column displays the number of threads for the current process. This column is present only in the Solaris 2 port of top. For Solaris, this number is actually the number of lightweight processes (lwps) created by the threads package to handle the threads. Depending on current resource utilization, there may not be one lwp for every thread. Thus this number is actually less than or equal to the total number of threads created by the process. Nice This column reflects the "nice" setting of each process. A process's nice is inhereted from its parent. Most user processes run at a nice of 0, indicating normal priority. Users have the option of starting a process with a positive nice value to allow the system to reduce the priority given to that process. This is normally done for long-running cpu-bound jobs to keep them from interfering with interactive processes. The Unix command "nice" controls setting this value. Only root can set a nice value lower than the current value. Nice values can be negative. On most systems they range from -20 to 20. The nice value influences the priority value calculated by the Unix scheduler. Size This column shows the total amount of memory allocated by each process. This is virtual memory and is the sum total of the process's text area (program space), data area, and dynamically allocated area (or "break"). When a process allocates additional memory with the system call "brk", this value will increase. This is done indirectly by the C library function "malloc". The number in this column does not reflect the amount of physical memory currently in use by the process. Resident Memory This column reflects the amount of physical memory currently allocated to each process. This is also known as the "resident set size" or RSS. A process can have a large amount of virtual memory allocated (as indicated by the SIZE column) but still be using very little physical memory. Process State This column reflects the last observed state of each process. State names vary from system to system. These states are analagous to those that appear in the process states line: the second line of the display. The more common state names are listed below. cpu - Assigned to a CPU and currently running run - Currently able to run sleep - Awaiting an external event, such as input from a device stop - Stopped by a signal, as with control Z swap - Virtual address space swapped out to disk zomb - Exited, but parent has not called "wait" to receive the exit status CPU Time This column displayes the accumulated CPU time for each process. This is the amount of time that any cpu in the system has spent actually running this process. The standard format shows two digits indicating minutes, a colon, then two digits indicating seconds. For example, the display "15:32" indicates fifteen minutes and thirty-two seconds. When a time value is greater than or equal to 1000 minutes, it is displayed as hours with the suffix H. For example, the display "127.4H" indicates 127 hours plus four tenths of an hour (24 minutes). When the number of hours exceeds 999.9, the "H" suffix is dropped so that the display continues to fit in the column. CPU Percentage This column shows the percentage of the cpu that each process is currently consuming.

15 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

By default, top will sort this column of the output. Some versions of Unix will track cpu percentages in the kernel, as the figure is used in the calculation of a process's priority. On those versions, top will use the figure as calculated by the kernel. Other versions of Unix do not perform this calculation, and top must determine the percentage explicity by monitoring the changes in cpu time. On most multiprocessor machines, the number displayed in this column is a percentage of the total available cpu capacity. Therefore, a single threaded process running on a four processor system will never use more than 25% of the available cpu cycles. Command This column displays the name of the executable image that each process is running. In most cases this is the base name of the file that was invoked with the most recent kernel "exec" call. On most systems, this name is maintained separately from the zeroth argument. A program that changes its zeroth argument will not affect the output of this column.

# modinfo The modinfo command provides information about the modules currently loaded by the kernel. The /etc/system file: Available for Solaris Operating Environment, the /etc/system file contains definitions for kernel configuration limits such as the maximum number of users allowed on the system at a time, the maximum number of processes per user, and the inter-process communication (IPC) limits on size and number of resources. These limits are important because they affect DB2 performance on a Solaris Operating Environment machine. See the Quick Beginnings information for further details. # more /etc/path_to_inst To see the mapping between the kernel abbreviated instance name for physical device names, view the /etc/path_to_inst file. # uptime uptime - show how long the system has been up /export/home/oraclown>uptime 11:32am up 4:19, 1 user, load average: 0.40, 1.17, 0.90

1.2.12 Wellknown tools for AIX: =============================== 1. commands: -----------CPU Memory Subsystem I/O Subsystem Network Subsystem --------------------------------------------------------------------------------vmstat vmstat iostat netstat iostat lsps vmstat ifconfig ps svmon lsps tcpdump sar filemon filemon tprof ipcs lvmstat nmon and topas can be used to monitor those subsystems in general. 2. topas: --------topas is a useful graphical interface that will give you immediate results of what is going on in the system. When you run it without any command-line arguments, the screen looks like this: Topas Monitor for host: Mon Apr 16 16:16:50 2001 Kernel User Wait Idle 63.1 36.8 0.0 0.0 aix4prt Interval: EVENTS/QUEUES Cswitch 5984 Syscall 15776 Reads 8 Writes 2469 Forks 0 Execs 0 Runqueue 11.5 Waitqueue 0.0 PAGING Faults Steals PgspIn PgspOut PageIn PageOut Sios 3862 1580 0 0 0 0 0 FILE/TTY Readch Writech Rawin Ttyout Igets Namei Dirblk MEMORY Real,MB % Comp % Noncomp % Client

2 | | | | KB-Out 106.9 33.8

|################## |########## | | I-Pack 2154.2 16.9 KBPS 0.0 O-Pack 2153.7 34.4 KB-In 107.0 0.9

4864 34280 0 0 0 4 0

Network KBPS lo0 213.9 tr0 34.7 Disk hdisk0 Name java java lrud aixterm topas ksh Busy% 0.0

TPS KB-Read KB-Writ 0.0 0.0 0.0

1023 27.0 73.9 0.5

PID CPU% PgSp Owner 16684 83.6 35.1 root 12192 12.7 86.2 root 1032 2.7 0.0 root 19502 0.5 0.7 root 6908 0.5 0.8 root 18148 0.0 0.7 root

NFS (calls/sec) ServerV2 0 ClientV2 0

PAGING SPACE Size,MB 512 % Used 1.2 % Free 98.7 Press:

16 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

gil

1806

0.0

0.0 root

ServerV3

0

"h" for help

The information on the bottom left side shows the most active processes; here, java is consuming 83.6% of CPU. The middle right area shows the total physical memory (1 GB in this case) and Paging space (512 MB), as well as the amount being used. So you get an excellent overview of what the system is doing in a single screen, and then you can select the areas to concentrate based on the information being shown here. Note: about waits: -----------------Don't get caught up in this whole wait i/o thing. a single cpu system with 1 i/o outstanding and no other runable threads (i.e. idle) will have 100% wait i/o. There was a big discussion a couple of years ago on removing the kernel tick as it has confused many many many techs. So, if you have only 1 or few cpu, then you are going to have high wait i.o figures, it does not neccessarily mean your disk subsystem is slow.

3. trace: --------trace captures a sequential flow of time-stamped system events. The trace is a valuable tool for observing system and application execution. While many of the other tools provide high level statistics such as CPU and I/O utilization, the trace facility helps expand the information as to where the events happened, which process is responsible, when the events took place, and how they are affecting the system. Two post processing tools that can extract information from the trace are utld (in AIX 4) and curt (in AIX 5). These provide statistics on CPU utilization and process/thread activity. The third post processing tool is splat which stands for Simple Performance Lock Analysis Tool. This tool is used to analyze lock activity in the AIX kernel and kernel extension for simple locks. 4. nmon: -------nmon is a free software tool that gives much of the same information as topas, but saves the information to a file in Lotus 123 and Excel format. The download site is http://www.ibm.com/developerworks/eserver/articles/analyze_aix/. The information that is collected included CPU, disk, network, adapter statistics, kernel counters, memory and the "top" process information. 5. tprof: --------tprof is one of the AIX legacy tools that provides a detailed profile of CPU usage for every AIX process ID and name. It has been completely rewritten for AIX 5.2, and the example below uses the AIX 5.1 syntax. You should refer to AIX 5.2 Performance Tools update: Part 3 for the new syntax. The simplest way to invoke this command is to use: # tprof -kse -x "sleep 10" # tprof -ske -x "sleep 30" At the end of ten seconds, or 30 seconds, a new file __prof.all, or sleep.prof, is generated that contains information about what commands are using CPU on the system. Searching for FREQ, the information looks something like the example below: Process ======= oracle java wait ... ======= Total === 1060 ===== ====== 19577 7947 ==== ====== 7252 3087 ===== 1291 FREQ === 244 247 16 Total Kernel ===== ====== 10635 3515 3970 617 1515 1515 User Shared ==== ====== 6897 223 0 2062 0 0 Other ===== 0 1291 0

This example shows that over half the CPU time is associated with the oracle application and that Java is using about 3970/19577 or 1/5 of the CPU. The wait usually means idle time, but can also include the I/O wait portion of the CPU usage. svmon: -----The svmon command captures a snapshot of the current state om memory. use it with the -G switch to get global statistics for the whole system. svmon is the most useful tool at your disposal when monitoring a Java process, especially native heap.

17 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

The article "When segments collide" gives examples of how to use svmon -P -m to monitor the native heap of a Java process on AIX. But there is another variation, svmon -P -m -r, that is very effective in identifying native heap fragmentation. The -r switch prints the address range in use, so it gives a more accurate view of how much of each segment is in use. As an example, look at the partially edited output below: Pid Command 10556 java Vsid 22ac4 21047 126a2 7908c b2ad6 b1475 30fe5 91072 6bced b1035 e0f9f 19100 c965a 7910c e801d a0fb7 21127 a8535 Esid 9 8 a 7 b 5 3 4 6 d f 2 1 Type mmap mmap mmap mmap mmap work work work work work Addr work work work work Addr work Addr work Addr work Addr pers Addr Inuse 681613 Pin 2316 b1475 30fe5 91072 6bced b1035 Pgsp Virtual 64-bit Mthrd LPage 2461 501080 N Y N LPage Inuse 0 0 0 0 0 65536 65536 65536 65536 45054 48284 46997 46835 37070 9172 105 50 11 Pin Pgsp Virtual 0 0 0 0 0 0 282 65536 0 285 65536 0 54 65536 0 261 65536 0 0 45054 0 0 0 0 0 0 2 0 3 463 281 0 0 1 1 48284 47210 46953 37070 9220 106 51 -

Description mapped to sid mapped to sid mapped to sid mapped to sid mapped to sid

Range: 0..45055 shmat/mmap shmat/mmap shmat/mmap shmat/mmap Range: 0..50453 shared library text Range: 0..30861 shared library data Range: 0..2521 process private Range: 65300..65535 code,/dev/q109waslv:81938 Range: 0..11

Other example: # svmon -G -i 2 5 memory size inuse 16384 16250 16384 16250 16384 16250 16384 16250 16384 16250 free 134 134 134 134 134 pin 2006 2006 2006 2006 2006 # sample five times at two second intervals in use work pers 10675 2939 10675 2939 10675 2939 10675 2939 10675 2939 clnt 2636 2636 2636 2636 2636 work 2006 2006 2006 2006 2006 pin pers 0 0 0 0 0 clnt 0 0 0 0 0 pg space size inuse 40960 12674 40960 12674 40960 12674 40960 12674 40960 12674

In this example, there are 16384 pages of total size of memory. Multuply this number by 4096 to see the total real memory size. In this case the total memory is 64 MB.

filemon: -------filemon can be used to identify the files that are being used most actively. This tool gives a very comprehensive view of file access, and can be useful for drilling down once vmstat/iostat confirm disk to be a bottleneck. Example: # filemon -o /tmp/filemon.log; sleep 60; trcstop The generated log file is quite large. Some sections that may be useful are: Most Active Files -----------------------------------------------------------------------#MBs #opns #rds #wrs file volume:inode -----------------------------------------------------------------------25.7 83 6589 0 unix /dev/hd2:147514 16.3 1 4175 0 vxe102 /dev/mailv1:581 16.3 1 0 4173 .vxe102.pop /dev/poboxv:62 15.8 1 1 4044 tst1 /dev/mailt1:904 8.3 2117 2327 0 passwd /dev/hd4:8205 3.2 182 810 1 services /dev/hd4:8652 ... -----------------------------------------------------------------------Detailed File Stats -----------------------------------------------------------------------FILE: /var/spool/mail/v/vxe102 volume: /dev/mailv1 (/var/spool2/mail/v) opens: 1 total bytes xfrd: 17100800 inode: 581

18 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

reads: read sizes (bytes): read times (msec): ... curt: -----

4175 (0 errs) avg 4096.0 min avg 0.543 min

4096 max 0.011 max

4096 sdev 78.060 sdev

0.0 2.753

curt Command Purpose The CPU Utilization Reporting Tool (curt) command converts an AIX trace file into a number of statistics related to CPU utilization and either process, thread or pthread activity. These statistics ease the tracking of specific application activity. curt works with both uniprocessor and multiprocessor AIX Version 4 and AIX Version 5 traces. Syntax curt -i inputfile [-o outputfile] [-n gennamesfile] [-m trcnmfile] [-a pidnamefile] [-f timestamp] [-l timestamp] [-ehpstP] Description The curt command takes an AIX trace file as input and produces a number of statistics related to processor (CPU) utilization and process/thread/pthread activity. It will work with both uniprocessor and multiprocessor AIX traces if the processor clocks are properly synchronized.

1.2.13 Not so well known tools for AIX: the proc tools: ======================================================= --proctree Displays the process tree containing the specified process IDs or users. To display the ancestors and all the children of process 12312, enter: # proctree 21166 11238 /usr/sbin/srcmstr 21166 /usr/sbin/rsct/bin/IBM.AuditRMd To display the ancestors and children of process 21166, including children of process 0, enter: #proctree a 21166 1 /etc/init 11238 /usr/sbin/srcmstr 21166 /usr/sbin/rsct/bin/IBM.AuditRMd

-- procstack Displays the hexadecimal addresses and symbolic names for each of the stack frames of the current thread in processes. To display the current stack of process 15052, enter: # procstack 15052 15052 : /usr/sbin/snmpd d025ab80 select (?, ?, ?, ?, ?) + 90 100015f4 main (?, ?, ?) + 1814 10000128 __start () + 8c Currently, procstack displays garbage or wrong information for the top stack frame, and possibly for the second top stack frame. Sometimes it will erroneously display "No frames found on the stack," and sometimes it will display: deadbeef ???????? (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ...) The fix for this problem had not been released at the writing of this article. When the fix becomes available, you need to download the APAR IY48543 for 5.2. For AIX 5.3 it all should work OK. -- procmap Displays a process address map. To display the address space of process 13204, enter: # procmap 13204 13204 : /usr/sbin/biod 6 10000000 3K read/exec 20000910 0K read/write d0083100 79K read/exec 20013bf0 41K read/write d007a100 34K read/exec 20011378 4K read/write d0074000 11K read/exec d0077130 8K read/write d00730f8 2K read/exec f03c7508 0K read/write d01d4e20 1997K read/exec f0337e90 570K read/write

biod biod /usr/lib/libiconv.a /usr/lib/libiconv.a /usr/lib/libi18n.a /usr/lib/libi18n.a /usr/lib/nls/loc/en_US /usr/lib/nls/loc/en_US /usr/lib/libcrypt.a /usr/lib/libcrypt.a /usr/lib/libc.a /usr/lib/libc.a

19 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

-- procldd Displays a list of libraries loaded by a process. To display the list of dynamic libraries loaded by process 11928, enter # procldd 11928. T 11928 : -sh /usr/lib/nls/loc/en_US /usr/lib/libcrypt.a /usr/lib/libc.a -- procflags Displays a process tracing flags, and the pending and holding signals. To display the tracing flags of process 28138, enter: # procflags 28138 28138 : /usr/sbin/rsct/bin/IBM.HostRMd data model = _ILP32 flags = PR_FORK /64763: flags = PR_ASLEEP | PR_NOREGS /66315: flags = PR_ASLEEP | PR_NOREGS /60641: flags = PR_ASLEEP | PR_NOREGS /66827: flags = PR_ASLEEP | PR_NOREGS /7515: flags = PR_ASLEEP | PR_NOREGS /70439: flags = PR_ASLEEP | PR_NOREGS /66061: flags = PR_ASLEEP | PR_NOREGS /69149: flags = PR_ASLEEP | PR_NOREGS -- procsig Lists the signal actions for a process. To list all the signal actions defined for process 30552, enter: # procsig 30552 30552 : -ksh HUP caught INT caught QUIT caught ILL caught TRAP caught ABRT caught EMT caught FPE caught KILL default RESTART BUS caught -- proccred Prints a process' credentials. To display the credentials of process 25632, enter: # proccred 25632 25632: e/r/suid=0 e/r/sgid=0

-- procfiles Prints a list of open file descriptors. To display status and control information on the file descriptors opened by process 20138, enter: # procfiles n 20138 20138 : /usr/sbin/rsct/bin/IBM.CSMAgentRMd Current rlimit: 2147483647 file descriptors 0: S_IFCHR mode:00 dev:10,4 ino:4178 uid:0 gid:0 rdev:2,2 O_RDWR name:/dev/null 2: S_IFREG mode:0311 dev:10,6 ino:250 uid:0 gid:0 rdev:0,0 O_RDWR size:0 name:/var/ct/IBM.CSMAgentRM.stderr 4: S_IFREG mode:0200 dev:10,6 ino:255 uid:0 gid:0 rdev:0,0 -- procwdx Prints the current working directory for a process. To display the current working directory of process 11928, enter: # procwdx 11928 11928 : /home/guest -- procstop Stops a process. To stop process 7500 on the PR_REQUESTED event, enter: # procstop 7500 . -- procrun Restart a process. To restart process 30192 that was stopped on the PR_REQUESTED event, enter: # procrun 30192 . -- procwait

20 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

Waits for all of the specified processes to terminate. To wait for process 12942 to exit and display the status, enter # procwait -v 12942 . 12942 : terminated, exit status 0

1.2.14 Other monitoring: ======================== Nagios: open source Monitoring for most unix systems: ----------------------------------------------------Nagios is an open source host, service and network monitoring program. Latest versions: 2.5 (stable) Overview Nagios is a host and service monitor designed to inform you of network problems before your clients, end-users or managers do. It has been designed to run under the Linux operating system, but works fine under most *NIX variants as well. The monitoring daemon runs intermittent checks on hosts and services you specify using external "plugins" which return status information to Nagios. When problems are encountered, the daemon can send notifications out to administrative contacts in a variety of different ways (email, instant message, SMS, etc.). Current status information, historical logs, and reports can all be accessed via a web browser. System Requirements The only requirement of running Nagios is a machine running Linux (or UNIX variant) and a C compiler. You will probably also want to have TCP/IP configured, as most service checks will be performed over the network. You are not required to use the CGIs included with Nagios. However, if you do decide to use them, you will need to have the following software installed... - A web server (preferrably Apache) - Thomas Boutell's gd library version 1.6.3 or higher (required by the statusmap and trends CGIs)

rstat: Monitoring Machine Utilization with rstat: ------------------------------------------------rstat stands for Remote System Statistics service Ports exist for most unixes, like Linux, Solaris, AIX etc.. -- rstat on Linux, Solaris: rstat is an RPC client program to get and print statistics from any machine running the rpc.rstatd daemon, its server-side counterpart. The rpc.rstad daemon has been used for many years by tools such as Sun's perfmeter and the rup command. The rstat program is simply a new client for an old daemon. The fact that the rpc.rstatd daemon is already installed and running on most Solaris and Linux machines is a huge advantage over other tools that require the installation of custom agents. The rstat client compiles and runs on Solaris and Linux as well and can get statistics from any machine running a current rpc.rstatd daemon, such as Solaris, Linux, AIX, and OpenBSD. The rpc.rstatd daemon is started from /etc/inetd.conf on Solaris. It is similar to vmstat, but has some advantages over vmstat: You can get statistics without logging in to the remote machine, including over the Internet. It includes a timestamp. The output can be plotted directly by gnuplot. The fact that it runs remotely means that you can use a single central machine to monitor the performance of many remote machines. It also has a disadvantage in that it does not give the useful scan rate measurement of memory shortage, the sr column in vmstat. rstat will not work across most firewalls because it relies on port 111, the RPC port, which is usually blocked by firewalls. To use rstat, simply give it the name or IP address of the machine you wish to monitor. Remember that rpc.rstatd must be running on that machine. The rup command is extremely useful here because with no arguments, it simply prints out a list of all machines on the local network that are running the rstatd demon. If a machine is not listed, you may have to start rstatd manually. To start rpc.rstatd under Red Hat Linux, run # /etc/rc.d/init.d/rstatd start as root.

On Solaris, first try running the rstat client because inetd is often already configured to automatically start rpc.rstatd on request. If it the client fails with the error "RPC: Program not registered,"

21 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

make sure you have this line in your /etc/inet/inetd.conf and kill -HUP your inetd process to get it to re-read inetd.conf, as follows: rstatd/2-4 tli rpc/datagram_v wait root /usr/lib/netsvc/rstat/rpc.rstatd rpc.rstatd Then you can monitor that machine like this: % rstat enkidu 2001 07 10 10 36 08 0 0 0 100 0 27 54 1 0 0 12 0.1

This command will give you a one-second average and then it will exit. If you want to continuously monitor, give an interval in seconds on the command line. Here's an example of one line of output every two seconds: % rstat 2001 07 2001 07 2001 07 2001 07 2001 07 ^C enkidu 2 10 10 36 10 10 36 10 10 36 10 10 36 10 10 36 28 30 32 34 36 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 98 100 100 100 100 0 0 0 0 0 0 0 0 5 0 7 0 0 10 46 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 61 15 15 19 108 0.0 0.0 0.0 0.0 0.0

To get a usage message, the output format, the version number, and where to go for updates, just type rstat with no parameters: % rstat usage: rstat machine [interval] output: yyyy mm dd hh mm ss usr wio sys idl pgin pgout intr ipkts opkts coll docs and src at http://patrick.net/software/rstat/rstat.html Notice that the column headings line up with the output data. -- AIX: In order to get rstat working on AIX, you may need to configure rstatd. As root 1. Edit /etc/inetd.conf Uncomment or add entry for rstatd Eg rstatd sunrpc_udp udp wait root /usr/sbin/rpc.rstatd rstatd 100001 1-3 2. Edit /etc/services Uncomment or add entry for rstatd Eg rstatd 100001/udp 3. Refresh services refresh -s inetd 4. Start rstatd /usr/sbin/rpc.rstatd

cs load

================================== 2. NFS and Mount command examples: ================================== 2.1 NFS: ======== We will discuss the most important feaures of NFS, by showing how its implemented on Solaris, Redhat and SuSE Linux. Most of this applies to HP-UX and AIX as well. 2.1.1 NFS and Redhat Linux: --------------------------Linux uses a combination of kernel-level support and continuously running daemon processes to provide NFS file sharing, however, NFS support must be enabled in the Linux kernel to function. NFS uses Remote Procedure Calls (RPC) to route requests between clients and servers, meaning that the portmap service must be enabled and active at the proper runlevels for NFS communication to occur. Working with portmap, various other processes ensure that a particular NFS connection is allowed and may proceed without error: rpc.mountd rpc.nfsd The running process that receives the mount request from an NFS client and checks to see if it matches with a currently exported file system. The process that implements the user-level part of the NFS service. It works with the Linux kernel to meet the dynamic demands of NFS clients, such as providing additional server threads for

22 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

rpc.lockd

NFS clients to uses. A daemon that is not necessary with modern kernels. NFS file locking is now done by the kernel. It is included with the nfs-utils package for users of older kernels that do not include this functionality by default. rpc.statd Implements the Network Status Monitor (NSM) RPC protocol. This provides reboot notification when an NFS server is restarted without being gracefully brought down. rpc.rquotad An RPC server that provides user quota information for remote users. Not all of these programs are required for NFS service. The only services that must be enabled are rpc.mountd, rpc.nfsd, and portmap. The other daemons provide additional functionality and should only be used if your server environment requires them. NFS version 2 uses the User Datagram Protocol (UDP) to provide a stateless network connection between the client and server. NFS version 3 can use UDP or TCP running over an IP. The stateless UDP connection minimizes network traffic, as the NFS server sends the client a cookie after the client is authorized to access the shared volume. This cookie is a random value stored on the server's side and is passed with along with RPC requests from the client. The NFS server can be restarted without affecting the clients and the cookie will remain intact. NFS only performs authentication when a client system attempts to mount a remote file system. To limit access, the NFS server first employs TCP wrappers. TCP wrappers reads the /etc/hosts.allow and /etc/hosts.deny files to determine if a particular client should be permitted or prevented access to the NFS server. After the client is allowed past TCP wrappers, the NFS server refers to its configuration file, "/etc/exports", to determine whether the client has enough privileges to mount any of the exported file systems. After granting access, any file and directory operations are sent to the server using remote procedure calls. Warning NFS mount privileges are granted specifically to a client, not a user. If you grant a client machine access to an exported file system, any users of that machine will have access to the data. When configuring the /etc/exports file, be extremely careful about granting read-write permissions (rw) to a remote host. -- NFS and portmap NFS relies upon remote procedure calls (RPC) to function. portmap is required to map RPC requests to the correct services. RPC processes notify portmap when they start, revealing the port number they are monitoring and the RPC program numbers they expect to serve. The client system then contacts portmap on the server with a particular RPC program number. portmap then redirects the client to the proper port number to communicate with its intended service. Because RPC-based services rely on portmap to make all connections with incoming client requests, portmap must be available before any of these services start. If, for some reason, the portmap service unexpectedly quits, restart portmap and any services running when it was started. The portmap service can be used with the host access files (/etc/hosts.allow and /etc/hosts.deny) to control which remote systems are permitted to use RPC-based services on your machine. Access control rules for portmap will affect all RPC-based services. Alternatively, you can specify each of the NFS RPC daemons to be affected by a particular access control rule. The man pages for rpc.mountd and rpc.statd contain information regarding the precise syntax of these rules. -- portmap Status As portmap provides the coordination between RPC services and the port numbers used to communicate with them, it is useful to be able to get a picture of the current RPC services using portmap when troubleshooting. The rpcinfo command shows each RPC-based service with its port number, RPC program number, version, and IP protocol type (TCP or UDP). To make sure the proper NFS RPC-based services are enabled for portmap, rpcinfo -p can be useful: # rpcinfo -p program vers proto 100000 2 tcp 100000 2 udp 100024 1 udp 100024 1 tcp 100011 1 udp 100011 2 udp 100005 1 udp 100005 1 tcp 100005 2 udp 100005 2 tcp 100005 3 udp 100005 3 tcp 100003 2 udp 100003 3 udp 100021 1 udp 100021 3 udp 100021 4 udp port 111 111 1024 1024 819 819 1027 1106 1027 1106 1027 1106 2049 2049 1028 1028 1028 portmapper portmapper status status rquotad rquotad mountd mountd mountd mountd mountd mountd nfs nfs nlockmgr nlockmgr nlockmgr

The -p option probes the portmapper on the specified host or defaults to localhost if no specific host is listed. Other options are available from the rpcinfo man page. From the output above, various NFS services can be seen running. If one of the NFS services does not start up correctly, portmap will be unable to map RPC requests from clients for that service to the correct port.

23 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

In many cases, restarting NFS as root (/sbin/service nfs restart) will cause those service to correctly register with portmap and begin working. # /sbin/service nfs restart -- NFS Server Configuration Files Configuring a system to share files and directories using NFS is straightforward. Every file system being exported to remote users via NFS, as well as the access rights relating to those file systems, is located in the /etc/exports file. This file is read by the exportfs command to give rpc.mountd and rpc.nfsd the information necessary to allow the remote mounting of a file system by an authorized host. The exportfs command allows you to selectively export or unexport directories without restarting the various NFS services. When exportfs is passed the proper options, the file systems to be exported are written to /var/lib/nfs/xtab. Since rpc.mountd refers to the xtab file when deciding access privileges to a file system, changes to the list of exported file systems take effect immediately. Various options are available when using exportfs: -r Causes all directories listed in /etc/exports to be exported by constructing a new export list in /etc/lib/nfs/xtab. This option effectively refreshes the export list with any changes that have been made to /etc/exports. -a Causes all directories to be exported or unexported, depending on the other options passed to exportfs. -o options Allows the user to specify directories to be exported that are not listed in /etc/exports. These additional file system shares must be written in the same way they are specified in /etc/exports. This option is used to test an exported file system before adding it permanently to the list of file systems to be exported.

-i Tells exportfs to ignore /etc/exports; only options given from the command line are used to define exported file systems. -u Unexports directories from being mounted by remote users. The command exportfs -ua effectively suspends NFS file sharing while keeping the various NFS daemons up. To allow NFS sharing to continue, type exportfs -r. -v Verbose operation, where the file systems being exported or unexported are displayed in greater detail when the exportfs command is executed. If no options are passed to the exportfs command, it displays a list of currently exported file systems. Changes to /etc/exports can also be read by reloading the NFS service with the service nfs reload command. This keeps the NFS daemons running while re-exporting the /etc/exports file. -- /etc/exports The /etc/exports file is the standard for controlling which file systems are exported to which hosts, as well as specifying particular options that control everything. Blank lines are ignored, comments can be made using #, and long lines can be wrapped with a backslash (\). Each exported file system should be on its own line. Lists of authorized hosts placed after an exported file system must be separated by space characters. Options for each of the hosts must be placed in parentheses directly after the host identifier, without any spaces separating the host and the first parenthesis. In its simplest form, /etc/exports only needs to know the directory to be exported and the hosts permitted to use it: /some/directory bob.domain.com /another/exported/directory 192.168.0.3 n5111sviob After re-exporting /etc/exports with the "/sbin/service nfs reload" command, the bob.domain.com host will be able to mount /some/directory and 192.168.0.3 can mount /another/exported/directory. Because no options are specified in this example, several default NFS preferences take effect. In order to override these defaults, you must specify an option that takes its place. For example, if you do not specify rw, then that export will only be shared read-only. Each default for every exported file system must be explicitly overridden. Additionally, other options are available where no default value is in place. These include the ability to disable sub-tree checking, allow access from insecure ports, and allow insecure file locks (necessary for certain early NFS client implementations). See the exports man page for details on these lesser used options. When specifying hostnames, you can use the following methods: single host Where one particular host is specified with a fully qualified domain name, hostname, or IP address. wildcards Where a * or ? character is used to take into account a grouping of fully qualified domain names that match a particular string of letters. Wildcards are not to be used with IP addresses; however, they may accidently work if reverse DNS lookups fail.

However, be careful when using wildcards with fully qualified domain names, as they tend to be more exact than you would expect. For example, the use of *.domain.com as wildcard will allow sales.domain.com to access the exported file system, but not bob.sales.domain.com. To match both possibilities, as well as sam.corp.domain.com, you would have to provide *.domain.com *.*.domain.com.

24 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

IP networks Allows the matching of hosts based on their IP addresses within a larger network. For example, 192.168.0.0/28 will allow the first 16 IP addresses, from 192.168.0.0 to 192.168.0.15, to access the exported file system but not 192.168.0.16 and higher. netgroups Permits an NIS netgroup name, written as @, to be used. This effectively puts the NIS server in charge of access control for this exported file system, where users can be added and removed from an NIS group without affecting /etc/exports.

Warning The way in which the /etc/exports file is formatted is very important, particularly concerning the use of space characters. Remember to always separate exported file systems from hosts and hosts from one another with a space character. However, there should be no other space characters in the file unless they are used in comment lines. For example, the following two lines do not mean the same thing: /home bob.domain.com(rw) /home bob.domain.com (rw) The first line allows only users from bob.domain.com read-write access to the /home directory. The second line allows users from bob.domain.com to mount the directory read-only (the default), but the rest of the world can mount it read-write. Be careful where space characters are used in /etc/exports. -- NFS Client Configuration Files - What to do on a client? Any NFS share made available by a server can be mounted using various methods. Of course, the share can be manually mounted, using the mount command, to acquire the exported file system at a particular mount point. However, this requires that the root user type the mount command every time the system restarts. In addition, the root user must remember to unmount the file system when shutting down the machine. Two methods of configuring NFS mounts include modifying the /etc/fstab or using the autofs service. > /etc/fstab Placing a properly formatted line in the /etc/fstab file has the same effect as manually mounting the exported file system. The /etc/fstab file is read by the /etc/rc.d/init.d/netfs script at system startup. The proper file system mounts, including NFS, are put into place. A sample /etc/fstab line to mount an NFS export looks like the following: : nfs 0 0 The relates to the hostname, IP address, or fully qualified domain name of the server exporting the file system. The tells the server what export to mount. The specifies where on the local file system to mount the exported directory. This mount point must exist before /etc/fstab is read or the mount will fail. The nfs option specifies the type of file system being mounted. The area specifies how the file system is to be mounted. For example, if the options area states rw,suid on a particular mount, the exported file system will be mounted read-write and the user and group ID set by the server will be used. Note, parentheses are not to be used here.

2.1.2 NFS and SuSE Linux: -------------------------- Importing File Systems with YaST Any user authorized to do so can mount NFS directories from an NFS server into his own file tree. This can be achieved most easily using the YaST module NFS Client. Just enter the host name of the NFS server, the directory to import, and the mount point at which to mount this directory locally. All this is done after clicking Add in the first dialog. -- Importing File Systems Manually File systems can easily be imported manually from an NFS server. The only prerequisite is a running RPC port mapper, which can be started by entering the command # rcportmap start as root. Once this prerequisite is met, remote file systems exported on the respective machines can be mounted in the file system just like local hard disks using the command mount with the following syntax: # mount host:remote-path local-path If user directories from the machine sun, for example, should be imported, the following command can be used: # mount sun:/home /home -- Exporting File Systems with YaST

25 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

With YaST, turn a host in your network into an NFS server a server that exports directories and files to all hosts granted access to it. This could be done to provide applications to all coworkers of a group without installing them locally on each and every host. To install such a server, start YaST and select Network Services -> NFS Server Next, activate Start NFS Server and click Next. In the upper text field, enter the directories to export. Below, enter the hosts that should have access to them. There are four options that can be set for each host: single host, netgroups, wildcards, and IP networks. A more thorough explanation of these options is provided by man exports. Exit completes the configuration. -- Exporting File Systems Manually If you do not want to use YaST, make sure the following systems run on the NFS server: RPC portmapper (portmap) RPC mount daemon (rpc.mountd) RPC NFS daemon (rpc.nfsd) For these services to be started by the scripts "/etc/init.d/portmap" and "/etc/init.d/nfsserver" when the system is booted, enter the commands # insserv /etc/init.d/nfsserver # insserv /etc/init.d/portmap. and

Also define which file systems should be exported to which host in the configuration file "/etc/exports". For each directory to export, one line is needed to set which machines may access that directory with what permissions. All subdirectories of this directory are automatically exported as well. Authorized machines are usually specified with their full names (including domain name), but it is possible to use wild cards like * or ? (which expand the same way as in the Bash shell). If no machine is specified here, any machine is allowed to import this file system with the given permissions. Set permissions for the file system to export in brackets after the machine name. The most important options are: ro rw root_squash no_root_squash link_relative link_absolute map_identity map_daemon File system is exported with read-only permission (default). File system is exported with read-write permission. This makes sure the user root of the given machine does not have root permissions on this file system. This is achieved by assigning user ID 65534 to users with user ID 0 (root). This user ID should be set to nobody (which is the default). Does not assign user ID 0 to user ID 65534, keeping the root permissions valid. Converts absolute links (those beginning with /) to a sequence of ../. This is only useful if the entire file system of a machine is mounted (default). Symbolic links remain untouched. User IDs are exactly the same on both client and server (default). Client and server do not have matching user IDs. This tells nfsd to create a conversion table for user IDs. The ugidd daemon is required for this to work.

/etc/exports is read by mountd and nfsd. If you change anything in this file, restart mountd and nfsd for your changes to take effect. This can easily be done with "rcnfsserver restart". Example SuSE /etc/exports # # /etc/exports # /home /usr/X11 /usr/lib/texmf / /home/ftp # End of exports

sun(rw) venus(rw) sun(ro) venus(ro) sun(ro) venus(rw) earth(ro,root_squash) (ro)

2.2 Mount command: ================== The standard form of the mount command, is mount -F typefs device mountdir (solaris, HP-UX) mount -t typefs device mountdir (many other unix's) This tells the kernel to attach the file system found on "device" (which is of type type) at the directory "dir". The previous contents (if any) and owner and mode of dir become invisible, and as long as this file system remains mounted, the pathname dir refers to the root of the file system on device. The syntax is: mount [options] [type] [device] [mountpoint]

26 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

-- mounting a remote filesystem: syntax: mount -F nfs -O # mount -F nfs hpsrv:/data /data # mount -F nfs -o hard,intr thor:/data /data /etc/fstab (HP-UX) or /etc/filesystems (AIX) or /etc/vfstab etc.. :

- standard mounts are determined by files like 2.2.1 Where are the standard mounts defined? ============================================ In Solaris: ===========

- standard mounts are determined by /etc/vfstab etc.. - NFS mounts are determined by the file /etc/dfs/dfstab. Here you will find share commands. - currently mounted filesystems are listed in /etc/mnttab In Linux: ========= - standard mounts are determined by most Linux distros by "/etc/fstab". In AIX: ======= - standard mounts and properties are determined by the file "/etc/filesystems". In HP-UX: ========= There is a /etc/fstab which contains all of the filesystems are mounted at boot time. The filesystems that are OS related are / , /var, /opt , /tmp, /usr , /stand The filesystem that is special is /stand, this is where your kernel is built and resides. Notice that the filesystem type is "hfs". HPUX kernels MUST reside on an hfs filesystem

An example of /etc/vfstab: -------------------------starboss:/etc $ more vfstab #device device mount FS #to mount to fsck point type # fd /dev/fd fd no /proc /proc proc no /dev/md/dsk/d1 swap no /dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 /dev/md/dsk/d4 /dev/md/rdsk/d4 /usr ufs 1 /dev/md/dsk/d3 /dev/md/rdsk/d3 /var ufs 1 /dev/md/dsk/d7 /dev/md/rdsk/d7 /export ufs 2 /dev/md/dsk/d5 /dev/md/rdsk/d5 /usr/local ufs /dev/dsk/c2t0d0s0 /dev/rdsk/c2t0d0s0 /export2 swap - /tmp tmpfs - yes size=512m fsck pass mount mount at boot options

no no no yes 2 ufs

logging logging logging logging yes logging 2 yes logging

mount adds an entry, umount deletes an entry. mounting applies to local filesystemes, or remote filesystems via NFS At Remote server: share, shareall, or add entry in /etc/dfs/dfstab # share -F nfs /var/mail Unmount a mounted FS First check who is using it # fuser -c mountpoint # umount mointpoint

2.2.2 Mounting a NFS filesystem in HP-UX: ========================================= Mounting Remote File Systems You can use either SAM or the mount command to mount file systems located on a remote system.

27 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

Before you can mount file systems located on a remote system, NFS software must be installed and configured on both local and remote systems. Refer to Installing and Administering NFS for information. For information on mounting NFS file systems using SAM, see SAM's online help. To mount a remote file system using HP-UX commands, You must know the name of the host machine and the file system's directory on the remote machine. Establish communication over a network between the local system (that is, the "client") and the remote system. (The local system must be able to reach the remote system via whatever hosts database is in use.) (See named(1M) and hosts(4).) If necessary, test the connection with /usr/sbin/ping; see ping(1M). Make sure the file /etc/exports on the remote system lists the file systems that you wish to make available to clients (that is, to "export") and the local systems that you wish to mount the file systems. For example, to allow machines called rolf and egbert to remotely mount the /usr file system, edit the file /etc/exports on the remote machine and include the line: /usr rolf egbert Execute /usr/sbin/exportfs -a on the remote system to export all directories in /etc/exports to clients. For more information, see exportfs(1M). NOTE: If you wish to invoke exportfs -a at boot time, make sure the NFS configuration file /etc/rc.config.d/nfsconf on the remote system contains the following settings: NFS_SERVER=1 and START_MOUNTD=1. The client's /etc/rc.config.d/nfsconf file must contain NFS_CLIENT=1. Then issue the following command to run the script: /sbin/init.d/nfs.server start Mount the file system on the local system, as in: # mount -F nfs remotehost:/remote_dir /local_dir

Just a bunch of mount command examples: --------------------------------------# # # # # # # # # # # mount mount -a mountall -l mount -t type device dir mount -F pcfs /dev/dsk/c0t0d0p0:c /pcfs/c mount /dev/md/dsk/d7 /u01 mount sun:/home /home mount -t nfs 137.82.51.1:/share/sunos/local /usr/local mount /dev/fd0 /mnt/floppy mount -o ro /dev/dsk/c0t6d0s1 /mnt/cdrom mount -V cdrfs -o ro /dev/cd0 /cdrom

2.2.3 Solaris mount command: ============================ The unix mount command is used to mount a filesystem, and it attaches disks, and directories logically rather than physically. It takes a minimum of two arguments: 1) the name of the special device which contains the filesystem 2) the name of an existing directory on which to mount the file system Once the file system is mounted, the directory becomes the mount point. All the file systems will now be usable as if they were subdirectories of the file system they were mounted on. The table of currently mounted file systems can be found by examining the mounted file system information file. This is provided by a file system that is usually mounted on /etc/mnttab. Mounting a file system causes three actions to occur: 1. 2. 3. as The superblock for the mounted file system is read into memory An entry is made in the /etc/mnttab file An entry is made in the inode for the directory on which the file system is mounted which marks the directory a mount point

The /etc/mountall command mounts all filesystems as described in the /etc/vfstab file. Note that /etc/mount and /etc/mountall commands can only be executed by the superuser. OPTIONS -F FSType Used to specify the FSType on which to operate. The FSType must be specified or must be determinable from /etc/vfstab, or by consulting /etc/default/fs or /etc/dfs/fstypes.

28 of 667

28-09-10 01:52 PM

http://www.4bcad.com/doc/notes/sysinfo-unix.txt

-a [ mount_points. . . ] Perform mount or umount operations in parallel, when possible. If mount points are not specified, mount will mount all file systems whose /etc/vfstab "mount at boot" field is "yes". If mount points are specified, then /etc/vfstab "mount at boot" field will be ignored. If mount points are specified, umount will only umount those mount points. If none is specified, then umount will attempt to unmount all file systems in /etc/mnttab, with the exception of certain system required file systems: /, /usr, /var, /var/adm, /var/run, /proc, /dev/fd and /tmp. -f Forcibly unmount a file system. Without this option, umount does not allow a file system to be unmounted if a file on the file system is busy. Using this option can cause data lo


Recommended