Stop Apt from leaving your package cache to rot on your root partition

Package Management & Distro Internals (Apt/Dnf/Pacman)

Stop Apt from leaving your package cache to rot on your root partition

Technical Briefing | 11/19/2026

You run apt-get clean eventually, but if your root partition is tighter than a drum, you have likely run into the dreaded disk full error right in the middle of a dist-upgrade. The package cache in /var/cache/apt/archives is the silent killer here. It just keeps growing, holding onto every .deb file you have ever downloaded, regardless of whether that version is still installed or even available in the upstream repo.

Moving the cache off the root filesystem

If you have a dedicated data volume or just extra space on a different mount point, stop wasting your root disk IO and space. You can tell apt exactly where to look for its archive directory. You do not need a symlink hack, which inevitably breaks when packages get updated or permissions change. Just use the Dir::Cache configuration block.

echo 'Dir::Cache "/mnt/data/apt";' > /etc/apt/apt.conf.d/99custom-cache

  • The directory structure will be created automatically on the next run
  • Make sure the mount point has enough inode capacity for thousands of small files
  • Permission settings for the new folder should match the original /var/cache/apt/archives

The best part is that this setup survives system upgrades and is handled properly by tools like synaptic or unattended-upgrades. Once you move this, verify the change by running an update and watching where the files land. If you ever have to rebuild the OS, just pointing this config back to the same data volume saves you from having to re-download gigabytes of base packages.

Linux Admin Automation  |  © www.ngelinux.com  |  11/19/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted