Author: Eiko

Tags: btrfs, subvolumes, snapshot, grub, grub-btrfs

Time: 2024-09-10 16:35:23 - 2024-09-10 23:20:08 (UTC)

Nested subvolumes

  • snapshotting is not recursive, nofiles in the nested appear in the snapshot.

  • a subvolume or snapshot is a barrier, so nested subvolume layout can be used to achieve fine grained control on what is being rolled back.

  • there are mount options like noatime, ro (read only), rw (read write), and you can mount a rw snapshot as read only.

integration with grub

Install grub-btrfs package

sudo pacman -S grub-btrfs

edit the config file

sudo -E systemctl edit grub-btrfsd

if you use timeshift, you should change the command line accordingly.

sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo systemctl enable grub-btrfsd --now

Create and restore snapshots

sudo btrfs subvolume snapshot -r / /@snap
# -r for readonly
sudo btrfs subvolume delete /
sudo btrfs subvolume snapshot /@snap /

Auto-snap capabilities

There is a package in aur called timeshift-autosnap, which will automatically create snapshots upon system update.