[lxc-devel] mounting filesystems in a container

Daniel Lezcano daniel.lezcano at free.fr
Mon Feb 15 19:23:34 UTC 2010


Michael Tokarev wrote:
> I've a question here.
>
> What's a way to mont a new filesystem within a
> container, besides re-starting the container?
>
> For example, I've inserted a removable media on the
> host, it's available on the host as /dev/sdb1, and is
> mounted on the host as /mnt/removable.  But how to
> make it available in a running container?
>
> The same question pops up when I create a new filesystem
> on host (parted + fsck etc).
>
> Initially I had a need to re-arrange partitions/filesystems
> to make some more room available for certain containers,
> un-mounting things from within containers in order to re-
> format filesystem works, but mounting it again does not.
>
> Or am I missing something?
>
> (the block device, /dev/sdb1 in that case, is not accessible
> to the container in question using lxc.cgroup.devices.deny).
>   
I never tried but I think this is possible with mount propagation via 
the shared-subtree.
AFAIR, that was added to the mount namespace, especially for the use 
case you are giving.

http://www.ibm.com/developerworks/linux/library/l-mount-namespaces.html
http://lwn.net/Articles/159092/




More information about the lxc-devel mailing list