Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 9 down vote accepted

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....
share|improve this answer
    
apt-get clean it is, thanks –  bumperbox Sep 5 '09 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. –  David Rickman Sep 6 '09 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 '09 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 '09 at 6:01
    
@womble: That works unless it borked networking :P –  David Rickman Sep 6 '09 at 6:23
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.