Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: panzerboy@gmail.com (Jeremy Thomson)
Subject: Re: Efficient way of deleted large directories
Date: 26 Sep 2004 15:50:18 -0700	[thread overview]
Message-ID: <6425a413.0409261450.32929225@posting.google.com> (raw)
In-Reply-To: harris-83C45E.22064023092004@cacnews.cac.cpqcorp.net

Bob Harris <harris@zk3.dec.com> wrote in message news:<harris-83C45E.22064023092004@cacnews.cac.cpqcorp.net>...
> In article <6425a413.0409231459.564df263@posting.google.com>,
>  panzerboy@gmail.com (Jeremy Thomson) wrote:
...
> > Finally got the directories deleted, probably took about 20 hours over
> > a couple of days.
> > That was two directories with 518,000 and 528,000 files respectively.
> > The last way I tried deleteing was ls -1r | xargs -i  rm -f {}
> > That seemed a little bit faster though by that time there was only
> > 200,000 files to delete, so I guess it would have been faster anyway.
> 
> I think that /bin/ls -1r would just change the name sorting order, but I 
> do not think it would cause an lstat() operation.  And since you have 
> index files, there is not as much benefit to removing the files in a 
> specific order.  But if you want to squeeze out very last drop of 
> performance, then I think 
> 
>         /bin/ls -1f directory | xargs rm -f
> 
> would be about as good as it gets.  You might squeeze a few tiny drops 
> out of writing your own C program to read the directory using readdir() 
> and call remove().  That would eliminate multiple invocations of the rm 
> command, but the xargs command does bunch up the files so that it does 
> not need to invoke rm too many times.  I think ls -f into xargs is good 
> enough.
> 
> > regards,
> > Jeremy Thomson
> 
> I don't know what the files in the huge directory(s) are used for, if 
> you have a way to pruning them on a regular basis, say via a cron job, 
> it might help with the sudden load demand to do this before the vdump.
> 
>                                         Bob Harris

The data isnt at all important, one is a log of the output of UniData
phantom processes, the other captures of SQL enquiries. We only look
at this stuff if something goes wrong.
We do have a regular cron'd purge, it was the failure of this that
started the whole problem.
I had a c program that would compare list of filenames and a cutoff
date and output the filenames modified earlier than the cutoff so they
could be deleted.
It fell over when it couldnt stat() a file. Unbeknownst to me
temporary files were being put in one of the directories then renamed.
That broke the purge.


  reply	other threads:[~2004-09-26 22:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-23  1:16 Efficient way of deleted large directories Jeremy Thomson
2004-09-23  2:37 ` Bob Harris
2004-09-23 22:59   ` Jeremy Thomson
2004-09-24  2:13     ` Bob Harris
2004-09-26 22:50       ` Jeremy Thomson [this message]
2004-09-23 13:23 ` Peter da Silva
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox