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.

  • Brad

    awesome work. Anyone know how to set up the pi at a friends house and use the remote feature of crashplan?

  • jonrogersuk

    That’s a good idea, but it sounds like a lot of work – I don’t even know where I’d begin.

  • http://twitter.com/JustinKnotzke Justin Knotzke

    I just wanted to say thanks for doing this.. Worked like a charm.

  • MPW

    Thanks for this post.

    Just a few points:

    1.) You don’t need the whole jre, the openjdk-6-jre-headless is enough. It’s much smaller and quicker to install.

    2.) The libjtux.so linked here in the post does not work for me Raspberry Debian Wheezy 2012-12-16 hard float. Take this one: https://github.com/downloads/swenson/jtux/libjtux.so. The libmd5.so is okay.

    3.) The first start of the CrashplanEngine takes about 15-20 min. Don’t worry.

    The backup runs!

  • MPW

    Hello again,

    I missed one thing: Putting the CrashPlanEngine in /etc/rc.local is not that nice. During the installation, you need to overwrite the default rc-folder /etc/rc.d with /etc/rc2.d. Then Crashplan will start automatically on bootup :). This goes for any debian distribution and it derivates like ubuntu and has nothing to do with the raspby.

    You can then start and stop the Engine with ‘sudo service crashplan start|stop|status’

  • jonrogersuk

    Fantastic comment, thanks! When I get a minute I’ll try to update the instructions to reflect that useful information.

  • http://twitter.com/nitti Tom Nitti

    Worked perfectly for me. Just a heads up to all, the first time you start the engine, it has to generate an RSA keypair, which took about 5-10 minutes on my Pi.

  • Brad Peterson

    An update, I mentioned below how I had a good 1 TB of data from several computers running on mine. It technically worked, but was slow. I found that when it came to restoring files, the performance was *terrible*. On my situation, it was reporting an estimated restore time of 52 days. I “adopted” it on a normal Linux machine, and that restore took 2 hours.

    This performance issue can be fixed. Within the past couple of weeks, Oracle has released an ARM verison preview for Java 8. Apparently the speeds are much better. More info can be found here: http://www.bionoren.com/blog/2013/02/raspberry-pi-crashplan/

    I had to remove my existing java installation (I used sudo apt-get purge openjdk-* icedtea-* icedtea6-*), and removed crashplan (I renamed /usr/local/crashplan), and basically start fresh on an install, but it seemed to do the trick. Speeds initially seem much more tolerable.

  • Spencer

    I use SSH with X forwarding as opposed to headless. To get this to work I had to “apt-get install libswt-gtk-3-java” then “cd /usr/local/crashplan/lib; mv swt.jar swt.jar-ORIG; cp /usr/lib/java/swt-gtk-3.8.0.jar swt.jar” After that is done you can “ssh -Y ” and run “CrashplanDesktop” via X forwarding. For the benefit of Googlers the error before doing this is “Failed to launch CPDesktop; java.lang.UnsatisfiedLinkError: no swt-gtk-3557 or swt-gtk” in ui_output.log.

  • Pingback: Symform final review, ADATA AE400, UR1, WHS 2011 and Server Essentials 2012 on HSS 215

  • StuJordan

    Thanks Jon that’s really useful. Will give it a go.

  • Ambient711

    Just wanted to say thanks to Jon Rogers for this tutorial. It worked after a few trys. I know this was posted awhile so these are some tips that I found worked well (for me). Hopefully they work for other people as well.

    -This tutorial works best if running Headless (at least in my experience). For some reason I started getting issues with a desktop environment running.

    -Copy and paste as many of the commands as possible.

    -Do NOT download the current Linux version of CrashPlan( I believe its 3.5.3), instead use 3.2.1(the one in the commands above).

    -In part 4. the command “tar –xzf CrashPlan_3.2.1_Linux.tgz” probably wont work on the current version of Raspbian. Instead try gzip -d CrashPlan_3.2.1_Linux.tgz THEN “tar -xf CrashPlan_3.2.1_Linux.tar” …worked for me.

    Again big thanks!

    Austin

  • Pingback: Raspberry Pi Home Server: Part 10, CrashPlan | MelGrubb.ToBlog()