-
Notifications
You must be signed in to change notification settings - Fork 4
Transactional chroot maintenance on btrfs #2
Description
chroot-login and chroot-maintenance can be made transactional on btrfs by working on a snapshotted chroot, and replacing the production chroot in the end if everything went well.
However, there is no straightforward atomic way to replace a subvolume in btrfs: https://btrfs.wiki.kernel.org/index.php/UseCases#Can_a_snapshot_be_replaced_atomically_with_another_snapshot.3F
However, we can have multiple snapshots per chroot, and use a symlink to atomically update which snapshot is the current one. To get rid of old snapshot, btrfs subvolume delete can be used as a more efficient rm -rf.
In case nspawn-runner does not like to see a symlink as an OS tree, in prepare we can still readlink the symlink and use the target as the OS tree for nspawn-runner.