upvote
One bit of magic you may be interested in is pivot_root, which allows another filesystem to take the place of the root filesystem (e.g. / and /mnt become /old and /). It's usually used during startup, to allow the "real" root filesystem to take the place of the initrd, but could have other uses.
reply
Last time I tried to use it though I just could not get it to let go of the main filesystem even after repeatedly killing the processes I could and restarting the rest.

Taking control at the initrd stage, as in the second page of the article, is significantly more reliable.

But have busybox in your initrd so you don't have to suffer. It takes up 0.5% of the size of my initrd file.

reply
You also don't want to do this under any kind of memory pressure, because the kernel will happily drop read-only pages from memory if it thinks they can be re-read from disk when needed.
reply
All of those things get covered in parts 2, 3, and 4 :)
reply
There's... no part 2 in the post? And it's the latest blog post on the site, as far as I can see.
reply
It does get linked at the very bottom, though admittedly it could be made clearer. https://astrid.tech/2026/03/24/1/swap-out-the-root-before-bo...
reply
Oh, I see, the posts got published in the reversed order.

On the topic itself: wow, what a journey. And I personally fully support "come on, you should totally be able to just dump the system image onto your disk and reboot/exec it!"

reply
in most cases you could just drop back into the initramfs that is included in most distros

Or if you have access to the boot command line you can also usually stop the boot process before pivot_root happens (hence you’ll be left running in the initramfs environment)

On Fedora/EL it would be done by putting `rd.break` in the kernel command line

reply