Skip to content

Transactional chroot maintenance on btrfs #2

@spanezz

Description

@spanezz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions