Clone Dropbox with a Raspberry Pi and BTSync
After constantly hitting my Dropbox space limit, I decided to build my own distributed backup tool. What I ended up with was an external hard drive with a dedicated Raspberry Pi that keeps in sync with my laptop over the internet using BitTorrent Sync. This new BTSync folder fully replaced my Dropbox folder, and allowed me to streamline my large media backups. I've explained every step of the build below.
Recommended Hardware
These are the items you'll need if you want to duplicate what I've built. If you're building more than 1 node, I highly recommend you buy different brand external hard drives (eg. 1 Western Digital, 1 Seagate, etc). Even different models should be sufficient. If it turns out one goes bad after a year, chances are the second won't die as well.
- Raspberry Pi, case, SD card, power cable, etc
- Edimax EW-7811Un Wifi Dongle
- 1-foot Micro USB 3.0 Cable
- Any size / brand external hard drive. Preferrably USB 3.0
Install Raspbian
Grab the latest version of NOOBS (New Out of Box Software). NOOBS makes it easy to get the Raspbian OS up and running on your Raspberry Pi, along with setting some basic config options. Once you have it downloaded, copy the contents of the zip onto a freshly formatted SD card (FAT filesystem).
Once you boot up your Raspberry Pi with this SD card and install Raspbian, you'll be given a few more options. These are the settings I usually change, but you should also look around yourself to see what's available.
- Enable SSH
- Set the overclocking level to mild
- Configure a unique hostname
For more detailed setup instructions, check out the installation readme included in the downloaded zip archive.
Fix the Keyboard Layout
If you're using a USB keyboard, you may notice that some of the characters aren't being entered correctly. To switch your keyboard layout from the default of English (UK) to English (US), you can follow the simple instructions after running this command.
sudo dpkg-reconfigure keyboard-configuration
Connect to WiFi
Assuming you've turned on your Raspberry Pi with the wifi dongle inserted, you can move onto configuring the wifi connection. You may want to give it a fixed IP address to make connecting to it from another machine easier. You'll find it is much quicker to SSH into the device rather than hook up a keyboard and monitor every time you want to tweak something.
Connect the External Drive
I haven't had any issues with disks formatted using ext3 or ext4, so using one of those for your external disk is recommended. You can use sudo fdisk -l to find the path of the disk (probably /dev/sda1), which you'll need for mounting. Here's how to mount it. Don't forget to change ext4 below to whatever you used.
sudo mkdir /media/external_disk
sudo mount -t ext4 /dev/sda1 /media/external_disk
Once you verify that works and you can access your files on the disk (if any), you should be able to add the disk to /etc/fstab by adding a new line like this
/dev/sda1 /media/external_disk ext4 defaults 0 0
Now when you boot your Raspberry Pi, the external drive should automatically mount.
Install BTSync
Finally you'll want to download and install BTSync. Be sure to also follow the instructions to make BTSync start on startup too, so you don't need to manually start it every time. Once it's installed and running, you should be able to configure it from any machine by pointing the browser to the Raspberry Pi's IP and port 8888 (eg http://10.0.0.12:8888). It is a good idea to go into the options and set a password for this page.
Lots of Data
The reason I started this project in the first place was because I had over 1TB of pictures and videos I wanted to keep synced across 2 hard drives in 2 different cities. While creating two nodes has done the job, I am still working on the best way to access the data without disconnecting the drive from the Raspberry Pi every time I want to add/remove something. I think my next step will be to run a samba server on each device as well, so I can treat them as network drives and access everything. FTP is also an option. What are your thoughts?
Taken From: http://reustle.io/blog/btsync-pi
2 comments:
thanks for sharing information,good blog..
Passive Networking
Structured Cabling
thanks for sharing information,good blog..
Passive Networking
Structured Cabling
Post a Comment