/ backup

Backing up Backups

Backups are not backups if you can't restore them. I'm backing up my backups to make sure I always can.

I use HashBackup as my primary backup tool.
My primary off-site destination is currently Google Drive.

Home Internet is slow

I could add a second HB destination directly, but then I have to upload everything twice. Instead, I'm letting Linode handle the extra bandwidth.

Backblaze B2

B2 is my secondary off-site backup because it is reliable and reasonably priced. But it's more expensive than Google Drive, so I will only be using it for critical data, such as family photos.

Copying from Google Drive to B2

Copying is simple and with a single command.
backup-backups.sh:
rclone copy gd:HashBackup/Pictures b2:hb-backup/Backups/Pictures

Let's automate it

The easiest is to run the script in a loop:
while $true; do ./backup-backups.sh; sleep 1h; done
But that's going to use a lot of API calls every hour even though the actual backup doesn't run that often.

To keep things simple, I'm using B2 to send messages between my home PC and Linode server.
At the end of my backup script I added this:

NAME=Pictures
touch /tmp/$NAME
rclone move /tmp/$NAME b2:hb-backup/Msg/new-data

Now in backup-backups.sh:

backups=$(rclone lsjson b2:hashbackup-backup/Msg/new-data --exclude .bzkeep|jq '.[].Name' -r)

if [[ $(echo $backups | wc -c) -gt 1 ]]; then
    for i in "${backups[@]}"; do
        NAME="$i"
        rclone copy gd:HashBackup/$NAME b2:hashbackup-backup/Backups/$NAME
        rclone delete b2:hb-backup/Msg/new-data/$NAME
    done
fi

First, we see if there are any new files in new-data indicating a backup has new data in Google Drive.
If so, we loop through them and copy over new data.
After each copy job is complete, delete the message from B2.

Notifications

Like in my HashBackup example, I am going to send backup reports to Discord so I can keep an eye on them.

Restoring from B2

To restore from B2, we must change our HashBackup dest.conf to point to our backup data.
dest.conf:

destname gdrive // Must have the same name as the original dest
type b2
...

Next, run hb recover
Now we are all ready to restore from our backup's backup.

How do you keep important data backed up?

Backing up Backups
Share this