Linux Disk Full at 100%? How to Fix It Without a Reboot

  • Linux
  • Troubleshooting
  • Intermediate
  • 8 min read

A Linux disk full at 100% stops an application fast: logs cannot be written, uploads fail and databases refuse new data. The quick reaction is to reboot the server, but a reboot does not remove the files that filled the disk, and it wipes out the clues you need. This guide shows how to find what is using the space, free it safely and bring the app back while the server keeps running.

Last updated: December 2026

In short

  • Run df -h and df -i first: the disk can run out of space or out of inodes (file slots).
  • Use du to find the big folder, and lsof +L1 to find deleted files that a process still holds open.
  • Empty only a log file you have confirmed, rotate logs properly, trim old system journals, then check that the app works again.
Linux disk full troubleshooting flow: check df, then follow the space full or inodes full path, then verify
The whole flow on one page. Tap the picture to see it full size.

Why Not Just Reboot?

A reboot feels safe because it sometimes “works”. It does free the space held by deleted files that a process still had open. But the log that filled the disk will fill it again, the big folder is still there, and you have lost the running process that would have shown you the cause. On a busy server a restart also means downtime for every service, not only the broken one.

How to Fix a Linux Disk Full Error in 6 Steps

The commands work on any modern Linux (Ubuntu, Debian, RHEL, Rocky, Amazon Linux). Some need sudo to see every file. We tested each one on Ubuntu 24.04.

01 Check Disk Space and Inodes

  • Read only

First find out which file system is full, and what kind of full it is.

Linux
df -h
Linux
df -i

df -h shows space in readable sizes. Look at the Use% column and the Mounted on column: /, /var and /home are the usual suspects. df -i shows inodes, the slots that every file and folder needs. If IUse% is 100%, the disk is full of tiny files even when space is free (see the inode section below).

Good to know: ext4 keeps 5% of the blocks for root by default. Normal users can see Avail 0 and get “No space left on device” while root processes can still write a little.

02 Find the Folders That Use the Most Space

  • Read only

Say df showed that /var is full. List its sub-folders by size, biggest last:

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

-x stays on one file system, -h prints sizes like 4.2G, -d1 goes one level deep, and sort -h sorts those sizes correctly. Then repeat on the biggest result, for example /var/log, until you reach the files. To list single large files directly:

Linux
sudo find /var -xdev -type f -size +500M -exec ls -lh {} +

03 Find Deleted Files That Are Still Open

  • Read only
  • Needs sudo

This is the trap behind many “I deleted the log but nothing changed” stories. On Linux, deleting a file only removes its name. If a program still has the file open, the data stays on disk until the program closes it. du cannot see that data any more, but df still counts it.

Linux
sudo lsof +L1

+L1 lists open files with a link count below 1, which means files that were deleted. Look for big numbers in SIZE/OFF and the word (deleted) at the end. Write down the PID and the FD number (in 4w, the FD is 4 and w means open for writing).

Example output
COMMAND  PID USER FD TYPE DEVICE SIZE/OFF    NLINK NODE NAME
java    2481 app  4w REG  253,1  37580963840     0 1311 /var/log/app/app.log (deleted)

04 Free the Space Safely

  • Changes data
  • Needs sudo

Pick the case that matches what you found. Only touch a file once you know what it is and that its content can go.

A huge log file that still exists: empty it in place. The program keeps writing to the same file, and the space comes back at once. Do not rm it, or you create the deleted-but-open problem from step 3.

Linux
sudo truncate -s 0 /var/log/app/app.log

A deleted file that is still open: the name is gone, so empty it through the process instead. Use the PID and FD from lsof:

Linux
sudo truncate -s 0 /proc/2481/fd/4

The other clean option is to restart only that one service (for example sudo systemctl restart app), which closes the file. That is still far smaller than a full reboot.

Logs that keep growing: rotate them with the app’s logrotate rule. -f forces a rotation now:

Linux
sudo logrotate -f /etc/logrotate.d/app

