"No space left on device" — one of the last errors a server administrator wants to see. When the disk fills up, the site crashes, the database cannot write, logs cannot be kept and most services stop. This guide explains step by step how to diagnose and fix the disk full error.

Related reading: Reading Linux server logs · Essential Linux server commands · Server monitoring basics

Detecting Disk Fill

The first step is to see which disk partition is full. The df -h command shows the fill level of all partitions:

# Fill level of all disk partitions
df -h

# Look for the partition at 100% or critical level (the Use% column)

After identifying the full partition, you need to find what is taking up space within it.

Finding Large Files and Directories

The du command shows the space directories occupy. Starting from the root of the problematic partition, you narrow down the largest directories in turn:

# Sort folder sizes in a directory largest to smallest
du -h --max-depth=1 / | sort -hr | head -20

# Find files above a certain size (e.g. 100 MB)
find / -type f -size +100M -exec ls -lh {} \;

What Can You Free Disk Space With?

The most common culprits that fill a disk are known. Check them in order:

  • Old logs: Bloated log files under /var/log/. journalctl --vacuum-size=200M shrinks the journal.
  • Package cache: apt clean / dnf clean all clears the downloaded package cache.
  • Old packages: apt autoremove removes dependencies no longer needed.
  • Temporary files: /tmp and application cache directories.
  • Old backups: Backup files accumulating on the server that should be moved elsewhere.
Warning
When cleaning the disk, never delete files at random. If you are not sure what a file does, do not delete it — deleting system files can make the server unusable. Start with files you know are large and definitely unneeded.

The Hidden Problem: inode Exhaustion

Sometimes df -h shows there is space on the disk but you still get a "disk full" error. The cause is usually inode exhaustion. Every file uses one inode; a large number of small files (for example cache files) can run out of inodes before the disk fills. The df -i command shows inode usage.

Preventing Recurrence

Fixing the disk full error once is not enough — you need to prevent it from recurring. Set up disk-fill monitoring and alerts: be informed when the disk reaches 85%, not when it reaches 100% and a service crashes. Also make sure log rotation works properly.

Frequently Asked Questions

The disk is full but deleting files does not free space?

Even if a file is deleted, if a process still holds it open the space is not freed. Find these processes with lsof | grep deleted; restarting the relevant service releases the space.

What disk usage is critical?

85% fill is a warning threshold; above 90% is a serious risk. Do not wait for the disk to fill completely — some services stop working properly even before 100%.

Should I grow the disk or clean it?

First clean up unneeded files. If the disk fills up regularly and quickly, it is a capacity problem; you need to permanently grow the disk space.

Sufficient, Monitored Disk Space

Avoid space problems with NVMe SSD storage and disk monitoring on KEYDAL hosting solutions. Explore KEYDAL hosting

WhatsApp