lkml.org 
[lkml]   [2016]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
Subjecthow to unmount an rbind mount ?
From
Good day -

Please could anyone advise -

Once one has mounted an alias mount with the 'rbind' option, so that
mounts underneath it are also mounted under the new path, how can
one unmount that filesystem safely without un-mounting the original
mountpoints ?

For example, I do this for chroots :
$ for d in /dev /proc /sys; do mount -o rbind $d $chroot/$d; done

Now, if I want to unmount the chroot device, I cannot do eg. :
$ unmount ${chroot}/dev
because this will fail since /dev/pts /dev/mqueue etc are still mounted ;
if I do:
$ unmount -R ${chroot}/dev
or
$ unmount ${chroot}/dev/pts
then /dev/pts will be unmounted from the root device filesystem -
the situation is much more horrid to try and unmount ${chroot}/sys or
${chroot}/run .

Personally, I think this is rather buggy behaviour by Linux, since I told the
kernel I only want to BIND the path ${chroot}/dev to /dev - and recursively
bind names beneath ${chroot}/dev/* to /dev/*, with the 'rbind' option, ie. to
make an alias of ${chroot}/dev/* for /dev/* - NOT to actually re-mount the
devices there . So I think umount should be clever enough to 'un-bind'
sub-mounts of mounts with the 'rbind' option, rather than unmount the
devices from the root filesystem, which is what currently happens.
It does make chroot filesystems very difficult to unmount safely !
Linux badly needs a better umount, IMHO .

Are there any plans to improve umount behavior wrt rbind mounts ?

\
 
 \ /
  Last update: 2016-04-12 23:41    [W:0.033 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site