[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Files piling up in /var/* directories



Mike McCarty wrote:

That's way more than I would permit on my machine. I not only find
it imaginable that /var would be < 500MB, my /var is < 300MB. And
on occasion, I have cleaned out the package manager stuff (though
it tends to come back).

# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda5              7633264   6147620   1097896  85% /
/dev/hda3                99075     24602     69358  27% /boot

Not everyone can afford hundreds of Gigs of disc space.
If disc is so cheap, will you buy me a new, larger drive?


I do not have a monster drive, nor do I have more than one. I have a single 40 GB drive. Of that, only about 14 GB is currently partitioned for use. (I also do not have huge collections of music and video files.) My /var is 2 GB and /var/cache/apt runs about 766 MB.

I was not happy with any of apts cleaning modes. What I wanted was something that would keep a copy of anything that I DO have installed, while letting me clear out anything that is NOT installed. I wrote a python script (about 13 KB) that does just that. It prints the following information (I just ran it and cleaned out some old files) and then prompts you to clean out uninstalled packages, or extra copies of installed packages.

-----------------------------------------------------------------------------------
CleanApt v0.4.0 - an apt cache cleaner

Total installed packages: 941 Total uninstalled packages in archive: 0 Total packages in archive: 922 Total files in archive: 922 Packages in archive w/dups: 0 Files in archive in dup pkgs: 0


Nothing to clean in archives.  Exiting.
------------------------------------------------------------------------------------

Duplicate package files will be listed in order (as ls would print them) with an asterisk by the one with the most recent date. You can tell the script to keep the last displayed, or the most current by date. You can also say not to delete any of the listed packages (this is the default). It does not delete ANYTHING unless specifically told to.

You still end up with a lot of files since it keeps one for each installed package, but at least I no longer have 12 old versions of a package taking up space, as was the case for some packages prior to using this script.

If anyone is interested in a copy of the script, please let me know. I don't currently have a public ftp site, but I could put a link to it somewhere on my website and you could get it from there.

--
Marc Shapiro
mshapiro_42@yahoo.com




Reply to: