Why Ubuntu Says Your Disk Is Full When You Can't See What's Using the Space
You run df -h and see your root partition at 98% or 100% used. Apps won't open, the system throws errors, and you can't save files. But when you browse your home folder or run a quick du scan, nothing obvious jumps out. This is one of the most frustrating Ubuntu desktop problems — and it affects thousands of users every year, including those on Ubuntu 22.04 LTS and 24.04 LTS.
The good news: the disk space is being consumed somewhere specific. This guide walks you through exactly how to find it, reclaim it, and prevent it from happening again — using nothing but a terminal and a few smart Linux commands.
Step 1: Confirm the Problem with df -h
Start by getting a clear picture of your disk usage across all mounted filesystems:
df -h
Look for any filesystem showing Use% at 90% or higher, especially your root partition (/) or home partition (/home). Note the Filesystem column — this tells you which physical or logical device is involved.
If you see something like /dev/sda1 at 100%, that's your target. Now the detective work begins.
Step 2: Find the Real Culprits with du -sh
The du command measures actual file sizes. Run it progressively — start at the root and drill down:
sudo du -sh /* 2>/dev/null | sort -rh | head -20
This lists the top 20 largest directories under root, sorted by size. Common culprits include:
/var— logs, package caches, snap data/usr— installed software and old kernels/home— user files, browser caches, hidden directories/snap— snap package revisions/tmp— temporary files that didn't get cleaned
Once you identify the largest directory, drill in deeper:
sudo du -sh /var/* 2>/dev/null | sort -rh | head -20
Keep narrowing down until you find the specific folder consuming the space.
Step 3: The Silent Killer — Snap Package Revisions
On Ubuntu, Snap is the default delivery mechanism for many apps. By default, Snap keeps 3 revisions of every installed snap. If you have 10 snaps installed and each revision is 200 MB, that's 4 GB silently consumed by old snap versions you'll never use.
Check snap disk usage:
sudo du -sh /var/lib/snapd/snaps/*
List installed snaps and their revisions:
snap list --all
You'll see entries marked disabled — those are old revisions. Remove them manually:
snap list --all | awk '/disabled/{print $1, $3}' | while read snapname revision; do
sudo snap remove "$snapname" --revision="$revision"
done
Then lock down future accumulation by setting snap to retain only 2 revisions:
sudo snap set system refresh.retain=2
This single change can reclaim 2–8 GB on a typical Ubuntu desktop and should be done on every Ubuntu machine you set up.
Step 4: Clear the APT Package Cache
Every time you install or update software via apt, Ubuntu downloads and caches the package files in /var/cache/apt/archives/. Over months of updates, this folder can grow to several gigabytes.
Check the size first:
sudo du -sh /var/cache/apt/archives/
Then clean it safely:
# Remove only packages no longer needed
sudo apt autoremove --purge
# Clear the full download cache
sudo apt clean
# Remove partial downloads
sudo apt autoclean
These commands are completely safe — they only remove cached installer files, not installed software. Running them monthly is good Ubuntu hygiene.
Step 5: Tame systemd Journal Logs
Ubuntu uses systemd-journald to collect system logs. If a service is crashing repeatedly or logging errors constantly, the journal can balloon rapidly — sometimes to 5 GB or more on a busy desktop system.
Check current journal size:
journalctl --disk-usage
Vacuum old logs (keep only last 7 days):
sudo journalctl --vacuum-time=7d
Or cap by size (keep only 500 MB):
sudo journalctl --vacuum-size=500M
To make the size limit permanent, edit /etc/systemd/journald.conf and set:
SystemMaxUse=500M
Then restart the journal service:
sudo systemctl restart systemd-journald
Step 6: Remove Old Linux Kernels
Ubuntu keeps old kernel versions after updates as a safety fallback. Each kernel version takes 200–400 MB. After a year of updates, you may have 5–10 old kernels sitting unused.
See which kernels are installed:
dpkg --list | grep linux-image
Check which kernel you're currently running:
uname -r
The safest way to remove old kernels is to let apt handle it automatically:
sudo apt autoremove --purge
This removes kernels that are no longer the current or previous version. Do not manually delete kernel packages unless you are certain — removing the wrong kernel can prevent booting.
Step 7: The df vs du Mystery — Deleted Files Still Held Open
Sometimes df shows 100% used but du adds up to far less. This is not a bug — it's a Linux filesystem behaviour. When a process opens a file and then the file is deleted, Linux removes the directory entry but keeps the data blocks allocated until the process closes the file handle. df sees the allocated blocks; du only sees files with directory entries.
Find these "ghost" open-but-deleted files:
sudo lsof +L1
The output shows files with a link count of zero — deleted from the filesystem but still held open. The SIZE column shows how much space each is consuming. To reclaim that space without rebooting, restart the process that holds the file open:
# Example: if a log file held by a service is the culprit
sudo systemctl restart <service-name>
If the process can't be safely restarted, a reboot will close all file handles and immediately free the space.
Step 8: Clean Browser Caches and Thumbnails
Hidden folders in your home directory quietly accumulate gigabytes over time. Check these key locations:
# Check hidden cache folders
du -sh ~/.cache/
du -sh ~/.thumbnails/ 2>/dev/null || du -sh ~/.cache/thumbnails/
du -sh ~/.local/share/Trash/
Clear them:
# Clear thumbnail cache
rm -rf ~/.cache/thumbnails/*
# Empty trash
gio trash --empty
# Clear browser cache (example: Firefox)
rm -rf ~/.cache/mozilla/firefox/
Also check for large files in home subdirectories that you may have forgotten about:
find ~ -type f -size +500M 2>/dev/null
Step 9: Check for Runaway Logs in /var/log
Individual application logs in /var/log can sometimes grow without bound — especially from services like MySQL, Apache, or custom apps:
sudo du -sh /var/log/* 2>/dev/null | sort -rh | head -10
If a specific log is enormous, check if it's actively growing:
sudo tail -f /var/log/syslog
For logs that grow fast, configure logrotate to compress and rotate them automatically. Most Ubuntu services already use logrotate, but custom apps may not be configured properly.
Step 10: Use ncdu for a Visual Map of Disk Usage
If you're still unsure where the space is going, ncdu (NCurses Disk Usage) provides an interactive, navigable map of your entire filesystem:
# Install ncdu
sudo apt install ncdu
# Scan root filesystem
sudo ncdu /
Use arrow keys to navigate, Enter to go deeper into a directory, and d to delete files directly from the interface. It's the fastest way to visually pinpoint exactly which folder or file is the space hog.
Preventive Measures: Keep Ubuntu Disk Space Under Control
Once you've freed up space, set up habits and configs to prevent the problem from returning:
- Monthly apt clean:
sudo apt autoremove --purge && sudo apt clean - Cap journal logs: Set
SystemMaxUse=500Min/etc/systemd/journald.conf - Limit snap revisions:
sudo snap set system refresh.retain=2 - Monitor disk space: Add a disk usage widget to your GNOME panel or use
df -hweekly - Use BleachBit: A GUI tool that safely clears caches, logs, and temporary files on a schedule
sudo apt install bleachbit
When DIY Isn't Enough
Sometimes the issue is deeper — a filesystem corruption, a malfunctioning service flooding logs, or a misconfigured application eating disk space faster than you can free it. If you've tried all the steps above and Ubuntu is still running out of disk space, CloudHouse remote support can connect to your machine and diagnose the exact cause within minutes. Our Linux engineers handle Ubuntu disk and storage issues daily and can resolve even complex cases without you needing to reinstall or lose data.
Frequently Asked Questions
Why does df show my disk is full but du shows much less space used?
This happens when processes have open file handles to files that have been deleted from the filesystem. Linux frees the actual disk blocks only when the last file handle is closed. df counts all allocated blocks (including "deleted" files still held open), while du only counts files with visible directory entries. Run sudo lsof +L1 to find and close these phantom open files, or simply reboot to release all handles.
How do I find what's using disk space on Ubuntu without a GUI?
Use sudo du -sh /* 2>/dev/null | sort -rh | head -20 to find the largest top-level directories, then drill deeper into the biggest ones. Alternatively, install ncdu (sudo apt install ncdu) for an interactive visual map of disk usage that lets you navigate and delete directly from the terminal.
How much space do snap packages typically use on Ubuntu?
With the default setting of 3 retained revisions, snap packages can easily consume 3–10 GB on a typical Ubuntu desktop. Each app revision is a full compressed image. Run snap list --all to see all revisions, remove disabled ones with the snap remove command, and set sudo snap set system refresh.retain=2 to limit future accumulation to just 2 revisions per app.
Is it safe to delete files from /var/cache/apt/archives/?
Yes, completely safe. The files in /var/cache/apt/archives/ are downloaded installer packages. Once software is installed, these files serve only as a local cache to speed up reinstallation. Running sudo apt clean deletes all of them without affecting any installed software. You can always re-download packages from Ubuntu's repositories whenever needed.
How do I stop Ubuntu from running out of disk space again?
The three highest-impact preventive measures are: (1) set sudo snap set system refresh.retain=2 to limit snap revision buildup, (2) add SystemMaxUse=500M to /etc/systemd/journald.conf to cap journal log growth, and (3) run sudo apt autoremove --purge && sudo apt clean monthly to clear old kernels and package caches. Together these three habits prevent the most common causes of unexpected disk exhaustion on Ubuntu.
