I'm unsure about exactly how switch_root handles other mountpoints.

As per the description in switch_root manpage all I could know is that it moves /proc, /dev, /sys and /run to the newroot and recursively removes all files and directories on the current rootfs.

But in my experiments I've found that if I mount something else before switch_root is executed in the oldroot that doesn't seem to get wiped out when I remount that in my newroot for checking.

So what does switch_root actually do to them ? Maybe unmount all the other mountpoints and then remove all files and directories recursively ? I'd really appreciate it if someone can clarify this to me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.