18.9 Managing a File System

   

Data are read and written to a file system using block device files. These device files employ a data buffer in memory. Data are actually written to a disk when the buffer is full and the system needs the buffer for writing more data or for some other purpose. The buffer is also flushed when the file system is unmounted or the machine is shut down. You can force the data buffer to be written to the disk with the use of the sync command. A daemon called syncer executes the sync command on a regular basis. This daemon is started at boot time. The sync command is used to update file systems at any time and make them current.

One of the file system management tasks is to monitor the disk space used by the file system so that you may change file system size before it is 100% utilized. You may also need to use commands to extend or shrink a file system from time to time.

Monitoring Disk Usage

Disk space utilization can be viewed with the help of the bdf command, which lists all mounted file systems and shows the following information about each file system.

  • file system name

  • total capacity in kilobytes

  • used capacity in kilobytes

  • available capacity in kilobytes

  • percentage of utilization

  • mount point

Output of this command is shown here.

 $  bdf  Filesystem          kbytes    used   avail %used Mounted on /dev/vg00/lvol3     204800   21074  172272   11% / /dev/vg00/lvol1      99669   29579   60123   33% /stand /dev/vg00/lvol8    1024000  190842  782071   20% /var /dev/vg00/lvol7    1024000  340190  641121   35% /usr /dev/vg00/lvol6     512000    9707  472770    2% /tmp /dev/vg00/lvol5    1024000  307544  672235   31% /opt /dev/vg00/lvol4     409600   83081  306150   21% /home 

Extending Volume Groups

Changing the size of a file system involves three steps. If there is no unallocated space left on a volume group, you first need to extend the volume group. The volume group can be extended by adding a new disk to it. You use the pvcreate command to create a physical volume on the disk. After that you use the vgextend command to add the new disk to the volume group. For example, to add a disk c0t3d0 to volume group vg03 , you will use following two commands.

 pvcreate /dev/rdsk/c0t3d0 vgextend vg03 /dev/dsk/c0t3d0 

After using these two commands, you can use the vgdisplay -v vg03 command to verify that the volume group is indeed extended.

Extending Logical Volumes

After extending the volume group, you have extra space for extending a logical volume using the lvextend command. If logical volume /dev/vg03/lvol4 had 400 Mbytes of space and you want it to be extended to 800 Mbytes, you can use the following command.

 lvextend -L 800 /dev/vg03/lvol4 

If you want the extra space to be allocated from a particular disk, you can also provide a disk device file as an argument to the lvextend command as shown here.

 lvextend -L 800 /dev/vg03/lvol4 /dev/dsk/c0t3d0 

After extending a logical volume, you may use the lvdisplay command to verify its new size.

Extending File Systems

Extending the size of a logical volume does not automatically extend the size of a file system. You need to use the extendfs command to add new space to a file system. To extend a file system, you must first unmount it. For example, if you want to extend a JFS file system on /dev/vg03/lvol4 , use the following command.

 extendfs -F vxfs /dev/vg03/lvol4 

To extend an HFS file system, replace vxfs with hfs in the above command. After execution of this command, all space on this logical volume will be allocated to the file system. Now you need to mount the extended file system and use the bdf command to verify that the extra space has been allocated to the file system.

 $  bdf  Filesystem          kbytes    used   avail %used Mounted on /dev/vg00/lvol3     204800   21074  172272   11% / /dev/vg00/lvol1      99669   29579   60123   33% /stand /dev/vg00/lvol8    1024000  190842  782071   20% /var /dev/vg00/lvol7    1024000  340190  641121   35% /usr /dev/vg00/lvol6     512000    9707  472770    2% /tmp /dev/vg00/lvol5    1024000  307544  672235   31% /opt /dev/vg00/lvol4     409600   83081  306150   21% /home /dev/vg03/lvol4     819200    9200  810000   99% /extra 

If you are using HP OnlineJFS, you don't need to unmount the file system to extend it. Instead, you can use the fsadm command to extend a JFS file system. This command takes the new file system size in number of blocks. By default, each JFS block is of 1 KByte. The following command will extend the size of the file system to 800 Mbytes, where 819200 represents 800 MBytes converted to kilobytes.

 fsadm -F vxfs -b 819200 /extra 

Using SAM for LVM Administration

SAM can be used to manage LVM. Go to the Disk and File Systems SAM area, and you will see a window like Figure 18-1.

Figure 18-1. SAM Disk and File Systems area.

graphics/18fig01.gif

You can use icons displayed here to carry out a required task. To view a list of disk devices and the volume group to which these are related , use the Disk Devices icon. A list of disk devices will be listed as shown in Figure 18-2.

Figure 18-2. The Disk Devices area in SAM.

graphics/18fig02.gif

The third column shows whether a disk is used in a volume group. You can add a disk to a particular volume group using the Actions menu.

The volume groups can be listed using the Volume Groups icon as shown in Figure 18-3.

Figure 18-3. List of Volume Groups .

graphics/18fig03.gif

Figure 18-3 lists the names of the volume groups and the total capacity and number of physical and logical volumes in each group. You can go to the Actions menu and select the View more information... option to display more information about a particular volume group. Figures 18-4 and 18-5 show more information about volume group vg00 .

Figure 18-4. General information about a volume group.

graphics/18fig04.gif

Figure 18-5. Disk Information in a logical volume.

graphics/18fig05.gif

Figure 18-4 shows the maximum capacity that the volume group can handle and its current capacity; how much space is utilized and how much is free; the maximum number of logical volumes that can be created in this volume group; and the current number of logical volumes.

Figure 18-5 lists disk information of the disk drives that are part of this volume group. Currently, there are two disks, and you can see the hardware path and the capacity of each. In the bottom part of the figure, you see a list of logical volumes, the space used by each one, and the file system type on each one.

When you click on the Logical Volumes icon in Figure 18-1, a window like the one shown in Figure 18-6 will appear.

Figure 18-6. Logical Volumes window in SAM.

graphics/18fig06.gif

Here, all logical volumes are listed. Using the Actions menu, you can perform operations on one of these logical volumes and add new ones to the volume group.

Figure 18-7 is the File Systems window where all file systems and their mount points are listed. Here, you can perform actions on these file systems as shown in the Actions menu in the figure.

Figure 18-7. File Systems window in SAM.

graphics/18fig07.gif


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

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