2

i am trying to free up some space on my server, and i noticed that

/var/cache/apt has 322M

assuming that it is just a cache, in my mind it should be ok to delete those files and if it needs it again, then it will just download the files again

is that the correct assumption to make ?

serve: debian 4

2 Answers 2

9

Apt can do this with itself with the clean and autoclean options.

   clean
       clean clears out the local repository of retrieved package 
       files. It removes everything but the lock file from 
       /var/cache/apt/archives/ and /var/cache/apt/archives/partial/ ....

   autoclean
       Like clean, autoclean clears out the local repository of retrieved 
       package files. The difference is that it only removes package files 
       that can no longer be downloaded, and are largely useless....
5
  • apt-get clean it is, thanks
    – bumperbox
    Sep 5, 2009 at 21:52
  • 1
    What he really means to say is that you should use apt-get autoclean. This prevents an accident borked upgrade and kills a service you need. At that point you can just reinstall using dpkg and the .deb in /var/cache/apt. Sep 6, 2009 at 0:41
  • @freedom_is_chaos: Or apt-get install --reinstall, and save yourself the disk space for the 99.99999999999999% of the time you don't irreversibly break a package config.
    – womble
    Sep 6, 2009 at 4:46
  • The point of keeping them is so that if an upgrade breaks the package for you, you can downgrade to get it working again.
    – derobert
    Sep 6, 2009 at 6:01
  • @womble: That works unless it borked networking :P Sep 6, 2009 at 6:23
2

You can delete any file you want inside /var/cache. To quote the Filesystem Hierarchy Standard v 2.3, which Debian packages are required to follow:1

Files located under /var/cache may be expired in an application specific manner, by the system administrator, or both. The application must always be able to recover from manual deletion of these files (generally because of a disk space shortage).2 (emphasis added)

So, any software in Debian should be able to recover, possibly at the cost of some CPU time, bandwidth, etc., from
find /var/cache -type f -print0 | xargs -0 rm -f

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .