Ask Steves · Daily notes · VPS, 20% off · AI Profit Lab · SEO · Money Hub

14 September 2026 · One command a day

How do I check disk space on a Linux server?

The df command reports how much space is used and free on every mounted filesystem. The -h flag turns raw block counts into gigabytes and megabytes you can read at a glance. You reach for it when a deploy fails, a database stops writing, or you simply want to know how close the disk is to full before it becomes a problem.

The command

df -h

df stands for disk free. On its own it prints sizes in 1K blocks, which are hard to read. The -h flag means human readable, so sizes appear with G, M or K suffixes. No sudo is needed, because reading filesystem usage is not a privileged action. If you only care about one location, add a path, for example df -h / for the root filesystem or df -h /var/www for wherever your sites live.

What you will see

Filesystem      Size  Used Avail Use% Mounted on
tmpfs           3.2G  1.1M  3.2G   1% /run
/dev/sda1       393G  212G  165G  57% /
tmpfs            16G     0   16G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda15      105M  6.1M   99M   6% /boot/efi
tmpfs           3.2G  4.0K  3.2G   1% /run/user/1000

Each line is one filesystem. Size is the total capacity, Used is what is taken, Avail is what is left for you, and Use% is the percentage consumed. Mounted on tells you which directory that filesystem serves. The line to watch is the one mounted on /, because on a typical VPS it holds everything: sites, apps, logs, databases and Docker images. The tmpfs lines live in memory and can be ignored. Used and Avail may not add up to Size, because the filesystem keeps back around five percent for root.

When to use it

Watch out for

df tells you the disk is full but not why. It reports space, not files, so it will not point you at the rotated logs or dangling Docker images that caused the problem. There is also a trap when you start deleting. If you remove a large file that a running process still has open, df will not show the space coming back until that process is restarted, because the kernel keeps the file alive. Restart the app or service, then run df -h again.

Questions people ask

Why does df say the disk is full when du says it is not?

Usually a process is holding a deleted file open. Run sudo lsof +L1 to list those files, then restart the process concerned.

What is a safe level of disk usage on a VPS?

Aim to keep Use% under 80% on the root filesystem. Above that, log writes, package updates and certificate renewals can start to fail with little warning.

Checking a disk this directly is only possible on a server you control, where the whole filesystem is yours to inspect. You can get the same VPS with 20% off at https://asksteves.co.uk/vps. Affiliate link.

Everything on this blog runs on one Hostinger KVM 8. This link takes 20% off the same box.

GET A VPS, 20% OFF →

Affiliate link.

More daily notes: How do I make PM2 apps start again after a reboot? · How do I restart one app with PM2 after a deploy? · How do I read the last 100 lines of a PM2 app's logs?