Some Additional File-System-Related Commands

   

HP-UX Virtual Partitions
By Marty Poniatowski

Table of Contents
Chapter 9.  File Systems


Viewing File Systems with bdf

You can manually view the file systems you have mounted with the bdf command. bdf provides the following output:

File system

Block device file system name. In the following example, several logical volumes are shown.

KBytes

Number of KBytes of total disk space on the file system.

used

The number of used KBytes on the file system.

avail

The number of available KBytes on the file system.

%used

The percentage of total available disk space that is used on the file system.

Mounted on

The directory name on which the file system is mounted.

iused

Number of inodes in use (only if you use the -i option with bdf).

ifree

Number of free inodes (only if you use the -i option with bdf).

%iuse

Percentage of inodes in use (only if you use the -i option with bdf).

Here is an example of bdf that is also in "Logical Volume Manager Background," covered earlier in this chapter:

$ /usr/bin/bdf

File system

kbytes

used

avail

%used

Mounted on

/dev/vg00/lvol3

47829

18428

24618

43%

/

/dev/vg00/lvol1

67733

24736

36223

41%

/stand

/dev/vg00/lvol8

34541

8673

22413

28%

/var

/dev/vg00/lvol7

299157

149449

119792

56%

/usr

/dev/vg00/lvol4

23013

48

20663

0%

/tmp

/dev/vg00/lvol6

99669

32514

57188

36%

/opt

/dev/vg00/lvol5

19861

9

17865

0%

/home

/dev/dsk/c0t6d0

802212

552120

169870

76%

/mnt/9.x

File System Maintenance with fsck

fsck is a program used for file system maintenance on HP-UX systems. fsck checks file system consistency and can make many "life-saving" repairs to a corrupt file system. fsck can be run with several options, including the following:

-F

This option allows you to specify the file system type. Be sure to specify a file system type. On some UNIX variants /etc/fstab will be used to determine the file system type on others it will not be used. See the fstab description later in this section.

-m

This is a sanity check of the file system. If you run this, you'll be told whether your file system is okay or not. I did the following to check lvol5, which is mounted as /home:

-y

fsck will ask questions if run in interactive mode, which is the default. Using the -y option causes a "yes" response to all questions asked by fsck. Don't use this! If you have a serious problem with your file system, data will probably have to be removed, and the -y indicates that the response to every question, including removing data, will be "yes".

-n

The response to all questions asked by fsck will be "no." Don't use this, either. If your file system is in bad shape, you may have to respond "yes" to some questions in order to repair the file system. All "no" responses will not do the job.

Since your system runs fsck on any file systems that were not marked as clean at the time you shut down the system, you can rest assured that when your system boots, any disks that were not properly shut down will be checked. It is a good idea to run fsck interactively on a periodic basis just so you can see firsthand that all of your file systems are in good working order.

Should fsck find a problem with a directory or file, it would place these in the lost+found directory, which is at the top level of each file system. If a file or directory appears in lost+found, you may be able to identify the file or directory by examining it and move it back to its original location. You can use the file, what, and strings commands on a file to obtain more information about it to help identify its origin.

How are file system problems created? The most common cause of a file system problem is improper shutdown of the system. The information written to file systems is first written to a buffer cache in memory. It is later written to the disk with the sync command by unmounting the disk, or through the normal use of filling the buffer and writing it to the disk. If you walk up to a system and shut off the power, you will surely end up with a file system problem. Data in the buffer that was not synchronized to the disk will be lost, the file system will not be marked as properly shut down, and fsck will be run when the system boots. A sudden loss of power can also cause an improper system shutdown.

Proper shutdown of the system is described with the shutdown command. Although fsck is a useful utility that has been known to work miracles on occasion, you don't want to take any unnecessary risks with your file systems. So be sure to properly shut down your system.

The /etc/fstab file mentioned earlier is used by fsck to determine the sequence of the file system check if it is required at the time of boot. The sequence of entries in /etc/fstab is important if a "pass number" for any of the entries does not exist. Here is an example of the /etc/fstab file:

 # System /etc/fstab file. Static information about the file  # systems. See fstab(4) and sam(1m) for further details.  /dev/vg00/lvol3    /            vxfs   delaylog   0    1  /dev/vg00/lvol1    /stand       hfs    defaults   0    1  /dev/vg00/lvol4    /tmp         vxfs   delaylog   0    2  /dev/vg00/lvol6    /opt         vxfs   delaylog   0    2  /dev/vg00/lvol5    /home        vxfs   delaylog   0    2  /dev/vg00/lvol7    /usr         vxfs   delaylog   0    2  /dev/vg00/lvol8    /var         vxfs   delaylog   0    2  /dev/dsk/c0tt6d0   /tmp/mnt9.x  hfs    rw, suid   0    2        |             |               |         |       |    |        v             v              v         v       v    v 

device special file

directory

type

options

backup frequency

pass #

device special file

This is the device block file, such as /dev/ vg00/lvol1 in the example.

directory

The name of the directory under which the device special file is mounted.

type

Can be one of several types including:

cdfs (local CD-ROM file system)

hfs (high performance local file system)

nfs (network file system)

vxfs (journaled file system)

swap or

swapfs

options

Several options are available, including those shown in the example. rw is read and write; ro is read only.

backup frequency

To be used by backup utilities in the future.

pass #

Used by fsck to determine the order in which file system checks (fsck) will take place.

comment

Anything you want, as long as it's preceded by a #.

Initializing with mediainit

A command you probably won't use, but should be aware of, is mediainit. When you use SAM to set up disks for you, the mediainit command may be run to initialize new media.

Here are some of the options of mediainit:

-v

This is the verbose option. mediainit normally just prints error messages to the screen. You can get continuous feedback on what mediainit is doing with the -v option.

-i interleave

This allows you to specify the interleave factor, which is the relationship between sequential logical and physical records. mediainit will provide this if one is not specified.

-f format

The format option allows you to specify format options for devices, such as floppy disks, that support different format options. This is not required for hard disks.

pathname

This is the character device file to be used for mediainit.

newfs,which was used in some of the earlier examples, is used to create a new file system. newfs calls the mksf command earlier covered. newfs builds a file system of the type you specify (this is one of the commands that uses the -F option, so you can specify the file system type).


       
    Top
     



    HP-UX Virtual Partitions
    HP-UX Virtual Partitions
    ISBN: 0130352128
    EAN: 2147483647
    Year: 2002
    Pages: 181

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