freemo
9/11/2019 - 1:12 PM

Backing up with btrfs.txt

Backing up with btrfs

sudo mount /mnt/backup #this should be a btrfs volume
sudo btrfs subvolume snapshot -r / /mnt/backups/root-backup-$(date +%F_%R)

#list all other subvolumes
sudo btrfs subvolume list -p /

#repeat for all subvolumes
sudo btrfs subvolume snapshot -r /home /mnt/backups/home-backup-$(date +%F_%R)
sudo btrfs subvolume snapshot -r /etc /mnt/backups/etc-backup-$(date +%F_%R)
sudo btrfs subvolume snapshot -r /var /mnt/backups/var-backup-$(date +%F_%R)
sudo btrfs subvolume snapshot -r /var/cache /mnt/backups/var-cache-backup-$(date +%F_%R)
sudo btrfs subvolume snapshot -r /var/lib/portables /mnt/backups/var-lib-portables-backup-$(date +%F_%R)
sudo btrfs subvolume snapshot -r /var/lib/machines /mnt/backups/var-lib-machines-backup-$(date +%F_%R)

#optionally show that the snapshot is listed
sudo btrfs subvolume show / 

sudo mount /mnt/usb-backups
sudo btrfs send /mnt/backups/*_* | sudo btrfs receive /mnt/usb-backups