Disks and file system

Command df

Show free space on file systems

Linux · Bash examples · commands run on the selected server

When to use df

Use df to inspect capacity and inode availability for mounted filesystems. Check the filesystem containing the actual failing path; available space on another mount does not help that write operation.

Syntax

df [PARAMETERS] [PATH...]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-h
Show sizes in human-readable units.
-T
Show file system type.
-i
Show inode usage instead of block usage.

Usage examples

Check free space

df -h

Mounted filesystem capacity is shown in human-readable units.

Check the project file system

df -hT /srv/app

The filesystem containing the application path is reported with its type.

Check free inodes

df -i /srv/app

Inode usage is checked, which can explain allocation failures despite free bytes.

Notes and limitations

  • df reports filesystem space usage; du accounts for the files it can traverse.
  • Deleted files still held open by processes, and filesystem overhead, can explain differences between df and du.

Common questions and troubleshooting

Why does writing fail even with free disk space?

Inodes, quotas, reserved space, permissions or a read-only mount can block writes. Check the relevant mount and account limits.

Why do df and du disagree?

They measure different things. Deleted files still held open, snapshots, reserved space and mount boundaries can explain differences.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man df.