From: panzerboy@gmail.com (Jeremy Thomson)
Subject: Re: Efficient way of deleted large directories
Date: 23 Sep 2004 15:59:57 -0700 [thread overview]
Message-ID: <6425a413.0409231459.564df263@posting.google.com> (raw)
In-Reply-To: harris-52EA92.22311222092004@cacnews.cac.cpqcorp.net
Bob Harris <harris@zk3.dec.com> wrote in message news:<harris-52EA92.22311222092004@cacnews.cac.cpqcorp.net>...
> In article <6425a413.0409221716.55a1cb5@posting.google.com>,
> panzerboy@gmail.com (Jeremy Thomson) wrote:
...
> You did not specify your operating system version, and more important
> which on-disk format of AdvFS is your file system(s). The showfdmn
> command will tell you the domain version number (DVN) 4 is the most
> recent.
We have Tru64 v5.1, the showfdmn shows domain version 4.
>
> If you have DVN 4, then any directory greater than 8K in size will have
> a shadow index file that uses b-trees to make fast name addition, name
> lookup, and name removal.
>
> If you have DVN 3, then the larger the directory the slower the add,
> lookup, removal of a name in the directory.
...
> > So I had directories with upwards of 500,000 files in them.
>
> You really Really REALLY want to see if you can get a v5.* version of
> Tru64 UNIX and then recreate your domains so that they are DVN 4 so that
> these directories will have the shadow b-tree index files. These b-tree
> files give you near linear add, lookup, remove access to your
> directories.
I believe we do.
When you do a listing of a large directory the first time thru takes
ages.
After that subsequent listings are very fast.
Does ADVFs keep that index in memory?
> > Doing ...
> > ls -1 >filelist
> > takes a long time.
>
> use "/bin/ls -f". Using /bin/ls means you have not grabbed an alternate
> version of ls, or used a shell alias. The -f option turns off sorting,
> this will save you time. Never ask ls to get any file information if
> you want speed. Asking for size or dates on a file or using an ls that
> will colorize the file based on file type or protections (eg. gnu ls or
> csh built-in ls) will slow down the world while ls does an lstat()
> system call on every file in the directory.
>
> Another feature of -f is that this is the order that the files are
> actually stored in the directory.
>
> > xargs -i rm -f {} <filelist
>
...
> Delete files in the order they are stored in the directory. Use /bin/ls
> -f to get the list of files in the order they are stored in directory.
>
> Avoid rm -r
> Avoid any ls options or alternate ls commands that will attempt to get
> file information (kind of file, size, date, protections, ownership,
> etc...)
> Try to do the delete before creating the clone. Once the clone is
> created, the deletes just move the file's storage to the clone, and then
> you get to do the real delete when the clone is removed.
>
> Bob Harris
>
> > thanx in advance,
> > Jeremy Thomson
Ta for that Bob.
It seems the problem is mostly there was far too many files but I'll
change our purge scripts to use /bin/ls -f
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.
regards,
Jeremy Thomson
next prev parent reply other threads:[~2004-09-23 22:59 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 [this message]
2004-09-24 2:13 ` Bob Harris
2004-09-26 22:50 ` Jeremy Thomson
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