Skip to content
statance
MenuClose
← All troubleshooting guides

df says the disk is full, du disagrees

Linux

When df reports much more used space than du can find, the difference is usually files that were deleted while a process still had them open. The space is only released when the process closes the file. Find them with sudo lsof +L1 and restart the process, or truncate the file through /proc.

Symptoms

  • df -h shows a full disk
  • du -sh on the mount point reports far less
  • Space was not freed after deleting a large log file

How to diagnose it

  1. List deleted files still open

    The SIZE/OFF column shows how much space each still holds.

    sudo lsof +L1 sudo lsof -nP | grep "(deleted)"
  2. Check for files hidden under a mount point

    Files written to a directory before a filesystem was mounted over it are invisible to du. Bind-mount the root to look underneath.

    sudo mkdir /mnt/root && sudo mount --bind / /mnt/root sudo du -sh /mnt/root/var/* sudo umount /mnt/root
  3. Account for reserved blocks

    ext4 reserves 5% for root by default, so non-root users see the disk as full earlier.

    sudo tune2fs -l /dev/sda1 | grep -i "reserved block"

Common causes and fixes

Log deleted while the service still writes to it

Restart or reload the service so it reopens its log file.

sudo systemctl restart SERVICE

Process cannot be restarted right now

Truncate the deleted file through its file descriptor. Use the PID and FD number from lsof.

sudo truncate -s 0 /proc/PID/fd/FD

Data hidden under a mount point

Clean it via the bind mount shown above.

Prevent it happening again

  • Use logrotate with postrotate reload or copytruncate rather than deleting active logs.
  • Alert when DISK_used is above 85% so you have time to investigate.

Set it up: Linux monitoring.

FAQ

Why is disk space not freed after deleting a file in Linux?

A process still has it open. Linux removes the data only when the last open handle closes.

What does lsof +L1 do?

It lists open files with a link count below 1 — files that have been deleted but are still open.

Related guides

Get alerted before this becomes an outage.

Install the agent in one line. Statance watches CPU, memory, disk and services, and its AI assistant helps find the cause.