[systemd-devel] booting A/B rootfs
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Wed Oct 8 22:03:18 PDT 2014
On Thu, Oct 09, 2014 at 06:13:01AM +0200, Darko Luketic wrote:
> Hi,
>
> I have limited knowledge of the boot process.
> I'm wondering if the following is possible with systemd.
>
> Imagine you have 2 rootfs partitions.
> You build a new rootfs on a security update or when a new version of a
> listed package that has dependencies is released and extract this on
> either A or B partition (A if B is the current rootfs, B if A is the
> current rootfs)
> The idea is, with systemd you can isolate targets. I assume you could
> shutdown all services so that nothing but systemd is running.
> Then unmount the current rootfs and mount the new rootfs and boot to
> default target.
> All without needing to poweroff or physically reboot the system.
> Only if you install a new kernel a "real" reboot would be required.
> Would this be possible with systemd in its current state?
Sure, read about switch-root in systemctl(1).
> Why? Minimal downtime and if the new rootfs fails for whatever reason
> you could revert to the old rootfs but have a consistent userspace. Or
> you could run a testing system and if the new image reports no errors
> flag it stable and distribute to clients.
>
> And if this is possible, what if... you could shutdown the current
> running kernel and boot a new kernel which would in turn again run
> init and boot targets.
Sure, see kexec in systemctl(1).
Good luck,
Zbyszek
More information about the systemd-devel
mailing list