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

Re: yum - how to cleanup downloaded yum cache





On 3/6/06, Justin Conover <justin conover gmail com> wrote:


On 3/6/06, David Timms < dtimms bigpond net au> wrote:
Justin Conover wrote:
> On 3/6/06, David Timms <dtimms 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,

DaveT.

--


Ok, I understand why you want to do what you want to do (or something like that )  ;-)

you could do this

find /var/cache/yum/development/headers -mtime +3 -exec rm -f {} \;
find /var/cache/yum/development/packages -mtime +3 -exec rm -f {} \;
find /var/cache/yum/extras-development/headers -mtime +3 -exec rm -f {} \;
find /var/cache/yum/extras-development/packages -mtime +3 -exec rm -f {} \;


E.G.

find /var/cache/yum/development/headers -mtime +3 | wc -l
35

find /var/cache/yum/development/headers -mtime +3 | wc -l
0

 find /var/cache/yum/development/headers -mtime +2 | wc -l
38

Notices I used 2 the last time.

This should work for what you are wanting to do and you could drop all those in a script too.

Keep in mind that the "+3" in -mtime means anything 4 days and older, so adjust that to your liking.



Just for clarity, this one

find /var/cache/yum/development/headers -mtime +3 | wc -l
0

was after this was ran

find /var/cache/yum/development/headers -mtime +3 -exec rm -f {} \;



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