Re: [Vserver] clean-up hash directory

From: Daniel Hokka Zakrisson <daniel_at_hozac.com>
Date: Fri 08 Sep 2006 - 05:46:17 BST
Message-ID: <4500F599.10107@hozac.com>

Roderick A. Anderson wrote:
> Corey Wright wrote:
>
>> i was curious if vhashify cleaned up after itself (delete orphaned
>> instances of files in hash directory), and it appears it doesn't. these
>> commands should do the job. well, technically this just lists files
>> with a
>> hardlink count of 1 and prints the total size in bytes of all listed
>> files
>> on the last line (so you know how much space you are saving).
>>
>> find /etc/vservers/.defaults/vdirbase/.hash/ -type f -printf "%n %s
>> %p\n" |
>> grep '^1[[:space:]]' | awk '{ sum += $2; print $3 } END { print sum }'

You could easily eliminate the grep by using -links 1 in the find command.

>> to delete those listed files, add to the end:
>> | while read FILE; do rm -f ${FILE}; done

Would be far more efficient to use -print0 | xargs -0 rm -f.

> Did you hear anything on this? I ran the query on a 12+ guest system (
> all FC5 ) and it ran for well over a couple of minutes before I got
> tired of watching the output. This leads me to think I've got lots of
> orphans. I'd like to get rid of them ( Save the inodes! ) but want to
> understand what I'm doing first. Rather not fubar a live system.

This should be a perfectly safe command, I always run some cleanup after
hashifying my guests.

> I'm not sure I fully understand how vhashify works. Where are the
> actual files located. Are the entries in
> /etc/vservers/.defaults/vdirbase/.hash/
> links to the actual files and then each guest links to these -- links?

Those would be the actual files (the file in the .hash directory is
created by vhashify as a copy of the file it's hashifying), and vhashify
then creates links to those in the guest(s).

-- 
Daniel Hokka Zakrisson
GPG id: 06723412
GPG fingerprint: A455 4DF3 990A 431F FECA  7947 6136 DDA2 0672 3412
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Fri Sep 8 05:49:10 2006
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Fri 08 Sep 2006 - 05:49:15 BST by hypermail 2.1.8