Subject: Re: [vserver] Copy-on-write Hard Links, Shared Libraries, Prelink and Memory
From: Corey Wright <undefined@pobox.com>
Date: Wed, 9 Jun 2010 23:54:27 -0500

On Wed, 9 Jun 2010 18:24:23 +0200
"JF Straeten" <jfstraeten@scarlet.be> wrote:

> On Wed, Jun 09, 2010 at 05:01:12PM +0100, Gordan Bobic wrote:
> 
> >>> # delete hashed files orphaned by all vservers
> >>> find /etc/vservers/.defaults/apps/vunify/hash/00/ -type f -links 1
> >>> -exec rm -f {} \;
> 
> [...]
> 
> >> Uh, sorry to be brain-damaged, but which directory do you mean?
> >> /etc/vservers/.defaults/apps/vunify/hash/00/ ?
> >>
> >> Can you cut&  paste the exact rm command you use?
> 
> find /srv/vservers/.hash -type f -links 1 -print0 | xargs -0 rm
> 
> 
> > He did. The find command execs 'rm -f' on all the files it finds
> > that have a hard link count of 1. Or am I misunderstanding your
> > question?
> 
> Yes, but it should be without the trailing "00/" part, isn't it ?

on debian lenny the vservers hash directory symlink is "00".  i don't know
if that is debian-specific or upstream util-vserver's convention; i'm too
lazy to investigate (but maybe daniel won't be and will quickly chime in if
he knows ;-).  the great flower page
(http://www.nongnu.org/util-vserver/doc/conf/configuration.html) only
specifies "id -> ...".

and i would not execute that find command
on /etc/vservers/.defaults/apps/vunify/hash/ (without the trailing "00/")
because that'll delete your "method" file and any other in that directory
(as they probably are not hardlinked anywhere and therefor have a link
count of 1) and won't follow the symlink to the actual hash directory.  so
it'll do what you didn't want and nothing of what you did want. :-)

and yes, i could have referenced "/srv/vservers/.hash" or
"/var/lib/vservers/.hash", but that would have been wrong for my own
system: "/home/vservers/.hash".  i figured it was best to
reference /etc/vservers/.defaults/apps/vunify/hash because that's *the*
answer as given by the authoritative documentation (ie great flower page),
but not knowing how to specifically reference the symlink to the hash
directory, i fell back to my specific system (ie "00").

last night i executed that exact command i gave (since this thread reminded
me to do it), so i know it works, at least for my filesystem layout. :-D

corey
-- 
undefined@pobox.com

> 
> A+
> 
> -- 
> 
> JFS.
>