Skip to content

Backup and recovery

arnaud gaboury edited this page Nov 27, 2019 · 3 revisions

enl.global filesystem management

Poppy root filesystem is on SSD sdb1; Poppy DB is on a HD sdd3; Poppy extra stuffs are on a HD sdd4; Poppy btrfs snapshots are on another HD sda2.

The snapshots are scheduled every night with systemd-timer.

Btrfs snapshot

A snapshot is simply a subvolume that shares its data (and metadata) with some other subvolume, using btrfs's COW capabilities. Snapshots are not recursive. Every sub-volume inside sub-volume will be an empty directory inside the snapshot. To roll back to a snapshot, unmount the modified original subvolume, and mount the snapshot in its place

To create a snapshot:

# btrfs subvolume snapshot source [dest/]name
# mount -o subvolid=0 /dev/sda1 /mnt/btrfs
# btrfs sub snap /mnt/btrfs/root /mnt/btrfs/snapshots/last-root
# umount /mnt/btrfs

Btrfs recovery

Recovery process: mount the top level of the FS on /mnt/btrfs, manipulate the subvolumes, and then unmount.

# mount -o subvolid=0 /dev/sdb1 /mnt/btrfs
# mv /mnt/btrfs/root /mnt/btrfs/old-root
# mv /mnt/btrfs/snapshots/last-root /mnt/btrfs/root
# umount /mnt/btrfs

Ressources

Clone this wiki locally