Wednesday, December 02, 2015

Project: Dropbox Without Dropbox

I've been using Dropbox on and off for many years but lately I find I'm only using it for photo backup from my phone and it's starting to fill up. I don't really want to pay for it so there has to be a better way.

Enter BitTorrent Sync. I've recently got a Raspberry Pi2 so my old Raspberry Pi B+ is up for grabs for a project. I tried the free version of Sync and it looks polished and seems to do what I want. The cherry on top was their 50% off sale for cyber Monday. I jumped on that so I could do selective sync.

I'm not going to say I did this right but it seems to be working for me.



  1. Get a raspberry pi and install raspian. This is very easy with NOOBS as you don't have to do any disk imaging, just put the files on the SD card and follow the prompts. I'm going to assume you have done this before or can work your way though it.
  2. The pi doesn't have a hardware clock so make sure your ntp is working. BitTorrent Sync relies heavily on time so it needs to work. It should get setup on install but for some reason mine didn't. I was missing the ntp.conf file but luckily I could just copy that off my pi2 and I was off to the races.
  3. Install BitTorrent Sync. You'll need the ARM version listed under Linux. There really isn't much to install. Download the archive and unpack it. I put it in /home/pi/Sync. Then run ./btsync and that's it. You can then go to http://localhost:8888 to access the "gui".
  4. To get Sync to run on startup you'll have to add a script to /etc/init.d

    "sudo nano /etc/init.d/btsync.sh"

    Your script can be very simple:
    #!/bin/bash
    /home/pi/Sync/btsync --webui.listen 0.0.0.0:8888 #allows access to webui from other devices

    Make the script executable
    "sudo chmod +x /etc/init.d/btsync.sh"

    Add it to startup
    "sudo update-rd.d btsync.sh defaults"
  5. Add storage. I used a 16GB flash drive. It should provide me plenty of space for phone picture backups. It looks like my photos are around 3MB each so I should be able to backup around 5000 images.

    Plug your USB drive in and format it. Mine already had a partition so I just had to format it. "makefs.ext4 /dev/sda1". Your partition might not be at sda1 so you'll have to adjust the command.

    You'll want it to mount each time on boot up so you'll have to edit your fstab. First find the UUID of your drive with "sudo blkid"

    "sudo nano /etc/fstab"

    Add "UUID=     /media/pi/Sync (or whatever you want the mount point to be)   ext4    defaults   0    2"

    Do a reboot and check if it mounted. "sudo shutdown -r now"
  6. Assuming step 5 worked your drive will mount as root so you'll have to change the owner so you can write stuff.

    "sudo chown pi /media/pi/Sync"

    You can test if this works by trying to make a folder on the USB drive

    "cd /media/pi/Sync
    mkdir photos"

    If the folder is there then it's working.
  7. I'm going to have my Pi at a different location so I setup dynamic DNS on it. I like DuckDNS since it's free and I've been watching them since the idea first hatched on Reddit a few years ago.

    It's easy to setup. Just create an account, create a domain, it'll be something.duckdns.org and it may take a bit to find a free one. Go to their install page and follow the instructions for "linux cron". It basically just makes a cron job that runs every 5 minutes and updates their servers with your IP address.

That's the quick and dirty install. I wrote this mostly from memory so there might be some things missing. The next steps would be to install the sync app on your phone and setup syncing. I've got it setup on a computer at home that's always on, plus the raspberry pi, and my phone. This way I should have the pictures in two places all the time and I'll probably add the location to my Crashplan backup.
Post a Comment