Backups using bt sync and Raspberry Pi (Part 1 – software)

You have probably heard of the big names in “cloud” file storage. Maybe you use something like Dropbox, Google Drive, or iCloud already. They are all easy to use – once you have installed a small service on your PC and told it what files and folders you wish to store, it takes care of it. You get access to the same files on all the machines you connect, just by placing them in a regular folder.

In fact, this is all so useful that its easy to get “hooked” and to use it so much that you run out of the few free GB of space. If you want more after that, you pay.

There is another way, though. You can get the same benefits and ease of use from free software that synchronizes between your own machines without using any expensive cloud storage. There have been several attempts at this but, for a variety of reasons, none of them have really taken off.

I have been playing with the recently-released BitTorrent Sync. It’s based on the same peer-to-peer software which drives the very successful bittorrent downloads, but reconfigured to provide secure, encrypted network synchronization between your own machines. BitTorrent Sync has some key benefits – it’s reliable, it’s fast, and it’s easy to install on a wide range of machines, even ones with very low specs. At home I have it running on a D-Link DNS-320 NAS box, which only has 128MB of RAM, but still manages to do Windows drive sharing, FTP, serving HD media to my TV and so on as well as running the btsync service.

I decided that I also wanted access to my files at my office, and rather than just buying something, this seemed an ideal opportunity to build one with a Raspberry Pi and some dusty old bits I had lying around.

Writing an SD card for Raspberry Pi

The first step is to get the Pi set up and install the software, to make sure it at least works. To avoid confusing myself, I started with a fresh SD card and downloaded the latest Raspbian and wrote it to the card using Win32DiskImager as described on the official downloads page, then popped it into the Pi, connected an ethernet cable, and powered it up.

As soon as I had logged in I ran sudo raspi-config and expanded the partition. Then I did sudo apt-get update to get the latest software lists and sudo apt-get upgrade to ensure I had the latest of everything. Now to install and run the btsync software.

The BitTorrent Sync software is conveniently available as pre-built executables for a variety of architectures, including the ARM CPU used in the Raspberry Pi. While I was writing this the BitTorrent sync web site was undergoing some changes, so you may need to poke around a bit, for example when I started this, the ARM version of btsync was easy to find, but now everything seems to keep redirecting me to the Windows version. With this in mind, the following steps worked for me.

wget wget 
gunzip btsync_arm.tar.gz
tar xvf btsync_arm.tar

You should now have two new files, btsync (the executable) and a text file. To start the btsync service, simply run the executable. It will check its pre-requisites and if everything is in place, start a background (daemon) service. You should see some output like:

BitTorrent Sync forked to background. pid = 2358

Your pid will be different, of course.

To test to see if it works, you will need to know the IP address of your Raspberry Pi. If you don’t already have this to hand, you can type ifconfig eth0. This will tell you all wbout your ethernet connection, giving something like:

eth0      Link encap:Ethernet  HWaddr b8:27:eb:8d:7b:4e
          inet addr:  Bcast:  Mask:
          RX packets:7260 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6754 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9131927 (8.7 MiB)  TX bytes:614349 (599.9 KiB)

The important bit is the second line where it says “inet addr:”. The four-part number which follows is your IP address (in my case

Now you need to find a browser on another machine connected to the same network. I’m guessing this will be the machine with the stuff to be backed up. Go to: http://ip-address:8888/gui. This should bring up a sparse but functional UI:


You may also get a “pop up” asking you to agree to the usage terms. I agreed, in order to continue, but ultimately its up to you. If you are at all concerned or interested, I always recommend you read what you are considering agreeing to.

At this point you could start synchronizing, but the only storage we have to hand is the SD card which is (a) small, (b) relatively slow, and (c) will wear out if we use it too much. So I plan to connect the pi to a usb hard drive for data storage. I will cover that next time, but in the meanwhile, I suggest you read about BitTorrent Sync, and how to install and run the service on whatever machine you wish to backup data from.

One Comment

  1. Pingback: Backup solution using the #RaspberryPi and BitTorrent Sync | Raspberry PiPod

Leave a Reply

Your email address will not be published. Required fields are marked *