Thinkpad Backup Script
Fast backups #
I have been doing super lazy backups of my thinkpad for a while. I just rsync the whole home folder to my fileserver. That has been working okay, except that now I have a ton of files I'd like to exclude from the backup to speed it up a bit. I'd also like the backup to run periodically in the background.
#!/bin/bash
echo "Hi friend! It's backup time."
sleep 1
echo "Checking exclude file at $HOME/scripts/backup-excludes..."
sleep 1
echo "..."
sleep 1
echo "Backing up /home/brian to file server..."
#copy home folder to file server, minus exclude file:
rsync -aHvzPui --delete --exclude-from='/home/brian/scripts/backup-excludes.txt' --stats --progress /home/brian/ files:/Vault/brian/current
echo "Done!"
Obviously the script is not actually checking anything during the echo messages but that will help to remind me where the exclude file is whenever I run the script manually.
The excludes file is just a txt file that lists Downloads/ and .*
The rsync flags are for archive mode, preserve hard links, verbose mode, compression enabled, Partial progress (resuming), update only if modified date changed, and itemize summary of changes.
I am also using the --delete option, which will delete all files from the destination that are no longer found in the source. I snapshot the fileserver daily with Proxmox Backup Server, so I can recover any deleted files from a previous flieserver backup if I accidentally lose something. This will just be a nice working copy of the laptop.
Since I wrote a ssh config file and I use a key pair to login, I can skip password authentication and use the shortcut address files:/location.
My scripts directory is added to my $PATH so I can execute the script manually by just typing
backup-thinkpad.sh
It works pretty great!
- Previous: ZFS Volblocksize Round 2
- Next: ZFS Fileserver: LXC+Dataset vs VM+Zvol