Re: [Vserver] Remounting external drive into vserver using --bind failed

From: Herbert Poetzl <herbert_at_13thfloor.at>
Date: Thu 28 Sep 2006 - 16:21:53 BST
Message-ID: <20060928152153.GD1628@MAIL.13thfloor.at>

On Thu, Sep 28, 2006 at 05:08:55PM +0200, Stefan Hepp wrote:
> Hi,
>
> I am trying to mount an external harddisk into a vserver, but ran into
> some troubles when using mount --bind/umount.
>
> So, here is my setup:
> Debian 3.1 stable, Linux 2.6.17.11-grsec2.1.9-vs2.0.2 (self-compiled)
> util-vserver from testing, version 0.30.210-10
> udev from testing, version 0.093-1
> /mnt/data second, big harddisk, ext3
> /media/usb0 external harddisk, ext3
>
> And here is what I do:
> # vnamespace -e data mount --bind /media/usb0
> /mnt/data/vservers/data/media/usb0
> works, can see files in vserver
>
> # vnamespace -e data umount /mnt/data/vservers/data/media/usb0
> works too
>
> Doing all this once again works too, however, when I unmount the bind,
> then unplug the drive (the device is removed, then usbmount unmounts
> /media/usb0) and plug it in again (device is created and mounted to
> /media/usb0 again), the trouble starts:

did you unmount the 'original' usb mount _inside_
the guest namespace too? if not, that is very likely
to cause your issues ...

don't forget, the guest namespace will (atm) not
automatically 'inherit' changes from the host
namespace, so basically you want to do the following
after an usb unplug/replug inside the guest namespace

 umount -f /mnt/data/vservers/data/media/usb0
 umount -f /media/usb0
 mount /some/usb/dev /media/usb0
 mount --bind /media/usb0 /mnt/data/vservers/data/media/usb0

otherwise, all you will get is an empty dir

HTC,
Herbert

> # vnamespace -e data mount --bind /media/usb0
> /mnt/data/vservers/data/media/usb0
> does not work, vnamespace -e data ls -a /media/usb0 doesn't show a
> single entry (not even . and ..)
> the bind shows up in /proc/mounts
>
> # vnamespace -e data mount --bind /media/usb0/Temp
> /mnt/data/vservers/data/media/usb0
> mount: special device /media/usb0/Temp does not exist
>
> # touch /media/usb0/Temp/test.txt
> works..
>
> # vnamespace -e data umount /mnt/data/vservers/data/media/usb0
> works too, ls shows . and ..
>
> # umount /media/usb0
> # vnamespace -e data mount /dev/sdb1 /mnt/data/vservers/data/media/usb0
> works. no problems when mounting the device itself, even when the device
> is removed while still mounted.
>
> After restarting the vserver, bind works again until the drive is
> unplugged. Unmounting /media/usb0 before it is removed, using --rbind
> or binding a sub-directory does not make any difference.
>
> This makes it impossible to bind a directory from the external
> harddisk into a vserver without restarting the vserver each time. I am
> currently trying to hack usbmount to remount the device itself without
> using --bind, which works for me, but simply binding would make it a
> lot easier ;) .
>
> (For the records: testme.sh and testfs.sh report no errors)
>
> Regards,
> Stefan
>
> _______________________________________________
> Vserver mailing list
> Vserver@list.linux-vserver.org
> http://list.linux-vserver.org/mailman/listinfo/vserver
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Thu Sep 28 16:25:33 2006

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Thu 28 Sep 2006 - 16:25:36 BST by hypermail 2.1.8