Using Standard Commands and Tools

I l @ ve RuBoard

Many UNIX commands exist to check configuration, status, and resource information. These tools generally report on only a snapshot in time. You can periodically track configuration changes or test the status of disk devices or resources by writing and using custom scripts that include these (and other) commands.

bdf and df

The bdf and df commands can be used not only to see the mounted filesystem configuration, but also to report filesystem usage and capacity information. You can use this command to do the following:

  • Monitor filesystem space, to avoid filesystem capacity limits

  • Check that the necessary filesystems are mounted

  • View the relationship between the filesystem mount points and associated logical volumes

Listing 5-1 shows the output of bdf.

diskinfo

The diskinfo command can be used to get device information for CS/80, Subset/80, and Hewlett-Packard Small Computer Standard Interface (SCSI) disk devices. Using this command, an operator can check disk access. In this way, the disk is pinged to see whether it is okay. You can use diskinfo to get device status and configuration information. Listing 5-2 shows some sample output.

fsck

The fsck command performs filesystem consistency checks and interactive repair. If it finds inconsistencies, it provides a mechanism to repair the inconsistencies in the filesystem. You should run this tool if you suspect a corrupt filesystem, or just run it periodically for preventative maintenance.

Using fsck with the “m option checks whether the filesystems have any errors that need to be corrected. If they do not, it reports that the filesystems are already mounted, as shown in Listing 5-3.

Using fsck with the “n option generates a more detailed report. Blocks, pathnames, and reference counts are checked. Listing 5-4 shows a portion of an fsck report containing information on multiple filesystems. Note that it shows an error with /dev/vg00/rlvol5.

Listing 5-1 Output from the bdf command for monitoring filesystem space.
 Filesystem        kbytes    used   avail %used Mounted on /dev/vg00/lvol3   102400   18723   78457   19% / /dev/vg00/lvol1    47829    6438   36608   15% /stand /dev/vg00/lvol8   155648   51011   98168   34% /var /dev/vg00/lvol7   307200  228550   73747   76% /usr /dev/vg00/lvol6    49152    1214   45007    3% /tmp /dev/vg00/lvol5   102400   84310   16981   83% /opt /dev/vg00/lvol4   921600  446758  445205   50% /home 
Listing 5-2 Output from the diskinfo command.
 # diskinfo /dev/rdsk/c0t5d0 SCSI describe of /dev/rdsk/c0t5d0:              vendor: SEAGATE          product id: ST34572WC                type: direct access                size: 4194157 Kbytes    bytes per sector: 512 
Listing 5-3 Output from fsck showing that the filesystems are mounted.
 # fsck -m fsck: sanity check, /dev/vg00/lvol3 is already mounted fsck: sanity check, /dev/vg00/lvol1 is already mounted fsck: sanity check, /dev/vg00/lvol4 is already mounted fsck: sanity check, /dev/vg00/lvol5 is already mounted fsck: sanity check, /dev/vg00/lvol6 is already mounted fsck: sanity check, /dev/vg00/lvol7 is already mounted fsck: sanity check, /dev/vg00/lvol8 is already mounted # 
Listing 5-4 Output from fsck showing a filesystem problem.
 ** /dev/vg00/rlvol4 (NO WRITE) ** Last Mounted on /home ** groups 1479 files, 0 icont, 68427 used, 31242 free (338 frags, 3863 blocks) ** /dev/vg00/rlvol5 (NO WRITE) ** Last Mounted on /opt ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity UNREF DIR  I=28054  OWNER=root MODE=40777 SIZE=0 MTIME=Dec  2 14:03 1998 ** Phase 4 - Check Reference Counts UNREF DIR I=28054  OWNER=root MODE=40777 SIZE=0 MTIME=Dec  2 14:03 1998 CLEAR?  no ** Phase 5 - Check Cyl groups 9033 files, 0 icont, 439919 used, 58726 free (1830 frags, 7112 blocks) ** /dev/vg00/rlvol6 (NO Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl WRITE) ** Last Mounted on /tmp ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 269 files, 0 icont, 23451 used, 7146 free (98 frags, 881 blocks) 

After getting a report indicating a problem, you may want to run fsck interactively to fix the problem. This is shown in Listing 5-5.

Listing 5-5 Output from fsck showing a filesystem repair.
 # fsck fsck: /dev/vg00/lvol3: root file system continue (y/n)? n fsck: /dev/vg00/rlvol1: mounted file system continue (y/n)? n fsck: /dev/vg00/rlvol4: mounted file system continue (y/n)? n fsck: /dev/vg00/rlvol5: mounted file system continue (y/n)? y ** /dev/vg00/rlvol5 ** Last Mounted on /opt ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity UNREF DIR  I=28054  OWNER=root MODE=40777 SIZE=0 MTIME=Dec  2 14:03 1998 ** Phase 4 - Check Reference Counts UNREF DIR I=28054  OWNER=root MODE=40777 SIZE=0 MTIME=Dec  2 14:03 1998 CLEAR? y FREE INODE COUNT WRONG IN SUPERBLK FIX? y ** Phase 5 - Check Cyl groups SUMMARY INFORMATION (INODE FREE) BAD BAD CYLINDER GROUPS FIX? y ** Phase 6 - Salvage Cylinder Groups 9032 files, 0 icont, 439919 used, 58726 free (1830 frags, 7112 blocks) ***** MARKING FILE SYSTEM CLEAN ***** ***** FILE SYSTEM WAS MODIFIED ***** fsck: /dev/vg00/rlvol6: mounted file system continue (y/n)? n fsck: /dev/vg00/rlvol7: mounted file system continue (y/n)? n fsck: /dev/vg00/rlvol8: mounted file system continue (y/n)? n # 

