I use snapper for my regular snapshots, it works very well but it doesn't do full backups to another location. So, I made a script so I could plug in my external HD, run it as sudo and it does all the commands for sending a backup. It does an automatic time stamp in the snapshot name as well, for easy admin. The main weakness is me remembering to run it often enough but there's no point in running some sort of automation as I keep the external HD unplugged when not in use.
So to explain what it's doing, it mounts the drive in /mnt, takes snapshots with today's date, sends them to the external hard drive, deletes the snapshot on the hard drive and then unmounts from /mnt. As I use snapper, there's no point for me to retain the snapshots on my hard drive.
So to explain what it's doing, it mounts the drive in /mnt, takes snapshots with today's date, sends them to the external hard drive, deletes the snapshot on the hard drive and then unmounts from /mnt. As I use snapper, there's no point for me to retain the snapshots on my hard drive.
Code:
#!/bin/bash mount /dev/disk/by-uuid/YOUR UUID HERE /mnt today=$(date +"%d_%m_%Y") btrfs su snapshot -r /mnt/@ /mnt/snapshots/@_${today} btrfs su snapshot -r /mnt/@home /mnt/snapshots/@home_${today} btrfs send /mnt/snapshots/@_${today} | btrfs receive /media/YOUR BACKUP LOCATION HERE btrfs send /mnt/snapshots/@home_${today} | btrfs receive /media/YOUR BACKUP LOCATION HERE btrfs subvolume delete /mnt/snapshots/@_${today} btrfs subvolume delete /mnt/snapshots/@home_${today} umount /mnt
Comment