Skip to content

Instantly share code, notes, and snippets.

@dolohow
Created February 19, 2021 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dolohow/a9d4be1f1259801de25a86cfff313a5d to your computer and use it in GitHub Desktop.
Save dolohow/a9d4be1f1259801de25a86cfff313a5d to your computer and use it in GitHub Desktop.
btrfs snapshot + rsync backup
#!/bin/bash
# Run
# chmod +x full_system_backup.sh
# touch full_system_backup_exclude
# ./full_system_backup.sh SSH_REMOTE
btrfs subvolume snapshot -r / /mnt/snapshot
mount --bind /boot /mnt/snapshot/boot
rsync -aASvPzz --delete --numeric-ids --delete-excluded \
--exclude-from=full_system_backup_exclude \
/mnt/snapshot/ $1
umount /mnt/snapshots/boot
btrfs subvolume delete /mnt/snapshot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment