Previous | Table of Contents | Next |
DESCRIPTION
The external df command displays the disk free space. It is used to find out how much disk space is available in each mounted file system. The df command is used to:
|
---|
BSD (Berkeley) |
The BSD version of df supports the same features as System V except for block counts. |
|
COMMAND FORMAT
Following is the general format of the df command.
df [ -F FStype ] [ -begklntV ] [ SVoptions ] [ -o FSoptions ] filesystem df [ -F FStype ] [ -begklntV ] [ SVoptions ] [ -o FSoptions ] mount_point df [ -F FStype ] [ -begklntV ] [ SVoptions ] [ -o FSoptions ] resource
|
|
---|---|
BSD (Berkeley) | |
df [ -ai ] [ -t type ] [ filesystem ] | |
df [ -ai ] [ -t type ] [ file ] | |
|
Options
The following options may be used to control how df functions.
-F FStype | Specifies the type of file system. Only used for unmounted file systems. The FStype should be specified with the -F option or be found in the /etc/vfstab by matching mount_point, special, or resource. Supported types are s5, ufs, nfs, efs, ffs, and rfs. Not all of these types may be supported on all systems. |
-b | Display only the number of free kilobytes. |
-e | Display only the number of free files. |
-g | Display the entire statvfs structure. Used only for mounted file systems. Cannot use with -beknt options, -o or the SV options. |
-k | Display allocation information in kilobytes. Should be used by itself since it uses a different format. |
-l | Display information for local file systems only. Used only for mounted file systems. Cannot use with -o or SVoptions. |
-n | Display on the FStype name. If no arguments, a list of all mounted file system types is displayed. Used only for mounted file systems. Cannot use with -o or SVoptions. |
-t | Displays a total listing. Displays the total number of blocks and inodes and the free or available blocks and inodes. Overrides the -ben options. |
-V | Verify the command line. The command line is echoed back to the screen after df has added information from the /etc/mnttab and /etc/vfstab. |
-o FSoptions | Used to specify FStype specific options. The FSoptions are a comma-separated list of file system specific options. See your system's User's Reference Manual df command man pages. |
-i | Displays the number of free and used inodes. |
SVoptions | These are System V specific options. Refer to your systems df (s5) man page. |
|
|
---|---|
BSD (Berkeley) | |
-i | Displays the number of free and used inodes. |
-t type | Displays only filesystems of a given type. The types are nfs and 4.2. Type nfs is for a Network File System and 4.2 is for a local BSD File System. |
|
Arguments
The following list describes the arguments that may be passed to the df command.
filesystem | The filesystem device name. The name of the device where the filesystem resides physically. Such as /dev/da0a or /dev/dsk/c0d0s0. |
mount_point | The name of the directory where the filesystem is mounted. Referred to as the filesystem mount point. |
resource | An NFS or RFS resource name. |
If no arguments are given then all filesystems currently mounted are reported. |
|
|
BSD (Berkeley) | |
---|---|
file | The name of a file within a filesystem. The disk space for the filesystem containing file is displayed. May be a directory, such as the filesystem mount_point. |
|
FURTHER DISCUSSION
A file system is a set of files and directories stored on one physical part of a disk. A device name (/dev/dsk/0s0) or a logical directory name may be used by df to access a file system. For a file system to be checked via its logical name it must be mounted. Mounting a file system makes it available for use. The system becomes aware of the physical media and relates a logical name to it.
In general, the rule of thumb for available space on a file system is 10 percent of the maximum size. If you have a file system that is more than 90 percent full, you should remove all files no longer needed. The system administrator is responsible for keeping file systems within the set guidelines.
|
BSD (Berkeley) |
---|
The BSD system reserves a portion of each file system for allocation routines to work properly. The reserved part is usually 10 percent but may be adjusted by using the super-user command tunefs. |
Once a file system reaches 100 percent full, only the super-user can allocate more space. |
|
Alleviating Full Disks
To alleviate the problem, the administrator may use the find and cpio commands to move an entire directory structure to a new file system. Another alternative is to have users mv files to a directory in their home directory named ARC. Then run a job that saves all user files stored in ARC directories to tape. Of course, a satisfactory solution is to just have the users remove all unnecessary files.
RELATED COMMANDS
Refer to the du command described in Module 37.
RELATED FILES
The following files are read and used by the df command.
/etc/checklist | A list of all normally mounted filesystems (SV only) |
/dev/dsk/* | The disk partitions where filesystems reside (SV only) |
/dev/d* | The disk partitions where filesystems reside (BSD only) |
/etc/mnttab | A list of all currently mounted filesystems (SV only) |
/etc/mtab | A list of all currently mounted filesystems (BSD only) |
/etc/fstab | A list of all normally mounted filesystems (BSD only) |
/etc/vfstab | A list of default parameters for each file system (SV only) |
APPLICATIONS
You can use the df command to check available disk space. The numbers returned by the System V df command are blocks, not bytes. Therefore, don't forget to multiply by 512, 1024, or 2048, depending on your system's block size.
If you're low on free space, you may want to remove all unnecessary files and send a mail note to the system administrator stating your observance. The amount of available space kept for a buffer is dependent upon each site's requirements. Some system administrators require 10000 blocks while others set a minimum of 500. The size is heavily dependent on the type of work being done on each filesystem and the size of the filesystem.
TYPICAL OPERATION
In this activity you use the df command to list the available disk space on you system. Begin at the shell prompt.
System V Only
cj> df -t / (/dev/dsk/c1d0s0): 1743 blocks 1398 inodes total: 18144 blocks 2256 inodes /usr (/dev/dsk/c1d0s2): 11364 blocks 8752 inodes total: 121176 blocks 15136 inodes /u1 (/dev/dsk/c1d0s5): 33023 blocks 2103 inodes total: 181934 blocks 18321 inodes
BSD (Berkeley) Only
cj> df Filesystem kbytes used avail capacity Mounted on /dev/da0a 20143 17608 520 97% / /dev/da0e 122559 76660 33643 69% /usr /dev/da1g 183887 105277 60221 64% /u1
Previous | Table of Contents | Next |