Tools reference

df -- report disk space usage

When attempting to achieve optimal performance for the I/O subsystem, it is important to make sure that the disks have enough free space to do their job efficiently. The df(C) command, and its close relative dfspace(C), enable you to see how much free space there is. The following example shows the output from df and dfspace on the same system:

   $ df
   /         (/dev/root        ):    37872 blocks    46812 i-nodes
   /u        (/dev/u           ):   270814 blocks    36874 i-nodes
   /public   (/dev/public      ):   191388 blocks    55006 i-nodes
   /london   (wansvr:/london   ):   149750 blocks        0 i-nodes
   $ dfspace
   /         :     Disk space:  18.49 MB of 292.96 MB available ( 6.31%).
   /u        :     Disk space: 132.23 MB of 629.98 MB available (20.99%).
   /public   :     Disk space:  93.45 MB of 305.77 MB available (30.56%).
   /london   :     Disk space:  73.12 MB of 202.56 MB available (36.10%).

Total Disk Space: 317.29 MB of 1431.29 MB available (22.17%). $ df -v Mount Dir Filesystem blocks used free %used / /dev/root 600000 562128 37872 93% /u /dev/u 1290218 1019404 270814 79% /public /dev/public 626218 434830 191388 69% /london wansvr:/london 414858 265108 149750 63%

The -i option to df also provides additional information about the number of free and used inodes.

dfspace is a shell script interface to df. Without options, it presents the filesystem data in a more readable format than df. When used with its options, df provides more comprehensive information than dfspace.

In the above example, there are three local filesystems:

and one remote filesystem: All of these local filesystems have adequate numbers of blocks and inodes remaining for use. You should aim to keep at least 15% of free space on each filesystem. This helps to prevent fragmentation which slows down disk I/O. In the above example there are no problems with the filesystems /dev/u and /dev/public which are less than 85% used. The root filesystem (/dev/root), however, is 93% full. This filesystem is relatively static apart from the temporary file storage directories /tmp and /usr/tmp. In the configuration shown, there is very little free space in these directories. Possible solutions are to create divisions to hold these directories on other disks, or increase the size of the root filesystem.

du(C) is another command that can be used to investigate disk usage. It differs from df and dfspace because it reports the number of 512-byte blocks that files and directories contain rather than the contents of an entire filesystem. If no path is specified, du reports recursively on files and directories in and below the current directory. Its use is usually confined to sizing file and directory contents.

Next topic: ps -- check process activity
Previous topic: Tools reference

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003