yum - how to cleanup downloaded yum cache

David Timms dtimms at bigpond.net.au
Mon Mar 6 19:40:36 UTC 2006

Justin Conover wrote:
> On 3/6/06, David Timms <dtimms at bigpond.net.au> wrote:
>> I've tried to find a way to clean up all the old headers and downloaded
>> RPMs that accumulate in /var/cache/yum
>> What I want is to erase (the thousands of) superseded header files that
>> are no longer current, leaving with only the current headers from repo,
>> and also delete the superseded rpm files (probably another 1000-2000
>> files and 1.5 to 2 GB of data), ie if the rpm is not in the current repo
>> file list, then delete it for each repo.
> I don't think you can have your cake and eat it to.
Why not, it's only programming - the repo info files contain all the 
information that a tool would need. a. Create list of current rpms. b. 
Create file list of the yum package directory. c. for each item in b 
that is not in a, erase both hdr + rpm ?
> It takes like 10-30 seconds to get all the header files if you start over, I
> don't think your going to find away to exclude/keep only certian
> header/rpm's unless you manually go through it.
Perhaps something as "simple" as using xargs in a script ?

> Besides, if you only want to keep what is current on the server, what would
> is it you want to accomplish with that?
I am trying to test on as many machines as possible, and bandwidth is 
not free, nor is it fast (I am on a capped plan - once I get to my 
monthly limit I get slowed to modem speed!) For example to get from 
FC5T3 to rawhide, the downloads of headers might take 5 minutes (@ 
512kb). But more importantly, why unnecessarily waste internet / mirrors 
bandwidth ?

> Packages are already installed, so
> you don't really need them lying around, 
I set up my main machine with heaps of storage to store all the hdr/rpm 
as normal. I then pupdate the main machine just before I do the 
following. On each new machine I test on, I run an rsync to mirror the 
yum folder to the new machine, quite simple really, but copying 4000 
files (2G of files) that aren't relevant and have long been superseded 
is such a waste of my time.

> if it is because your running
> rawhide and might need to fall back, than keep the packages for a few and
> blow everything out.
I can see a reason while on the devel repo to keep some old packages, 
but I'm far more concerned that my machines end up with no disk space. 
Especially bad on any older/low-disk machines that I have tried. Having 
to decide on erasing thousands of individual files manually is not my 
idea of fun.

Anyhow, thanks for you ideas Justin,


More information about the fedora-test-list mailing list