Re: [Vserver] Quick question

From: Corey Wright <undefined_at_pobox.com>
Date: Tue 23 May 2006 - 04:24:14 BST
Message-Id: <20060522222414.2d71943a.undefined@pobox.com>

On Mon, 22 May 2006 13:44:48 -0400
Fareha Shafique <fareha@eecg.toronto.edu> wrote:

> >when you run vhashify it creates hardlinks
> >within /etc/vservers/.defaults/apps/vunify/hash/0 to all files that are
> >not explicitly excluded
> >within /usr/lib/util-vserver/defaults/vunify-exclude (well, that's the
> >file within the debian package; location may vary).
> >
> >again, all files are "unified" that are not explicitly excluded.
> >
> >
> If hardlinks are created the inode numbers should be the same. But when
> I hashified 2 of my vservers (I first used the -nv option to see which
> files would be unified) I checked the files that were supposed to have
> been unified and I don't get the same inode number? I don't get any
> error messages, I'm not sure if my hashify is working? How can I check?
> Like I mentioned in another thread, I created the second vserver using a
> template of the first one. The number of links on most files in the
> template is already more than one, and hashify does not increase the
> number of these links.

hopefully the line wrapping doesn't visually destroy the following too much.

# ls -1i /home/vservers/*/bin/bash | cut -d' ' -f1 | uniq -c
     13 6751094

(all thirteen instances of /bin/bash within vservers occupy inode 6751094.)

# ls -il /home/vservers/{test,client}/bin/bash*
6751094 -rwxr-xr-x 14 root root 729640 2005-05-02
17:39 /home/vservers/client/bin/bash
6751094 -rwxr-xr-x 14 root root 729640 2005-05-02
17:39 /home/vservers/test/bin/bash

(there are 14 hardlinks: 13 belonging to vservers, and the master one
within /etc/vservers/.defaults/apps/vunify/hash/0.)

# cp -av /home/vservers/client/bin/bash{,.unlinked}
`/home/vservers/client/bin/bash' ->
`/home/vservers/client/bin/bash.unlinked'
# ls -1i /home/vservers/{test,client}/bin/bash*
6751094 /home/vservers/client/bin/bash
 573454 /home/vservers/client/bin/bash.unlinked
6751094 /home/vservers/test/bin/bash
# rm /home/vservers/client/bin/bash
rm: remove write-protected regular file `/home/vservers/client/bin/bash'? y
# mv /home/vservers/client/bin/bash{.unlinked,}
# ls -il /home/vservers/{test,client}/bin/bash*
 573454 -rwxr-xr-x 1 root root 729640 2005-05-02
17:39 /home/vservers/client/bin/bash
6751094 -rwxr-xr-x 13 root root 729640 2005-05-02
17:39 /home/vservers/test/bin/bash
# vserver client hashify -nv
Initializing exclude-list for /home/vservers/client (client)
Starting to traverse directories...
<snip>
unifying '/bin/bash'
<snip>
# vserver client hashify
# ls -il /home/vservers/{test,client}/bin/bash
6751094 -rwxr-xr-x 14 root root 729640 2005-05-02
17:39 /home/vservers/client/bin/bash
6751094 -rwxr-xr-x 14 root root 729640 2005-05-02
17:39 /home/vservers/test/bin/bash

so, that's how it works for me.

this is how i set it up, synthesized from
http://linux-vserver.org/alpha+util-vserver under "vhashify".

* mkdir -p /etc/vservers/.defaults/apps/vunify/hash
* mkdir -p /home/vservers/.hash
* ln -s /home/vservers/.hash /etc/vservers/.defaults/apps/vunify/hash/0
* mkdir -p /etc/vservers/<vserver>/apps/vunify
* customize exclusions (if necessary)
 o cp
-av /usr/lib/util-vserver/defaults/vunify-exclude /etc/vservers/<vserver>/apps/vunify/exclude
 o echo '/usr/src/*' >>/etc/vservers/<vserver>/apps/vunify/exclude
* vserver <vserver> hashify -nv | less
* vserver <vserver> hashify

all but the first three steps should be repeated for each vserver.

note: /etc/vservers/.defaults/apps/vunify/hash/0, /etc/vservers/.defaults/vdirbase,
and correspondingly /etc/vservers/*/vdir must all be (or symlink to
directories) on the same filesystem, otherwise hardlinks cannot be
created.

hth.

corey

-- 
undefined@pobox.com
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Tue May 23 04:24:39 2006
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Tue 23 May 2006 - 04:24:45 BST by hypermail 2.1.8