Safely free up disk space on Linux
Troubleshooting guides · Storage & drives
A build fails with “No space left on device,” but your home folder is on a drive with room. Start with the path where the operation failed. The project, the build cache and your home folder can each use a different filesystem.
GNU/Linux desktops and workstations using GNU Coreutils. Package guidance applies only to the named distribution families and installed tools.
Check which filesystem is full
Section titled “Check which filesystem is full”-
Replace the example path with an existing directory where the error occurred. If the output file was never created, use its existing parent. Run as your regular user.
Linux terminal · Read-only checkdf -k -- "/path/to/affected/location"Runs only when you paste it into your terminal and press Enter.
-
Read Available in KiB and Mounted on to see which filesystem you need to check. In this illustrative output, the project is on a volume mounted at
/work. Free space under home won’t help that volume.GNU df output · made-up readings to help you find the right fields Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdb1 52428800 51380000 0 100% /work -
If bytes are available but creating files still fails, run
df -iwith the same arguments. A filesystem can run out of inodes, the entries it uses to track files, even when there is room for data. If inode counts are available and exhausted, look for a user-owned cache or build output with many small files. If both readings show room, check for a user quota or an app-specific limit before clearing space. GNU df reference
See what is using space
Section titled “See what is using space”Use your file manager to review files in a local directory you own on the affected filesystem. Large recordings and old installers can be good starting points. If you need to move a file, check the copy on its destination and verify your backup before removing the original. Moving files to Trash can leave them on the same filesystem. Check individual items and their recovery options before removing them from Trash.
If you’re comfortable scanning the whole directory tree and have checked that it contains no nested mounts, protected data or other users’ files, use GNU du to see the blocks used by its immediate subdirectories and the directory total. Replace the example with your chosen directory.
du -x -k --max-depth=1 -- "/path/to/approved/directory"Runs only when you paste it into your terminal and press Enter.
This invocation walks the tree even though it displays only one level. It skips symlink targets and directories on different filesystems. A bind mount on the same filesystem can still be included, so skip the walk if you can’t establish its boundaries. Permission errors leave the totals incomplete. A sparse file can have a large logical length while using very few blocks. Shared blocks, snapshots and open deleted files can leave a gap between a walk and the volume reading. GNU du reference · Btrfs shared extents
If you removed a large file and space barely changed, an app may still have it open. In three disposable WSL ext4 trials, free space changed only after the last hard-link name was gone and the open file handle closed. That was one controlled filesystem test. If lsof is already installed, lsof +L1 can show open deleted files across visible processes. Keep its output private and save your work before closing an app. Leave managed services to the administrator. Linux unlink behavior
Review package downloads and system data
Section titled “Review package downloads and system data”If the affected mount holds the package cache, distinguish downloaded archives from installed software. On Debian and Ubuntu, APT’s clean removes cached downloads, which may need to be fetched again. apt-get -s autoremove previews dependency removals without performing them. Review both the proposed packages and any warnings about access to configuration. On Fedora, check the installed DNF version before reviewing its clean packages operation. On Arch with pacman-contrib installed, paccache -d shows cache candidates. Keep versions you’ll need for rollback or offline repair. APT reference · DNF 5 clean reference · Arch paccache reference
On a systemd machine, journalctl --disk-usage gives a journal size for what you can access. It includes active and archived logs. Clearing archived logs removes history and may hinder troubleshooting. Keep unknown directories under /var, snapshots and container volumes with their owning tools. Ask the administrator about retention if system files are filling the affected mount. systemd journal reference
Measure the change on that mount
Section titled “Measure the change on that mount”Run the same df -k command before and after a single action. Compare Available on the same mount. A negative number means you ended with less space. If inode exhaustion was the issue, compare df -i as well. Record background activity that could have used space while you were checking, then retry the original operation.
Ask an agent to inspect one folder
Section titled “Ask an agent to inspect one folder”Use the disk-cleanup skill with the prompt below. Follow the installation instructions for your agent. The optional Python inventory and comparison require a supported Linux ext4 root mount. The skill has no generic deletion script and asks for approval before each cleanup action.
Start read-only on this Linux machine without sudo. Use the project path I give you to identify its filesystem. Inspect only the local folder I approve and skip mounts or links you cannot bound. Tell me what is visible, what is missing and one safe next action for my distribution. Ask before changing anything and keep names and reports local.
Ask for the same-mount baseline and a way to verify the result. If the agent lacks access to this machine, share the two free-space readings or aggregate totals after removing identifying paths.
If a build or container keeps filling the drive, use the developer storage or Docker storage checks to identify the owner.