Crashplan on the Raspberry Pi

Raspberry Pi (photo from Wikipedia)

Raspberry Pi (photo from Wikipedia)

[edit: With a new release of Java 8 for ARM by Oracle, performance can be radically improved – see the post on Bionoren.com – and thanks for telling me about it in the comments, Brad!]

[edit: I’ve updated a few commands that I didn’t get quite right initially, and then a new Linux image for the Raspberry Pi came out, so I’ve updated some more. This all works with the “Raspian” version “2012-07-15-wheezy-raspbian”]

Background:

If you’ve been living under a rock or you have no interest in tech, you may not have heard of the Raspberry Pi, a tiny (pack of playing cards sized) single board computer. It runs Linux, of course – though it can’t run my preferred Ubuntu. It’s not based around an Intel chip like a desktop or laptop (or even one from AMD), but rather an ARM chip more like what’s in a smartphone. This means is uses very little power and generates very little heat, but it does mean it needs different versions of software to what I’m used to.

CrashPlan is my backup software of choice. For me, it’s greatest strength is that it’s cross-platform (i.e. it works just as well on Windows, Mac and Linux) and gives me the choice of backing up between my own computers as well as to CrashPlan’s own servers. I want to have a backup server running all the time so that I’m always able to back up to my own device as well as to ‘the cloud’ – the Raspberry Pi is ideal for this.

With a little bit of hacking, I was able to get everything running fairly easily. Performance looks quite good for now – I haven’t got a lot of new files to back up as I was able to ‘adopt’ a previous backup archive, but I did run a few minutes of files at around 13MB/s over the 100Mb/s network, which seems pretty reasonable to me (about half what I get hooking the drive up directly to my desktop by USB). The server-side maintenance like ‘compacting’ the stored data might be a lot slower – however, this isn’t something I often do, so it should do.

I got most of my information from a post by Hadar Pedhazur on opticality.com about a year ago on getting CrashPlan to work on a Pogoplug, another ARM-based device. That guide uses Arch Linux, which you can use on the Raspberry Pi, but I’ve chosen to use Debian, because it’s more similar to Ubuntu and I value that shred of sanity!

Warning! This post is full of command line instructions! This scares some people! Proceed with caution, don’t blame me for anything that you break by copying (or mis-copying) my instructions!

