Identifying the Scope of the Problem
1
Check Overall Disk Usage with df
df (disk free) shows the used and available space on every mounted filesystem at a glance. Always start here to confirm which filesystem is full and how severe the situation is.A filesystem at 95% or above should be treated as critically full. Many applications and databases begin failing between 95–100% capacity. Linux reserves 5% of ext4 space for root by default, so a partition may report 100% used while still having ~5% reserved — but this reserve is not available to non-root processes.
/ (root) if that is the one approaching capacity.2
Drill Down with du to Find Disk Hogs
Once you know which filesystem is full, use
du (disk usage) to locate the directories consuming the most space.3
Find Large Individual Files
After identifying large directories with
du, use find to locate individual files above a size threshold anywhere on the system.4
Clear Package Manager Caches
Package managers download packages to a local cache before installing them. This cache is never automatically purged and can grow to several gigabytes on systems that are updated regularly.
- Debian / Ubuntu (apt)
- Fedora / RHEL (dnf)
- macOS (Homebrew)
- Python (pip) / Node (npm)
apt autoremove removes packages that were installed as dependencies but are no longer needed by any installed package. It is safe to run regularly and often reclaims hundreds of megabytes.5
Manage and Rotate Log Files
Unrotated or verbose application logs are one of the most common causes of unexpected disk exhaustion, particularly on servers.Manage systemd journal logs (Linux):Force log rotation immediately:
6
Clear Temporary Files and Application Caches
7
Use macOS Storage Management (macOS Only)
macOS provides a built-in graphical Storage Management tool that categorizes your disk usage and offers system-level optimizations not accessible from the command line.
- Click the Apple menu → System Settings (macOS Ventura or later) or System Preferences (earlier).
- Select General → Storage (Ventura) or click Manage next to your disk.
- The Storage Management window opens and analyzes your drive. Allow it to complete — this takes 30–60 seconds.
Clearing
~/Library/Caches on macOS is safe — the OS and applications will rebuild these caches as needed. However, some apps (particularly Xcode and Simulator) store large items here. Check du -sh ~/Library/Caches/ before and after to confirm the reclaimed space.Reclaim Space: Priority Checklist
Use this checklist to quickly work through the highest-impact cleanup actions first:🔴 Quick wins (reclaim space in minutes)
🔴 Quick wins (reclaim space in minutes)
🟡 Targeted cleanup (requires review before deleting)
🟡 Targeted cleanup (requires review before deleting)
🟢 Long-term prevention
🟢 Long-term prevention
Set up automated log rotation (
logrotate), configure journald size limits, schedule periodic apt autoremove or brew cleanup via cron, and enable iCloud Optimized Storage on macOS laptops to prevent the disk from filling up again.Escalation
Disk is full but du doesn't account for all the space
Disk is full but du doesn't account for all the space
Deleted files held open by running processes can consume space invisibly —
df shows space as used, but du doesn’t find the files because they have been deleted from the directory tree.Inode exhaustion (space available but writes fail)
Inode exhaustion (space available but writes fail)
A filesystem can run out of inodes (directory entries) while still having free blocks. This produces the same “No space left on device” error.
Escalation path
Escalation path
- Document the output of
df -h,df -i, and the top output fromdu -h --max-depth=3 / 2>/dev/null | sort -rh | head -30. - If you cannot safely delete enough data to free space, contact your systems administrator or storage team to discuss expanding the volume, adding a new disk, or migrating large directories (e.g.,
/var/log) to a separate mount point. - For cloud instances (AWS EC2, GCP, Azure), submit a request to increase the volume size — this can often be done online without downtime.