Episode 010 – df – Exploring Disk Filesystem Usage

The df command is used to report file system usage. The df command will show you the amount of storage available, used, and free per partition for each fileystem currently mounted on the system. Values are shown in blocks. The default output in 1 Kilobyte blocks and resembles the following:

output of df

The first column reports reports the block device or filesystem. Entries for for block devices are pretty straight forward. /dev/sda# is the first scsi-drive partition #. The filesystem entries may not be so evident.

  • rootfs is a special instance of ramfs (used for page cache and dentry cache).
  • dev – a psuedo file system holding the mount points for all the hardare devices identified by the kernel
  • run – a tmpfs holding application run time information
  • shm – tmpfs partition used for shared memory, passing data between programs.
  • tmpfs – temporary space allocated from ram to be used as temporary storage. Swapable

For more information on those filesystems, consult the links below.

The next three columns report the size of the filesystem, how storage is used, and how much is available in the specified format (1 kilobyte blocks by default). Use% show the percentage of storage used and the final column indicates where the filesystem is mounted.

You can restrict the output of df to a specific filesystem by specifying the path or fileystem device:

df /home


df /dev/sda6

df can also report on filesystems that may not have relevant information to list via the -a or –all switch:

Notice that a few more filesystems show up here than before: proc, sys, devpts, binfmt, none (usbfs), and gvfs-fuse-daemon.

  • proc is a psudeo filesystem that hold process information and the state of the kernel
  • sys is a synthetic filesystem that provides information about “the in-kernel status to userspace devices, busses, and loaded modules.”
  • devpts provides an interface to psuedo terminal (pty) devices. (xterm, konsole, etc.)
  • usbfs is the usb file system
  • gvfs-fuse-daemon: The userspace filesystem used by gnome.

The default block size of 1 Kilobyte can be changed using the -B switch and specifying one of the following:

  • -BK (-k) Kilobyte Blocks
  • -BM (-m) Megabyte Blocks
  • -BG (-g) Gigabyte Blocks
  • -BT Terrabyte Blocks
  • -BP Petabyte blocks
  • -BE Exabyte blocks
  • -BZ Zetabyte blocks
  • -BY Yottabyte blocks

Note that the first three you can specify by just using the switch in parenthesis. If you pass a value beyond the storage capacity of your filesystems you will get some unhelpful results. For instance

df -BE

May show each filesystem with 1 Exabyte block available, 1E used and 1E available. Or:

df -BZ

May report

df: -B argument ‘Z’ too large

The values listed above default to 1024 bytes. There are two options to calculate in powers of 1000 bytes:

  • -BKB 1000*1000 byte blocks
  • -BKM 1000*1000*1000 byte blocks

Some versions of df may support the -h or –human-readable switch. This will display the values of total blocks, Used, and Available using the smalled three digit value and block size possible. That is, instead of 1024 Kilobytes df -h would display 1 Megabyte.

There is also a human readable option for 1000 byte blocks which is specified by the -H or –si switch.

The -T or –print-type switch will display the filesystem type between the filesystem and the total blocks:

df showing file system types

Output of df can be restricted to only displaying certain filesystem types with the -t or –type= switch:

df -t ext4

Or filesystem can be exluded with the -x or –execlude-type= switch:

df -x ext4

The df command has the ability to display inodes instead of blocks using the -i or –inodes switch. An inode (index node) is a “data structure that stores all the information about a file sytem object.” That is for a file, directory, or device an inode is created to hold information about the object like permissions, size, timestamps, etc but not the file name or the data of the object. This switch and be used with the other switches to display value in specific ways like:

df -ih

Will show the inode information of the system in the human readable format.

By default df will show ALL mounted filesystems, even remote filesystems. The -l or –local switch restricts df to only showing local filesystems.

The –no-sync options is the default mode for df which does not perform a sync operation on the filesystems before reporting value. Therefore, if you have a mass storage device or content that has not been written to a disk, the df command man not reflect this information. A sync can be forced by issuing the –sync switch, although be prepared, in some cases it may take a while to sync the filesystems before the values can be reported.

The –total switch provides a total on the last line of each column’s values where relevant.

df showing total in human readable format


If the video is not clear enough view it off the YouTube website and select size 2 or full screen.  Or download the video in Ogg Theora format:

Thank you very much!

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published.