df Command

Purpose

Reports information about space on file systems.

Syntax

df [ [ -P ] | [ -I | -M | -i | -t | -v ] ] [ -c ] [ -T { local | remote | vfstype} ] [ -S { K | M | G | T | P } ] [ -F {output1 output2 output3 …} ] [ -k ] [ -m ] [ -g ] [ -s ] [FileSystem ... | File... ]

Description

The df command displays information about total space and available space on a file system. The FileSystem parameter specifies the name of the device on which the file system resides, the directory on which the file system is mounted, or the relative path name of a file system. The File parameter specifies a file or a directory that is not a mount point. If the File parameter is specified, the df command displays information for the file system on which the file or directory resides. If you do not specify the FileSystem or File parameter, the df command displays information for all currently mounted file systems. File system statistics are displayed in units of 512-byte blocks by default.

The df command gets statistics of file system space from the statfs system call. However, specifying the -s flag gets the statistics from the virtual file system (VFS) specific file system helper. If you do not specify arguments with the -s flag and the helper fails to get the statistics, the statfs system call statistics are used. Under certain exceptional conditions, such as when a file system is being modified while the df command is running, the statistics displayed by the df command might not be accurate.
Note: Some remote file systems, such as the Network File System (NFS), do not provide all the information that the df command needs. The df command prints blanks for statistics that the server does not provide.

The df command does not fully support NFSv4 file systems. Use the nfs4cl command to extract block and space information.

Flags

Table 1. Flags
Item Description
-c Displays the output in colon separated format.
-F { output1 output2 output3 … } Displays only those values that are specified by the headings in the output parameters. By default, the file system and blocks-allocated headings are always turned on.
The following values are acceptable for headings:
%m
Mounted on
%u
Used
%z
Percentage used
%f
Free
%l
Inodes used
%n
Inodes free
%p
Percentage of inodes used
-g Displays statistics in units of GB blocks. The output values for the file system statistics are in floating point numbers as value of each unit in bytes is high.
-i Displays the number of used inodes and the percentage of inodes in use for the file system. This output is the default when the specified file system is mounted.
-I Displays information on the total number of blocks, the used space, the free space, the percentage of used space, and the mount point for the file system.
-k Displays statistics in units of 1024-byte blocks.
-m Displays statistics in units of MB blocks. The output values for the file system statistics are in floating point numbers as value of each unit in bytes is high.
-M Displays the mount point information for the file system in the second column.
-P Displays information on the file system in POSIX portable format.

When the -P flag is specified, the header line appears similar to:

Filesystem 512-blocks Used Available Capacity Mounted on\n

If the -k, -m or -g flag is specified in addition to the -P flag, the column heading 512-blocks is replaced by the respective units, depending on which of these flags is used with the -P flag.

File system statistics are displayed on one line in the following order:

FileSystem, TotalSpace, UsedSpace, FreeSpace, UsedPercentage, MountPoint

-s Displays statistics on unmounted JFS or Enhanced JFS file systems by the command line arguments. If there are no arguments that are specified, the -s flag has no effect. If the file systems that are specified by the argument are mounted or an argument is a file, the -s flag has no effect for that particular argument. To collect statistics on unmounted file systems, an argument must be a mount point of JFS or Enhanced JFS file system or device, the file system must be listed in /etc/filesystems, and the user must have read access to the device.
-S { K | M | G | T | P } Displays statistics in units according to the parameter specified with the -S flag. If character K is specified with the -S flag, the statistics is displayed in units of 1024-byte blocks. If the character M is specified with the -S flag, the statistics is displayed in units of megabytes. If the character G is specified with the -S flag, the statistics is displayed in units of gigabytes. If the character T is specified with the -S flag, the statistics is displayed in units of terabytes. If the character P is specified with the -S flag, the statistics is displayed in units of petabytes.
-t Includes figures for total allocated space in the output.
-T { local | remote | vfstype } Filters the output by the type of file system. This flag can have one of the following parameters:
local
Displays only the Journaled file system (JFS) and Enhanced Journaled file system (JFS2) file systems.
remote
Displays all nonlocal file systems.
vfstype
Displays file systems only of a specific virtual file system (VFS), for example, JFS, JFS2, Network File System version 4 (NFSv4).
-v Displays all information for the specified file system.
The values of the output parameters with the flags -m and -g is rounded off to nearest second decimal digit. If all or any two of the -k, -m and -g flags are specified, the last one specified takes effect.

Exit status

This command returns the following exit values:

Table 2. Exit status
Item Description
0 Successful completion.
>0 An error occurred.

Examples

  1. To display information about all mounted file systems, enter the following command:
    df
    The output looks similar to the following output:
    /dev/sda2                          18385748 8816688   8626164  51% /
    /dev/mapper/PowerVCDataVG-LogLV     6102624  259080   5512588   5% /powervclog
    /dev/mapper/PowerVCDataVG-ExtraLV  20466256      24  19401272   1% /extra
    /dev/mapper/PowerVCDataVG-DumpLV   40973536      36  38859964   1% /dump
    /dev/mapper/PowerVCDataVG-HomeLV   20466256      36  19401260   1% /powervchome
    /dev/mapper/PowerVCDataVG-DataLV   51290592  440812  48211956   1% /powervcdata
    /dev/sda3                           6114912 2865720   2934620  50% /var
    
  2. To display information about the file system in which your current directory resides, enter the following command:
    df .
  3. To display the total number of inode, the number of free inodes and the number of available inodes in all mounted file systems, enter the following command:
    df -i
    The output looks similar to the following output:
    Filesystem                               Inodes  IUsed   IFree IUse% Mounted on
    devtmpfs                                 260502    401  260101    1% /dev
    tmpfs                                    261028     95  260933    1% /dev/shm
    tmpfs                                    261028    801  260227    1% /run
    tmpfs                                    261028     17  261011    1% /sys/fs/cgroup
    /dev/sda2                               1179648 155482 1024166   14% /
    /dev/mapper/PowerVCDataVG-LogLV          393216  54394  338822   14% /powervclog
    /dev/mapper/PowerVCDataVG-ExtraLV       1310720     11 1310709    1% /extra
    /dev/mapper/PowerVCDataVG-DumpLV        2621440     14 2621426    1% /dump
    /dev/mapper/PowerVCDataVG-HomeLV        1310720     14 1310706    1% /powervchome
    /dev/mapper/PowerVCDataVG-DataLV        3276800  48115 3228685    2% /powervcdata
    /dev/sda3                                393216   5011  388205    2% /var
    tmpfs                                    261028      5  261023    1% /run/user/9001
    tmpfs                                    261028      5  261023    1% /run/user/1132
    tmpfs                                    261028      5  261023    1% /run/user/27
    /dev/loop0                               786432      4  786428    1% /srv/node/partition1
  4. To display the total number of blocks, the number of used blocks and the number of free blocks on the /tmp file system, enter the following command:
    df -v /tmp
    The output looks similar to the following output:
    Filesystem     1K-blocks    Used Available Use% Mounted on
    /dev/sda2       18385748 8816688   8626164  51% /
  5. To display the type of file system, enter the following command:
    df -n
  6. To display inode information on all local file systems, enter the following command:
    df -i -l
  7. To display the statvfs structure information on all the file systems, enter the following command:
    df -g
  8. To display the number of free files on file systems, enter the following command:
    df -e

Files

Table 3. Files
Item Description
/etc/filesystems Lists the known file systems and defines their characteristics.
/etc/vfs Contains descriptions of virtual file system types.