Currently we use an ext for the persistence partition.
This works fine for most cases, but Btrfs makes snapshots and backups easier.
Proposed Layout
The persistence partition contains the following subvolumes.
This layout will be created by dlcopy.
@root contains /
@etc contains /etc
@home contains /home
(@var contains /var)
@snapshots is mounted to /run/lernstick-snapshots (This might change)
Snapshots layout
The snapshot subvolume contains following directories.
minutely
daily
weekly
yearly
A snapshot is named as its source and suffixed with a timestamp.
Snapshot Management
Creating snapshots using the btrfs utilities is quite easy. The current plan is to write a thin wrapper around them and using systemd timers to trigger them.
TODO
[ ] create a subvolume layout
[ ] Include btrfs-progs by default
[ ] Add support for btrfs in dlcopy
[ ] Write own snapshot scripts and package them
[ ] Add a way to restore backups in a user friendly way
Findings
Manually creating a partition works with an unmodified live-boot.
Btrfs cannot create an snapshot of a subvolume/partition if there is an active swapfile on it.
This meas that we cannot snapshot the whole persistence partition because of swapspace.
Having the rw directory as an subvolume works and snapshots can be successfully created.
Btrfs has a feature called seed device which is a simpler form of what we do if overlayfs and squashfs. (But is possibly too limited)
Restoring or booting into a snapshot works by changing the default subvolume to the snapshot.
This is unfortunate because of swapspace (and maybe overlayfs) we cannot change our root subvolume.
Booting a snapshot for non root subvolumes has to be implemented in live-boot.
To exclude files from a snapshot they must be in a different subvolume. This means that all directories that should not be snapshot (like temp or cache directories) must be created as subvolumes.
If we don't use a nested layout and use a structure with @ we need to modify live-boot to mount the subvolumes correctly.
Snapper stores the path where the subvolume is mounted. The persistence partition is mounted at /run/live/persistence/sdX but this is not stable. In our case the we could create a stable mount to the persistence partition or change the config with lernstick-config.
Snapper config could be on it's own subvolume to exclude it from normal /etc snapshots.
Snapper does not work easily with our use case. We would need to provide an easy user interface to browse the different snapshots and snapper-gui is not the solution
Currently we use an ext for the persistence partition. This works fine for most cases, but Btrfs makes snapshots and backups easier.
Proposed Layout
The persistence partition contains the following subvolumes. This layout will be created by dlcopy.
@root
contains/
@etc
contains/etc
@home
contains/home
@var
contains/var
)@snapshots
is mounted to/run/lernstick-snapshots
(This might change)Snapshots layout
The snapshot subvolume contains following directories.
minutely
daily
weekly
yearly
A snapshot is named as its source and suffixed with a timestamp.
Snapshot Management
Creating snapshots using the btrfs utilities is quite easy. The current plan is to write a thin wrapper around them and using systemd timers to trigger them.
TODO
Findings
rw
directory as an subvolume works and snapshots can be successfully created.seed device
which is a simpler form of what we do if overlayfs and squashfs. (But is possibly too limited)/run/live/persistence/sdX
but this is not stable. In our case the we could create a stable mount to the persistence partition or change the config with lernstick-config./etc
snapshots.