[lxc-devel] /proc/mounts and bind mounts

Christophe Varoqui christophe.varoqui at free.fr
Thu Nov 12 16:18:52 UTC 2009


On jeu., 2009-11-12 at 16:33 +0100, Daniel Lezcano wrote:
> Christophe Varoqui wrote:
> > On jeu., 2009-11-12 at 10:22 +0100, Daniel Lezcano wrote:
> >   
> >> Christophe Varoqui wrote:
> >>     
> >>> Hi Daniel, all,
> >>>
> >>> After bind mounting /tmp on /unxtstencap in a container, the
> >>> corresponding entry in /proc/mounts is displayed as :
> >>> /dev/mapper/zezette-root /unxdrpencap ext4
> >>> rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
> >>>
> >>> /dev/mapper/zezette-root being the device holding /tmp.
> >>>
> >>> The source directory information is lost. Is that expected ?
> >>>   
> >>>       
> >> Yes and that's already the case without containers. The mount 
> >> information, done with the mount(1) command, write information in 
> >> /etc/mtab. You should check this file instead.
> >>     
> >
> > In the hosting system:
> >
> > cvaroqui at zezette:/opt/lxc/rootfs.vm5/service$ sudo mount -t none -o
> > bind /tmp /mnt
> > cvaroqui at zezette:/opt/lxc/rootfs.vm5/service$ tail -1 /etc/mtab 
> > /tmp /mnt none rw,bind 0 0
> >
> > It seems the information is not discarded. May be that's because the
> > host is ubuntu and the guest is Centos 5 then ?
> >   
> What I meant is the mtab shows the information you are looking for, 
> while the kernel shows a different information in /proc/mounts.
> The mount command shows the content of mtab. So if you want to get the 
> source directory information, you should use the mount command or look 
> at the /etc/mtab.
> 
I see, the centos image I got from the openvz community has /etc/mtab
linked to /proc/mounts.

Removing the link restores the expected behaviour. Thank you for your
help.







More information about the lxc-devel mailing list