Re: [vserver] guest mounts

From: Corey Wright <undefined_at_pobox.com>
Date: Fri 25 Jun 2010 - 21:55:52 BST
Message-Id: <20100625155552.d8d71481.undefined@pobox.com>

On Fri, 25 Jun 2010 19:30:01 +0200
Herbert Poetzl <herbert@13thfloor.at> wrote:

> On Fri, Jun 25, 2010 at 07:49:44AM +0200, jason@netkosice.sk wrote:
> > maybe small example will be more suitable :)
> >
> > # vserver ftp exec mkdir /tmp/mnt
> > # vserver ftp exec ls -a /tmp/mnt
> > . ..
> > # mount --bind /var/mail/ /var/lib/vservers/ftp/tmp/mnt/
>
> vv this happens in the host namespace ^^
>
> > # ls /var/lib/vservers/ftp/tmp/mnt/
> > root
>
> > # vserver ftp exec ls -a /tmp/mnt
> > . ..
>
> vv ofcourse the guest namespace is not affected ^^
>
> > # vserver ftp enter
> > # cd /tmp/mnt/
> > # ls -a
> > . ..
>
> > # exit
> > # vserver ftp restart
>
> now the guest namespace is recreated as a copy
> of the host namespace (plus some cleanup done by
> util-vserver)
>
> > [...]
> > # vserver ftp exec ls /tmp/mnt
> > root
>
> vv unmounting in the host namespace ...
>
> > # umount /var/lib/vservers/ftp/tmp/mnt/
>
> vv ofcourse does not affect the guest namespace
> (without explicit inheritance)
>
> > # vserver ftp exec ls /tmp/mnt
> > root
>
> again, recreating the guest namespace as copy
> will yield the expected result ...
>
> > # vserver ftp restart
> > [...]
> > # vserver ftp exec ls -a /tmp/mnt
> > . ..
>
> seems to me you are discovering filesystem
> namespaces for the first time :)

yes, and i remember when i "discovered" filesystem namespaces myself, and
this helped:

http://riseuplabs.org/grimoire/vserver/usage/#mounting_a_directory_from_one_vserver_into_another

(credit goes to micah for that page and google for helping me find it both
when it was at
http://deb.riseup.net/vserver/usage/#mounting_a_directory_from_one_vserver_into_another
and now at the new location.)

so try:

vnamespace -e <vserver> mount
--bind /var/mail/ /var/lib/vservers/ftp/tmp/mnt/

specifically, i've used the following:

vnamespace -e <vserver> mount /dev/loop /vservers/<vserver>/mnt/

(to mount the loop-back device into a vserver, like copying the contents of
a cd/dvd image into a vserver.)

corey

-- 
undefined@pobox.com
> best,
> Herbert
> 
> > > this really depends on the setup (i.e. more detail
> > > about the directories is required), but in general,
> > > if a mount is only visible inside guest A, then
> > > you won't have the mechanisms to mount it into a
> > > namespace belonging to e.g. guest B. if the mount
> > > is shared with the host OTOH, it should be rather
> > > simple to bind mount it into the guest ....
> > >
> > > in general it is advised to share a host directory
> > > tree with both guests (A and B) instead of trying
> > > to share a guest A specific filesystem with guest B.
> > >
> > >> When using vnamespace command I can see only empty
> > >> directory :(
> > >
> > > before or after the mount, on the host or guest and
> > > in the guest setup namespace or in the actual guest
> > > namespace? :)
> > >
> > >
> > > best,
> > > Herbert
> > >
> > 
> 
Received on Fri Jun 25 21:57:22 2010
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Fri 25 Jun 2010 - 21:57:25 BST by hypermail 2.1.8