* Mount -a and bind mounts. Bug?
@ 2011-12-09 12:33 Andrew Walrond
2011-12-09 12:48 ` Karel Zak
2011-12-09 12:50 ` Andrew Walrond
0 siblings, 2 replies; 7+ messages in thread
From: Andrew Walrond @ 2011-12-09 12:33 UTC (permalink / raw)
To: util-linux
When using bind mounts, particularly when they are specified in /etc/fstab, 'mount -a' does not recognise that a mount is already mounted and will rebind another copy over the top with each mount -a.
Is this the expected behaviour? I'm not sure so I thought I'd ask.
I'm using v2.20.1.
Example:
user@localhost ~ $ cat /etc/fstab
#FILESYSTEM MOUNTPOINT TYPE OPTIONS BACKUP FSCK-PASS
/root/etc /etc none bind 0 0
/root/home /home none bind 0 0
/root/local /local none bind 0 0
/root/mnt /mnt none bind 0 0
/root/tmp /tmp none bind 0 0
/root/var /var none bind 0 0
/root/swap none swap sw 0 0
user@localhost ~ $ mount
rootfs on / type rootfs (rw,size=0k,nr_inodes=0)
none on /dev type devtmpfs (rw,relatime,size=7202028k,nr_inodes=1800507,mode=755)
none on /proc type proc (rw,relatime)
none on /sys type sysfs (rw,relatime)
none on /dev/pts type devpts (rw,relatime,gid=3,mode=620)
none on /dev/shm type tmpfs (rw,relatime)
/dev/vda on /root type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /etc type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /home type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /local type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /mnt type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /tmp type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /var type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
user@localhost ~ $ sudo mount -a
user@localhost ~ $ mount
rootfs on / type rootfs (rw,size=0k,nr_inodes=0)
none on /dev type devtmpfs (rw,relatime,size=7202028k,nr_inodes=1800507,mode=755)
none on /proc type proc (rw,relatime)
none on /sys type sysfs (rw,relatime)
none on /dev/pts type devpts (rw,relatime,gid=3,mode=620)
none on /dev/shm type tmpfs (rw,relatime)
/dev/vda on /root type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /etc type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /home type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /local type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /mnt type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /tmp type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /var type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /etc type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /home type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /local type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /mnt type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /tmp type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/vda on /var type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mount -a and bind mounts. Bug?
2011-12-09 12:33 Mount -a and bind mounts. Bug? Andrew Walrond
@ 2011-12-09 12:48 ` Karel Zak
2011-12-09 12:55 ` Andrew Walrond
2011-12-09 12:50 ` Andrew Walrond
1 sibling, 1 reply; 7+ messages in thread
From: Karel Zak @ 2011-12-09 12:48 UTC (permalink / raw)
To: Andrew Walrond; +Cc: util-linux
On Fri, Dec 09, 2011 at 12:33:58PM +0000, Andrew Walrond wrote:
> When using bind mounts, particularly when they are specified in
> /etc/fstab, 'mount -a' does not recognise that a mount is already
> mounted and will rebind another copy over the top with each mount
> -a.
>
> Is this the expected behaviour? I'm not sure so I thought I'd ask.
> I'm using v2.20.1.
- distro?
- linked with libmount?
- do you have regular mtab or symlink to /proc/mounts
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mount -a and bind mounts. Bug?
2011-12-09 12:33 Mount -a and bind mounts. Bug? Andrew Walrond
2011-12-09 12:48 ` Karel Zak
@ 2011-12-09 12:50 ` Andrew Walrond
1 sibling, 0 replies; 7+ messages in thread
From: Andrew Walrond @ 2011-12-09 12:50 UTC (permalink / raw)
To: util-linux
In case it's relevant - /etc/mtab is a symlink to /proc/mounts.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mount -a and bind mounts. Bug?
2011-12-09 12:48 ` Karel Zak
@ 2011-12-09 12:55 ` Andrew Walrond
2011-12-09 13:01 ` Karel Zak
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Walrond @ 2011-12-09 12:55 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
On Fri, Dec 09, 2011 at 01:48:37PM +0100, Karel Zak wrote:
> On Fri, Dec 09, 2011 at 12:33:58PM +0000, Andrew Walrond wrote:
> >
> > I'm using v2.20.1.
>
> - distro?
A custom job of my own
> - linked with libmount?
Don't think so.
$ ldd /bin/mount
linux-vdso.so.1 => (0x00007fff093af000)
libblkid.so.1 => //lib/libblkid.so.1 (0x00007f087b755000)
libuuid.so.1 => //lib/libuuid.so.1 (0x00007f087b551000)
libc.so.6 => //lib/libc.so.6 (0x00007f087b1ca000)
/lib64/ld-linux-x86-64.so.2 => //lib64/ld-linux-x86-64.so.2 (0x00007f087b97b000)
Saw some mention of libmount somewhere when I upgraded and built 2.20.1 but didn't have time to read further.
What's the current recommendation? Should I link against it?
> - do you have regular mtab or symlink to /proc/mounts
symlink to /proc/mounts
Andrew Walrond
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mount -a and bind mounts. Bug?
2011-12-09 12:55 ` Andrew Walrond
@ 2011-12-09 13:01 ` Karel Zak
2011-12-09 13:03 ` Karel Zak
0 siblings, 1 reply; 7+ messages in thread
From: Karel Zak @ 2011-12-09 13:01 UTC (permalink / raw)
To: Andrew Walrond; +Cc: util-linux
On Fri, Dec 09, 2011 at 12:55:37PM +0000, Andrew Walrond wrote:
> On Fri, Dec 09, 2011 at 01:48:37PM +0100, Karel Zak wrote:
> > - distro?
>
> A custom job of my own
>
> > - linked with libmount?
>
> Don't think so.
>
> $ ldd /bin/mount
> linux-vdso.so.1 => (0x00007fff093af000)
> libblkid.so.1 => //lib/libblkid.so.1 (0x00007f087b755000)
> libuuid.so.1 => //lib/libuuid.so.1 (0x00007f087b551000)
> libc.so.6 => //lib/libc.so.6 (0x00007f087b1ca000)
> /lib64/ld-linux-x86-64.so.2 => //lib64/ld-linux-x86-64.so.2 (0x00007f087b97b000)
>
> Saw some mention of libmount somewhere when I upgraded and built 2.20.1 but didn't have time to read further.
> What's the current recommendation? Should I link against it?
>
> > - do you have regular mtab or symlink to /proc/mounts
>
> symlink to /proc/mounts
... okay then it's expected behavior. The file /proc/mounts does not
provide enough information about bind mounts. You need regular mtab
or link with libmount (the library reads /proc/self/mountinfo and
does some horrible voodoo to detect already mounted bind mounts).
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mount -a and bind mounts. Bug?
2011-12-09 13:01 ` Karel Zak
@ 2011-12-09 13:03 ` Karel Zak
2011-12-09 13:15 ` Andrew Walrond
0 siblings, 1 reply; 7+ messages in thread
From: Karel Zak @ 2011-12-09 13:03 UTC (permalink / raw)
To: Andrew Walrond; +Cc: util-linux
On Fri, Dec 09, 2011 at 02:01:28PM +0100, Karel Zak wrote:
> On Fri, Dec 09, 2011 at 12:55:37PM +0000, Andrew Walrond wrote:
> > On Fri, Dec 09, 2011 at 01:48:37PM +0100, Karel Zak wrote:
> > > - distro?
> >
> > A custom job of my own
> >
> > > - linked with libmount?
> >
> > Don't think so.
> >
> > $ ldd /bin/mount
> > linux-vdso.so.1 => (0x00007fff093af000)
> > libblkid.so.1 => //lib/libblkid.so.1 (0x00007f087b755000)
> > libuuid.so.1 => //lib/libuuid.so.1 (0x00007f087b551000)
> > libc.so.6 => //lib/libc.so.6 (0x00007f087b1ca000)
> > /lib64/ld-linux-x86-64.so.2 => //lib64/ld-linux-x86-64.so.2 (0x00007f087b97b000)
> >
> > Saw some mention of libmount somewhere when I upgraded and built 2.20.1 but didn't have time to read further.
> > What's the current recommendation? Should I link against it?
> >
> > > - do you have regular mtab or symlink to /proc/mounts
> >
> > symlink to /proc/mounts
>
> ... okay then it's expected behavior. The file /proc/mounts does not
> provide enough information about bind mounts. You need regular mtab
> or link with libmount (the library reads /proc/self/mountinfo and
> does some horrible voodoo to detect already mounted bind mounts).
see also:
http://karelzak.blogspot.com/2011/04/bind-mounts-mtab-and-read-only.html
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mount -a and bind mounts. Bug?
2011-12-09 13:03 ` Karel Zak
@ 2011-12-09 13:15 ` Andrew Walrond
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Walrond @ 2011-12-09 13:15 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
On Fri, Dec 09, 2011 at 02:03:05PM +0100, Karel Zak wrote:
>
> http://karelzak.blogspot.com/2011/04/bind-mounts-mtab-and-read-only.html
>
Nice blog entry, made incidentally on my birthday which is obviously how I missed it ;)
My build script now contains --enable-libmount-mount. Thanks for your time!
Andrew Walrond
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-12-09 13:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-09 12:33 Mount -a and bind mounts. Bug? Andrew Walrond
2011-12-09 12:48 ` Karel Zak
2011-12-09 12:55 ` Andrew Walrond
2011-12-09 13:01 ` Karel Zak
2011-12-09 13:03 ` Karel Zak
2011-12-09 13:15 ` Andrew Walrond
2011-12-09 12:50 ` Andrew Walrond
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.