ioscan

The ioscan command is useful for viewing the hardware configuration of a system. For disk resources, this includes the interface cards as well as the I/O devices. The command displays the hardware path to the hardware module, the class of the hardware module, and a brief description. This is good for tracking the system's disk configuration.

Listing 5-6 shows the output from the ioscan command; the “f option generates a full listing.

lvdisplay

The lvdisplay command can be used to get information for disk resource management. It displays Logical Volume Manager (LVM) logical volume configuration information and the logical volume status. Information about mirrored copies is included if you are using MirrorDisk/UX. Listing 5-7 shows the logical volume status and mirrored copies, among other information, in the output from lvdisplay.

Listing 5-6 Output from the ioscan command showing information about hardware devices configured on a system.
 # ioscan -f Class       I  H/W Path  Driver  S/W State  H/W Type   Description ========================================================================== bc          0            root    CLAIMED    BUS_NEXUS bc          1  8         ccio    CLAIMED    BUS_NEXUS  I/O Adapter bc          2  8/0       bc      CLAIMED    BUS_NEXUS  Bus Converter tty         0  8/0/0     mux2    CLAIMED    INTERFACE  MUX ext_bus     0  8/4       c720    CLAIMED    INTERFACE  GSC add-on F/W SCSI target      0  8/4.5     tgt     CLAIMED    DEVICE disk        0  8/4.5.0   sdisk   CLAIMED    DEVICE     SEAGATE ST34572WC target      1  8/4.6     tgt     CLAIMED    DEVICE ctl         4  8/4.6.0   sctl    CLAIMED    DEVICE     Initiator target      2  8/4.12    tgt     CLAIMED    DEVICE disk        2  8/4.12.0  sdisk   CLAIMED    DEVICE     SEAGATE ST32272WC target      3  8/4.13    tgt     CLAIMED    DEVICE disk        3  8/4.13.0  sdisk   CLAIMED    DEVICE     SEAGATE ST32272WC target      4  8/4.14    tgt     CLAIMED    DEVICE disk        4  8/4.14.0  sdisk   CLAIMED    DEVICE     SEAGATE ST32272WC target      5  8/4.15    tgt     CLAIMED    DEVICE disk        5  8/4.15.0  sdisk   CLAIMED    DEVICE     SEAGATE ST32272WC 
Listing 5-7 Output from the lvdisplay command showing logical volume information
 # lvdisplay /dev/vg00/lvol1 - Logical volumes - LV Name                     /dev/vg00/lvol1 VG Name                     /dev/vg00 LV Permission               read/write LV Status                   available/syncd Mirror copies               0 Consistency Recovery        MWC Schedule                    parallel LV Size (Mbytes)            48 Current LE                  12 Allocated PE                12 Stripes                     0 Stripe Size (Kbytes)        0 Bad block                   off Allocation contiguous       strict/contiguous/ 

Information about the individual fields being displayed can be found in the online man page for the command.

pvdisplay

The pvdisplay command provides status and configuration information for disk resource management, specifically for physical volumes within LVM volume groups. For each physical volume, you can display the logical volumes that have extents allocated on the physical volume, and the usage of all the physical extents. Listing 5-8 shows the output from pvdisplay.

Listing 5-8 Output from the pvdisplay command showing information about physical volumes within LVM volume groups.
 # pvdisplay  /dev/dsk/c0t5d0 - Physical volumes - PV Name                     /dev/dsk/c0t5d0 VG Name                     /dev/vg00 PV Status                   available Allocatable                 yes VGDA                        2 Cur LV                      8 PE Size (Mbytes)            4 Total PE                    1023 Free PE                     607 Allocated PE                416 Stale PE                    0 IO Timeout (Seconds)        default 

vgdisplay

The vgdisplay command is used to get information about LVM volume groups configured on the system. This command can be used to get disk resource status and configuration information. You can get configuration information about each logical volume, physical volume, and physical volume group for each volume group that is active on the system. You can get the status of volume groups, logical volumes, and physical volumes as shown in Listing 5-9. Some of the information available from lvdisplay and pvdisplay is also provided by this command. For example, using the verbose option, you not only get the volume group status, but also the status of all the logical volumes within the volume group .

Listing 5-9 Output from the vgdisplay command showing information about a volume group.
 # vgdisplay -v /dev/vg00 - Volume groups - VG Name                     /dev/vg00 VG Write Access             read/write VG Status                   available Max LV                      255 Cur LV                      8 Open LV                     8 Max PV                      16 Cur PV                      1 Act PV                      1 Max PE per PV               2000 VGDA                        2 PE Size (Mbytes)            4 Total PE                    1023 Alloc PE                    416 Free PE                     607 Total PVG                   0    - Logical volumes -    LV Name                     /dev/vg00/lvol1    LV Status                   available/syncd    LV Size (Mbytes)            48    Current LE                  12    Allocated PE                12 

You can use lvdisplay or pvdisplay to obtain more detailed information about logical or physical volumes, respectively.

I l @ ve RuBoard


UNIX Fault Management. A Guide for System Administrators
UNIX Fault Management: A Guide for System Administrators
ISBN: 013026525X
EAN: 2147483647
Year: 1999
Pages: 90

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net