df (disk free)
df (disk free) is the standard command that shows the size, used space, available space and mount point of each mounted file system. df -h prints sizes in human-readable units; df -i shows inode usage instead of bytes, which explains 'No space left on device' errors when bytes are still free.
1Reading the columns
Filesystem is the device, Size the total, Used and Avail the space used and free for normal users, Use% the percentage, and Mounted on the directory where it appears.
On ext4, about 5% is reserved for root by default, so Used + Avail can be smaller than Size and normal users can run out before Use% shows 100%.
2Useful options
-T adds the file system type, -x tmpfs hides temporary memory file systems, and df -h /var shows only the file system that holds /var.
How to check free space
- Run:
df -hT -x tmpfs - Find the file system with high Use%.
- Check inodes too:
df -i - Then look inside with du or ncdu to find what uses the space.
Cautions
- Never fill the root file system to 100%: services, logins and package updates can fail.
Related articles
- Disk usage with du and ncduHow to find what fills a Linux disk with du and the interactive ncdu, with options that stay on one file system.
- Inodes and 'No space left on device'What an inode is, how to see inode usage with df -i, and how to find directories with millions of small files.
- Finding large and old files with findHow to use find to list big or old files on Linux, preview them safely and delete only what you checked.
Sources
Note: RainServer offers monitoring and safe cleanup for Linux servers; it shows what will change and asks first.
Last reviewed: