Last active
February 3, 2023 02:20
-
-
Save freemo/3dbf1c0358d1bf66a077671174b3ed02 to your computer and use it in GitHub Desktop.
Backing up with btrfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment