df Command

Purpose

Reports information about space on file systems. This document describes the AIX® df command as well as the System V version of df.

Syntax

df [ [ -P ] | [  -I | -M | -i | -t | -v ] ] [ -c ] [ -T { local | remote | vfstype} ] [ start of change-Send of change { 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 file system space statistics 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 filesystems. Use the nfs4cl command to extract block and space information.

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 would be in floating point numbers as value of each unit in bytes is significantly 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 would be in floating point numbers as value of each unit in bytes is significantly 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 specified, the -s flag has no effect. If the file systems specified by the argument are currently 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 JFS or Enhanced JFS file system mount point or device, the file system must be listed in /etc/filesystems, and the user must have read access to the device.
start of change-S { K | M | G | T | P }end of change 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 non-local file systems.
vfstype
Displays file systems only of a specific virtual file system (VFS), for example, JFS, JFS2, Network File System version 4 (NFSv4), and so on.
-v Displays all information for the specified file system.
The values of the output parameters with the flags -m and -g would be 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:

Item Description
0 Successful completion.
>0 An error occurred.

Examples

  1. To display information about all mounted file systems, enter:
    df
    If your system has the /, /usr, /site, and /usr/venus file systems mounted, the output from the df command resembles the following:
    
    Filesystem 512-blocks Free   %Used   Iused  %Iused  Mounted on
    /dev/hd0    19368     9976    48%     4714    5%     /
    /dev/hd1    24212     4808    80%     5031   19%     /usr
    /dev/hd2     9744     9352     4%     1900    4%     /site
    /dev/hd3     3868     3856     0%      986    0%     /usr/venus 
  2. To display information about /test file system in 1024-byte blocks, enter:
    df -k /test
    Filesystem    1024 blocks    Free    %Used   Iused  %Iused  Mounted on 
    /dev/lv11         16384     15824       4%      18      1%  /tmp/ravi1
    This displays the file system statistics in 1024-byte disk blocks.
  3. To display information about /test file system in MB blocks, enter:
    df -m /test
    Filesystem    MB blocks    Free    %Used    Iused  %Iused  Mounted on 
    /dev/lv11       16.00     15.46       4%       18      1%  /tmp/ravi1
    This displays file system statistics in MB disk blocks rounded off to nearest 2nd decimal digit.
  4. To display information about the /test file system in GB blocks, enter:
    df -g /test
    Filesystem    GB blocks   Free     %Used    Iused  %Iused  Mounted on 
    /dev/lv11          0.02   0.02        0%       18      1%  /tmp/ravi1
    This displays file system statistics in GB disk blocks rounded off to nearest 2nd decimal digit.
  5. To display available space on the file system in which your current directory resides, enter:
    cd/
    df .
    The output from this command resembles the following:
    Device   512-blocks  free   %used   iused   %iused  Mounted on
    /dev/hd4    19368    9976    48%     4714    5%     / 
  6. To display the output in a colon separated format, enter:
    df -c
    The output resembles the following example:
    Filesystem:512-blocks:Free:%Used:Iused:%Iused:Mounted on
    /dev/hd4:491520:113168:77%:9930:42%:/
    /dev/hd2:5046272:27696:100%:43014:86%:/usr
  7. To display information about all the file systems that are mounted locally, enter:
    df -T local
    The output resembles the following example:
    Filesystem    512-blocks      Free  %Used    Iused %Iused Mounted on
    /dev/hd4          5898240   2104184   65%    16390     7%  /
    /dev/hd2          7602176   1698696   78%    56001    23%  /usr
    /dev/hd9var       3014656   2190976   28%    10987     5%  /var
    /dev/hd3          2883584   2137928   26%     1213     1%  /tmp
    /dev/hd1          655360    645240    2%     1727     3%   /home
    /dev/hd11admin    262144    261384    1%        5     1%   /admin
    /proc                  -         -    -         -     -    /proc
    /dev/hd10opt      786432    362672   54%     8926    18%   /opt
    /dev/livedump     524288    523552    1%        4     1%   /var/adm/ras/livedump
    /aha                   -         -    -       328     2%   /aha
  8. To display information about all the JFS2 file systems, enter:
    df -T jfs2
    The output resembles the following example:
    Filesystem     512-blocks      Free %Used    Iused %Iused Mounted on
    /dev/hd4          5898240   2104184   65%    16390     7%  /
    /dev/hd2          7602176   1698696   78%    56001    23%  /usr
    /dev/hd9var       3014656   2190976   28%    10987     5%  /var
    /dev/hd3          2883584   2137928   26%     1213     1%  /tmp
    /dev/hd1          655360    645240    2%     1727     3%   /home
    /dev/hd11admin    262144    261384    1%        5     1%   /admin
    /dev/hd10opt      786432    362672   54%     8926    18%   /opt
    /dev/livedump     524288    523552    1%        4     1%   /var/adm/ras/livedump
  9. To display the free, used, and mounted on information about all the JFS2 file systems, enter:
    df -T jfs2 -F %f %u %m
    The output resembles the following example:
    Filesystem    512-blocks      Free %Used    Mounted on
    /dev/hd4         5898240   2104184   65%    /
    /dev/hd2         7602176   1698696   78%    /usr
    /dev/hd9var      3014656   2190976   28%    /var
    /dev/hd3         2883584   2137928   26%    /tmp
    /dev/hd1          655360    645240    2%    /home
    /dev/hd11admin     262144    261384        /admin
    /dev/hd10opt      786432    362672         /opt
    /dev/livedump     524288    523552        /var/adm/ras/livedump

Files

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

System V df Command

Purpose

Reports number of free disk blocks and files.

Syntax

/usr/sysv/bin/df [ -a ] [ -l ] [ [ [ -e ] [-g ] [ -n ] ] | [ [ -i ] [ -v ] ] | -t ] ] [FileSystem ...] [File ...]

Description

The df command displays information about total space and available space on a file system. File system statistics are displayed in units of 512-byte blocks

Flags

Item Description
-a Performs the default operation and prints the mount point, the device name, number of free blocks and number of used inodes (files).
-e Print only the number of free files.
-g Print the entire statvfs structure. This option overrides the -a , -e, -i, -n, -t and -v options. The numbers for available, total, and free blocks are reported in 512 byte blocks.
-i Displays the total number of inodes, the number of free inodes, the number of used inodes, and the percentage of inodes in use.
-l Reports on local file systems only.
-n Prints the type of filesystem.
-t Causes total allocated block figures to be reported.
-v Reports percent of blocks used as well as the number of blocks used and free.

Parameters

Item Description
File 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.
FileSystem 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.
Note: If the FileSystem or File parameter is not specified, the df command displays information for all currently mounted file systems.

Exit Status

0
The command completed successfully
>0
An error occurred.

Examples

  1. To display information about all mounted file systems, enter:
    /usr/sysv/bin/df
    The output looks similar to the following:
    /              (/dev/hd4       ):     19656 blocks    1504 files
    /usr           (/dev/hd2       ):   1139904 blocks   20254 files
    /var           (/dev/hd9var    ):     23096 blocks     512 files
    /tmp           (/dev/hd3       ):      2464 blocks     204 files
    /home          (/dev/hd1       ):     44208 blocks     146 files
    /proc          (/proc          ):         0 blocks       0 files
    /opt           (/dev/hd10opt   ):     13880 blocks     310 files
  2. To display information about the file system in which your current directory resides, enter:
    /usr/sysv/bin/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:
    /usr/sysv/bin/df -i
    The output looks similar to the following:
    Mount Dir  Filesystem      iused    avail    itotal  %iused
    /          /dev/hd4         1504     6688      8192     19%
    /usr       /dev/hd2        20254   127202    147456     14%
    /var       /dev/hd9var       512     3584      4096     13%
    /tmp       /dev/hd3          204     5940      6144      4%
    /home      /dev/hd1          146    14190     14336      2%
    /proc      /proc               0        0         0       0
    /opt       /dev/hd10opt      310     5834      6144      6%
  4. To display the total number of blocks , the number of used blocks and the number of free blocks on a the /tmp file system, enter:
    /usr/sysv/bin/df -v /tmp
  5. To display the type of filesystem, enter:
    /usr/sysv/bin/df -n
  6. To display inode information on all local filesystems, enter:
    /usr/sysv/bin/df -i -l
  7. To display the statvfs structure information on all the filesystems, enter:
    /usr/sysv/bin/df -g
  8. To display the number of free files on filesystems, enter:
    /usr/sysv/bin/df -e

Files

Item Description
/usr/sysv/bin/df Contains the System V df command.
/etc/filesystems Contains filesystem information.