• untoreh-light
  • I am Francesco Giannelli. The website «unto.re» is the place where I put stuff I should remember...or forget. Located in south italy. Born in the early nineties.


A small utility for live modification of file systems

When I was first settling on what linux distribution use for my remote servers I needed a way to quickly install different root file systems on a target host, so I wrote [paroodise].

To be able to flash a booted block device you need to unmount. You can only unmount if you stop using it. To stop using it you need to restart your services in place, from another root file system. This is akin to what the initramfs does when it boots a linux based OS, the kernel executes a boot image which setups the file system from where the true init service is launched.

To achieve this on an already running system we have to be careful how we restart our processes. We can't kill ssh unless we are sure our script will run until successful.

The whole process is much easier on non systemd based distros, since systemd hooks deeply into the linux kernel, mangling with its processes recklessly can cause kernel panics...in fact on more recent distributions that's what usually happens :)

When I wrote this mini utility it seems I didn't know stable ways to spawn processes that outlived the original ssh sessions, It should be rewritten with more consistent methods.

The whole process consists of

If everything completes successfully it is possible at this point to spawn a new ssh service and login into a session where the original mount points are available for modifications.

Post Tags: