Skip to content

Linux Root Filesystem Full: How to Recover a Linux Server

Linux root filesystem full is a common server issue that can prevent applications from writing files, cause services to fail, and make system administration difficult. When the root filesystem reaches 100% usage, even routine operations may stop working correctly.

This guide explains how to identify what is consuming disk space, safely recover storage, and prevent the problem from happening again.

1. Check Root Filesystem Usage

Run the following command to check available disk space:

df -h /

If the Use% column shows 100%, the root filesystem has no reported free space.

Also check inode usage:

df -i /

A filesystem can run out of inodes even when some disk space remains, especially when a large number of small files have accumulated.

2. Find Directories Using the Most Disk Space

Run:

du -xhd1 / 2>/dev/null | sort -h

This command lists the sizes of directories directly under the root directory without crossing filesystem boundaries.

If /var is unusually large, inspect it:

du -xhd1 /var 2>/dev/null | sort -h

Repeat this process for the directories consuming the most space.

3. Find Large Files

To locate files larger than 500 MB on the root filesystem, run:

find / -xdev -type f -size +500M -print 2>/dev/null

Review the results carefully. Large logs, old archives, application data, and local backups may be responsible for the storage shortage.

Do not delete a file until you understand its purpose.

4. Clean Up Large Log Files

Check for large log files:

find /var/log -type f -size +100M \
  -exec ls -lh {} \; 2>/dev/null

Check systemd journal usage:

journalctl --disk-usage

If archived journal files are consuming too much space, you can apply a retention limit:

journalctl --vacuum-time=7d

Investigate the source of excessive logging and configure appropriate retention to prevent the problem from recurring.

5. Clear Package Manager Caches

On Ubuntu or Debian:

apt-get clean

On systems using DNF:

dnf clean all

These commands clear package-manager caches and may free some space. The amount recovered depends on how much cached data exists.

6. Check Deleted Files Still Held Open

Sometimes disk space remains occupied after a file has been deleted because a running process still holds it open.

If lsof is installed, run:

lsof +L1

Identify any large deleted files and their associated processes. Restarting the relevant service may release the space, but assess the impact before doing so.

7. Review Temporary Files and Backups

Check temporary directory usage:

du -sh /tmp /var/tmp 2>/dev/null

If your server stores backups locally, inspect their actual location for old or oversized files. Verify that backups are no longer needed and that a usable recovery copy exists before removing anything.

8. Verify Recovery

After cleaning up the identified files or caches, run:

df -h /
df -i /
systemctl --failed

Confirm that disk space and inodes are available and investigate any services that remain in a failed state.

9. Prevent Future Disk Space Problems

  • Monitor disk and inode usage regularly.
  • Configure log rotation and journal retention.
  • Review backup storage and retention policies.
  • Investigate applications generating excessive files or logs.
  • Consider expanding the disk if normal workload requirements exceed available capacity.

When the Linux root filesystem is full, identify the source of the storage problem before deleting data. Check disk and inode usage, inspect large directories, review logs and caches, and verify the recovery afterward.

For growing workloads, review your storage requirements and available ServerNext VPS hosting options.