Rotation only frees space if the app lets go of the old file. The rule needs either copytruncate (copy, then empty the original in place; a few lines written in between can be lost) or a postrotate command that tells the app to reopen its log.

05 Trim Old System Journals

  • systemd systems

On systemd servers, the system journal in /var/log/journal can grow to several gigabytes. See how much it uses:

Linux
journalctl --disk-usage

Then remove journal files older than seven days. Adding --rotate first closes the current files, because vacuuming only removes archived ones:

Linux
sudo journalctl --rotate --vacuum-time=7d

Check your company’s log retention rules before you shorten the history. To stop it growing back, set SystemMaxUse= in /etc/systemd/journald.conf. Without it, the journal may use up to 10% of the file system, capped at 4 GB.

06 Verify Space and App Health

  • Read only

Confirm the space is really back, then confirm the app works. A service that crashed while the disk was full may need a restart of its own.

Linux
df -h
Linux
systemctl status app
Linux
curl -f http://localhost:8080/health

Replace app and the URL with your own service name and health check address. curl -f fails if the app answers with an error code.

When df -i Shows 100%: The Inodes Are Full

Every file uses one inode, however small it is. Millions of tiny files (old PHP sessions, cache entries, a stuck mail queue) can use up all inodes while the disk is almost empty. The error is the same “No space left on device”, which confuses many people. In our test, a disk with 0% of its space used refused a new file because df -i showed 100%.

Find the folder with the most files:

Linux
sudo du --inodes -xd1 /var 2>/dev/null | sort -n

Go deeper into the biggest folder, check what the files are and which app creates them, and remove only old ones you are sure about. Then fix the cause, for example a session cleanup job that stopped running.

Do not delete these to make room

Files under /var/lib belong to databases, Docker, package managers and other services. Deleting them can break those services or lose data. The same goes for anything you have not identified. Clean logs, caches and temporary files first, and ask the owner of the data when in doubt.

A Real Example We Reproduced

We rebuilt a common production story on a small 64 MB test disk. A program kept writing to app.log until the disk hit 100%. Deleting the log changed nothing: df still showed 100%. lsof +L1 listed app.log (deleted) at 44 MB, still open by the program. Emptying it through /proc/<PID>/fd/3 brought the disk down to 32% in a second, with the program still running and no reboot.

How to Stop the Disk Filling Up Again

  1. Rotate every app log. Give each app a logrotate rule with a size or time limit, compression and copytruncate or a postrotate reload.

  2. Cap the journal. Set SystemMaxUse= in journald.conf.

  3. Alert early. Warn at about 80% space and 80% inodes, so you fix it during the day instead of at night.

  4. Separate busy folders. A separate file system for /var/log or the app’s data keeps a log flood from stopping the whole server.

Key takeaways

  • Do not reboot first. Find the cause while the server is still running.
  • Always check both df -h (space) and df -i (inodes).
  • Deleting an open log frees nothing. Use lsof +L1, then empty it through /proc or restart that one service.
  • Empty or rotate only files you have confirmed, and never clean /var/lib blindly.

Linux Disk Full FAQ

Why does df show the disk full when du shows much less?

Usually because of deleted files that are still open: df counts them and du cannot see them. Run sudo lsof +L1 to find them.

Why do I get “No space left on device” when df -h shows free space?

The file system has run out of inodes. Check with df -i and remove the many small files that use them.

Is truncate safer than rm for log files?

For a log a program is writing to, yes. truncate -s 0 empties the file and frees the space at once, and the program carries on writing. rm hides the file but the space stays used until the program closes it.

Will a reboot fix a full disk?

Only the part held by deleted-but-open files. Everything else is still on disk after the reboot, and the server can fill up again within hours.

Read more in the official manual pages for lsof, du, logrotate and journalctl.

Diagram redrawn by infotechtu.com, based on a “Beyond Basic DevOps” troubleshooting infographic.

Related guides on infotechtu.com

Share this guide

Save

Get new guides by email

One short email when a new guide is out. Unsubscribe at any time.

Leave a Comment

Your email address will not be published. Required fields are marked *


Scroll to Top