Set up the Raspberry Pi

  1. Download the latest SD card image from the Raspberry Pi site – this was debian6-19-04-2012 for me. [edit: it’s now 2012-07-15-wheezy-raspbian, make sure you read all the edits for this version.]
  2. Unzip and transfer the image to the SD card – I used dd, for more details look at the wiki page on preloading the SD card
  3. Connect the Raspberry Pi to screen, keyboard and network, then connect power to boot up.
  4. [edit: on your first boot, it will run ‘raspi-config’, a program to help you set up various things. Make sure you know what you’re doing and work through them all.
    Log in (username: pi, password: raspberry)
  5.  Update the software by typing
    sudo apt-get update && sudo apt-get upgrade (this will take a while)
  6. Make the SSH server start when the Raspberry Pi boots (you’ll need this later on) by typing
    sudo mv /boot/boot_enable_ssh.rc /boot/boot.rc [edit: this now happens automatically.]

Install Java

CrashPlan requires Java to work. I had a look at installing Oracle (Sun) Java, but so far OpenJDK seems to work OK. libjan-java stops CrashPlan from taking a very long time to load backup archives according to a CrashPlan support post linked from Opticality.com.

  1. Install Java by typing sudo apt-get install openjdk-6-jdk libjna-java
    [edit: install the JRE, not the JDK – there’s no need for the Development Kit, though it would work, it involves installing extra packages] sudo apt-get install openjdk-6-jre libjna-java

Download and Install CrashPlan

  1. Go to the CrashPlan download page for Linux and copy the link from the grey download button
  2. Type wget and then paste the link you just copied – for me the result was
    wget http://download.crashplan.com/installs/linux/install/CrashPlan/CrashPlan_3.2.1_Linux.tgz
  3. According to the post on Opticality.com, you also need a patched library file to make it all work. Rather than build it yourself, download the one that is attached to that post – patched libjtux.so by typing
    wget http://www.opticality.com/blog/wp-content/uploads/files/libjtux.so
    [edit: if you’re using the Raspian build, you’ll need a different version of this library, download my version of libjtux.so (compiled for armhf following instructions from http://crashbone.wordpress.com/. If you’d rather compile for yourself, the instructions there are very clear.) Type: wget http://www.jonrogers.co.uk/wp-content/uploads/2012/05/libjtux.so and also a second library, libmd5.so, which allows hashing of files for quick comparison of content (also compiled using intructions from http://crashbone.wordpress.com/)  : wget http://www.jonrogers.co.uk/wp-content/uploads/2012/05/libmd5.so ]
  4. Unzip the file you downloaded from CrashPlan by typing
    tar –xzf  CrashPlan_3.2.1_Linux.tgz
  5. Type cd CrashPlan-install
  6. Type ./install.sh to run the installer. You’ll need to accept the defaults to be able to follow the rest of this guide – they’re all pretty sensible.
  7. When it’s done it will say that it started the CrashPlan background service, the one that does the actual backing up. It hasn’t, because we haven’t yet put the file we downloaded earlier in the right place. Type cd /usr/local/crashplan to move to the right directory.
  8. Type sudo mv libjtux.so libjtux.so-ORIGINAL to back up the original file (it’s not essential to back it up, but why not…) [edit: added ‘sudo’ to this command and the following one]
  9. Type sudo cp ~/libjtux.so . (don’t miss out that period at the end. If you downloaded the file to a different directory, you’ll need to type that location instead)
    [edit: do the same as above for libmd5.so:   sudo mv libmd5.so libmd5.so-ORIGINAL
    sudo cp ~/libmd5.so . ]
  10. CrashPlan won’t start at boot by default. Type sudo nano /etc/rc.local to edit the start up script
  11. On the line above “exit 0“, type
    /usr/local/crashplan/bin/CrashPlanEngine start.
    Press ctrl+x to exit, press y to save, press return.
  12. Reboot by typing sudo shutdown now -r

Set up CrashPlan backups

You might think that you could do this using the XFCE desktop environment that comes with Debian for Raspberry Pi, but I didn’t get it to work. You need to use the ‘headless’ setup that CrashPlan themselves explain much better than I could. From there, your backup settings are up to you – attach an external drive, mount it in the right place, set your computers up to back up to the Raspberry Pi. For me, that meant doing the following (of course, it may be different for you):

  1. To find where your disk is connected, run sudo fdisk -l – if you have only attached one disk, it should be last on the list. You need to note the path under the word ‘device’ – it will begin /dev/ – for me it’s /dev/sda1
  2. Make a directory for the disk to be mounted at using sudo mkdir – I used sudo mkdir /mnt/backup
  3. The ‘fstab’ is a table of all the drives or ‘file systems’, you need to edit it sudo nano /etc/fstab
  4. At the bottom of the file, add a new line that looks something like this (though with the information you noted earlier)
    /dev/sda1 /mnt/backup auto defaults 0 0
    You should probably use a ‘tab’ between words rather than spaces, and don’t forget the two zeros
    [edit: I’ve actually done mine using uuid= – you can find the uuid by typing ls -l /dev/disk/by-uuid/ to give an fstab entry like UUID=41bd5b1f-3d55-43cc-8dc6-d7cd05725c2d /mnt/backup auto defaults 0 0]
  5. Mount the disk with sudo mount /dev/sda1 or whatever the correct path you noted earlier was
  6. Change the default path for backups in Crashplan (while it’s connected to the Raspberry Pi as in the instructions I linked to above) to the drive you’ve just mounted by clicking on the Settings tab, then click “Configure” next to “Inbound backup from other computers”, then clicking on the folder icon at the bottom of the pop-up

From there on, you’re really on your own, setting up backup on your other computers to the Raspberry Pi. Good luck!

Coming soon: setting up a SMB server to share files with Windows computers (and my Android phone).

If you’ve got any suggestions or problems with the instructions, please leave a comment below – I’d love to hear from you, even if it’s just to say that it worked for you.