Securely and remotely backup your server using Tarsnap
Tarsnap is only $0.25 / GB-month for storage and $0.25 / GB for bandwidth, which is extremely affordable. You can add funds to your account whenever you like, which is also very nice. Your initial fund deposit must be at least $5. You can signup for a Tarsnap account here.
Installing it on a stock Ubuntu 14.04 LTS installation requires some additional steps to get everything working nicely.
1. Install dependencies
sudo apt-get install build-essential ext2fs-dev zlib1g-dev libssl-dev
2. Install Tarsnap
Download Tarsnap, I do it like this with wget:
wget --no-check-certificate https://www.tarsnap.com/download/tarsnap-autoconf-1.0.35.tgz
Now we need to extract, configure, and compile Tarsnap.
tar xfz tarsnap-autoconf-1.0.35.tgz cd tarsnap-autoconf-1.0.35 ./configure sudo make install clean
3. Configure Tarsnap
First, copy the example config to the live config:
sudo mv /usr/local/etc/tarsnap.conf.sample /usr/local/etc/tarsnap.conf
If you receive an error with that command, like
mkdir: cannot create directory , ignore it and continue on.
Next, we need to generate a tarsnap key for your machine. I like to keep my tarsnap key in my home directory, so I run something like this:
mkdir ~/.tarsnap tarsnap-keygen --keyfile /home/youruser/.tarsnap/tarsnap.key --user [email protected] --machine your-machine-name
You’ll be prompted for your Tarsnap password when running
Now, edit the
sudo pico /usr/local/etc/tarsnap.conf
Point the keyfile directive to the key file we created a couple steps ago. The top of your tarsnap.conf file should look similar to this now:
### Recommended options # Tarsnap cache directory cachedir /tmp/tarsnap-cache # Tarsnap key file keyfile /home/youruser/.tarsnap/tarsnap.key
4. Use Tarsnap to Make a Backup
You’ll want get familiar with the Tarsnap manpages. To create your first archive, with a name of servername-20140805, do this:
tarsnap -c -f servername-20140805 /home/youruser
That will backup the /home/youruser folder to Tarsnap! Depending on the size of the backup and speed of your connection, it could take quite some time to finish the backup.
I’ve only tested this on DigitalOcean VPS’s running Ubuntu 14.04 x64, but it should work on most Ubuntu variants.
Did I miss something or get something totally wrong? If so, please let me know, the comments are open!
Well, now what?
Work with Me
I'm available for hire and always taking new clients, big and small. Got a project or an idea you'd like to discuss? Startup plan but no developer to make it happen? Just get in touch, I'd love to see if I can help you out!
Leave some Feedback
Got a question or some updated information releavant to this post? Please, leave a comment! The comments are a great way to get help, I read them all and reply to nearly every comment. Let's talk. 😀