From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Thread: fa528,d86f44c2176449dd X-Google-Attributes: gidfa528,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews1.google.com!not-for-mail From: panzerboy@gmail.com (Jeremy Thomson) Newsgroups: comp.unix.tru64 Subject: Re: Efficient way of deleted large directories Date: 23 Sep 2004 15:59:57 -0700 Organization: http://groups.google.com Message-ID: <6425a413.0409231459.564df263@posting.google.com> References: <6425a413.0409221716.55a1cb5@posting.google.com> NNTP-Posting-Host: 210.55.211.10 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1095980398 25280 127.0.0.1 (23 Sep 2004 22:59:58 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 23 Sep 2004 22:59:58 +0000 (UTC) Xref: g2news1.google.com comp.unix.tru64:316 Bob Harris wrote in message news:... > 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 {} ... > 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