[lxc-devel] Patch/RFC: allow pivot_root, unmount old fs

Michael Holzt lxc at my.fqdn.org
Tue Jan 5 21:12:30 UTC 2010


By the way, there is an interesting detail:

>   lxc-start 1262724870.575 lxc_conf - unmounted /oldrootfs/container/webhost/mnt2
>   lxc-start 1262724870.575 lxc_conf - unmounted /oldrootfs/container/webhost/dev/console
[...]
> | # cat /proc/mounts
[...]
> | /dev/root /mnt2 ext3 rw,relatime,errors=remount-ro,data=writeback 0 0
> | devpts /dev/console devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0

So the /dev/console mount by lxc and the /mnt2 mount from my fstab are
unmounted as well. But they continue to work because the rbind mount
by lxc to a tmp directory - which becomes our new rootfs - copy these
mounts.

So it seems that the linux kernel always ensures that rbind mounts are
complete and duplicates mounts if necessary, thus allowing to unmount
all mounts in the old rootfs without losing anything. So i believe that
the pivot_root approach will work with any setup, regardless what mounts
are made before.


Regards
Michael

-- 
It's an insane world, but i'm proud to be a part of it. -- Bill Hicks




More information about the lxc-devel mailing list