[systemd-devel] [HEADS-UP] systemd and Storage Daemons for the Root File System
Lennart Poettering
lennart at poettering.net
Wed Jan 11 07:13:08 PST 2012
On Wed, 11.01.12 16:04, Jan Engelhardt (jengelh at medozas.de) wrote:
> Now, Kay Sievers claims (on IRC) pivot_root is "10 years ago stuff" and
> points to util-linux's switchroot function for how things are supposedly
> to be done today. But, as we look at
> http://git.kernel.org/?p=utils/util-linux/util-linux.git;a=blob;f=sys-utils/switch_root.c;hb=HEAD#l150
> what can really be seen there is that the new root (/dev/sda3 in my
> previous commands example) is just mounted atop the rootfs-type
> vfsmount, thereby concealing it.
> (That is not a replacement for what pivot_root does, really.)
>
> Of course, if you conceal the rootfs-type vfsmount, there is no way that
> the proc trick is going to work -- which is why I proposed using
> pivot_root instead of {MS_MOVE + chroot} and *keeping* the rootfs
> vfsmount around, in a visible fashion.
The chroot() call in switch_root is just to drop the reference to the
old mount point, it doesn't really have a lot of meaning besides
that. It's like the chdir() call there too, which drops another
reference to the old mount.
pivot_root is very similar to an MS_BIND for the old root dir plus an
MS_MOVE for the new one, and as such is pretty much obsolete.
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list