the Andrew Bailey

Improved Backups and Backup Tips

As you know, I'm a vehement supporter of International Backup Awareness Day. You can just listen to my podcast and tell. When the new version of Ubuntu came out last month, I decided to change a bunch of things.

I bought one internal and some external hard drives; all of them have 4TB capacity. The internal one replaces two 2TB ones in my server (one copying to the other). Ever since Mr. Snowden spilled some very important government beans, everyone has been violently reminded that encryption is VERY IMPORTANT. In light of this, I have encrypted the external drives.

I have the one internal drive hosting some file shares on my LAN. I decided that I would try BTRFS for it. For my external drives, I have used LUKS and ext4. It's really easy to set up with gnome-disk-utility. After that, I had to wait about a day for 2.5TB from the internal drive to be shoved through USB 2.0 ports for the initial backup on each external drive.

Because I don't want to physically touch the server more than I have to, I like to ssh into it. I had to research how to mount an encrypted drive from the command line, since most tutorials assume a GUI. As a result, here's what I use to semi-automate the process of things like asking for passwords and dismounting.

#! /bin/bash
echo "disk password first, then login password twice" # because I forget
blockdev=${1:-/dev/sdc1}
device=$(udisksctl unlock -b $blockdev | grep -Po "(?<= as )/[0-9A-Za-z/-]+")
direct=$(udisksctl mount -b $device | grep -Po "(?<= at )/[0-9A-Za-z/-]+")
rsync -aP --del /your/directory/to/mirror/backup/ $direct
udisksctl unmount -b $device
udisksctl lock -b $blockdev

(EDIT 2021: I've updated this, and is available on GitHub.)

It takes an optional parameter for the block device/partition. Yes, I had to regex, and I'm not sure whether I should be proud of it or not. You might also want to man rsync for the buffet of options to suit your needs.

Now I have some spare terabytes to use. As some of you have observed, I like video games. I use Steam for so many of them. I have found a tool that can back up Steam games nicely. And by "nicely", I mean "can't have Steam running while doing it". I haven't tried to restore anything using it, so take it with a massive dose of salt.

I also have the Witcher games. The Witcher 2 launcher loudly states that you can backup your games on GOG.com, but there is no direct link from the launcher, even though that text appears to be placed on a button. So here's the link. Note: this works for both Witcher 2 and 1; just type in your game keys. GOG also has a downloader client to bulk-download everything in your account.

Screenshot of the Witcher 2 launcher, showing a fake button

Google has done wonders to enable you to get your data out of the Googleplex. So for those of you who wish to get a copy of your data before Google kills GMail or disables your account, use Google Takeout. Unfortunately, I have noticed that for shared folders in Drive, it only downloads the documents that belong to you, rather than everything that you can access. You can work around this by selecting the folder(s) in Drive, and downloading manually.

Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it ;)

-- Linus Torvalds

In that spirit, I have uploaded the entire backup of this blog, including raw source images, to Google Drive and made them public. Now everyone can steal my stuff. Have fun!

Posted under Programming. 0 comments.

You can't complain about this anymore. It's perfect!