Raspberry pi 2 btsync network

Use Raspberry Pi 2 and BitTorrent Sync to create a remote backup for all your devices – similar to Dropbox but keep all you data on your devices – not on the cloud.

Raspberry Pi 2 BtSync remote Backup & Sync

BtSync is great for syncing folders across devices. It does it with out using the cloud but for it to work,  the devices need to be online.  This is where the Raspberry Pi comes in. With it’s low power usage, the Raspberry Pi is an ideal device to use with BtSync as an always on private and secure remote backup. Find out more about BitTorrent Sync at www.getsync.com

This solution is ideal if you dont like storing data on the web or some cloud service but want to have a remote back up / remote Sync of all your family pictures. i.e. Share folders and files across locations / devices / operating systems.

Overview :

  • Download the latest Rasbian
  • Prepare a SD / Micro SD card to receive the downloaded Images.
  • Un compress and Transfer the downloaded Raspbian Image to the SD / Micro SD card.
  • Install Raspbian.
  • Configure Raspbian for a static network.
  • Connect and Automount a HDD for storing data
  • Install BtSync
  • Configure a Backup folder on your HDD for backups.

Time and Difficulty :

  • Time : Between 15 and 20 mins  once you have the Raspbian Image file and the rest of the software.
  • Newbie Difficulty level :Easy ; Will need to use terminal and type in commands.

What you will need :

  • Raspberry Pi 2 Model B or one of its clones like Banana Pi M1 or M2 or Banana Pro
  • Ethernet connection or a supported USB Wifi adapter for the Pi
  • SD or Micro SD Card that fits into your Pi (4GB or above is recommended)
  • USB Keyboard and Mouse or Enable and SSH into the Pi from a PC
  • Connection to a TV or Monitor (if you are not going to use SSH)

You should seriously consider :

  • Reading about BitTorrent sync and the technology / security used to keep your data secure
STEP 1 : Install Raspbian
  1. The easiest way to install Raspbian is goto the Raspberry Pi downloads page and and download Noobs.
  2.  Follow the steps described in the Noobs setup Guide to get your Rasbian running. In the initial setup page, Select Raspbian and avoid the rest of the options for this project. The default login and password are “pi‘ and “raspberry” respectively.
  3. Change the default password of the Pi during the first boot sequence in the Raspberry Pi configuration menu.  You can always go back to the Pi configuration menu by typing in ‘sudo raspi-config‘ at the command prompt.
  4.  Complete the Setup, restart the Pi with a ‘ sudo reboot‘ command.
STEP 2 : Give the Pi a static IP address

By default, the Pi is set to ask for a dynamic IP address from the router. You will need to change this setting to a fixed IP address since you will be hosting a webpage on the Pi and need the address to be fixed.

Assigning a Static IP address to the Pi can either be done at the Router level (which is fairly easy but the steps to do this are router’s model and brand specific) or at the Raspberry Pi level (outlined below).

Note :  replace the x in the lines below with what appears on your screen as you type in the commands.

Log on Raspbian and enter the following commands at the terminal :

  1. ifconfig” (ifconfig displays details of your current network connection )
  2. Write down the values next to inet add:192.168.x.xxx. These numbers is the IP address that your Pi is currently at.
  3. Also write down the Broadcast Range (Bcast) and Subnet Mask (Mask) that appear next to the inet add.
  4.  To get information from your router, type in “sudo route -n“.  This will give you the gateway and destination values.
  5. Write down the Gateway = 192.168.x.x & Destination = 192.168.x.x

We have now obtained all of the data that we need to setup our Raspberry Pi with a static IP address, it’s time to save it to a config file.

Type in “sudo nano /etc/network/interfaces”  ( nano is a text editor and will open the file interfaces located in the folder /etc/network)

In nano, look for the the line that reads “iface eth0 inet dhcp”. This line is telling the ethernet “eth0” networking interface to use “dhcp” (dynamic IP). Firstly, replace “dhcp or manual” with “static”.

Next , add the following lines directly below the line you just altered, with the data you had written down earlier.

address your.chosen.IP.address
netmask your.netmask
network  your.destination
broadcast your.broadcast.range
gateway your.gateway

The file should look something similar to the image below :

staticip

Save your file and exit out of nano by pressing ctrl+x

Reboot your Pi by typing in “sudo reboot

Once rebooted, your Pi will be on a static IP address. Crosscheck this by typing in “ifconfig” again.

STEP 3 : Connect and Auto Mount a HDD 

Follow the steps given here to Automount a USB HDD.

Recommend connecting the native Linux format EXT4 / EXT3 format  HDD.

Depending on the file permissions, you may need to use “sudo chmod 777 -R /mnt/data/sync”  (where sync is the target sync folder created in the USB HDD which mounted at /mnt/data.  The chmod command with a setting of 777 and -R , recursively, gives all users read and write  access to the sync folder )

STEP 4 : Install and Configure BitTorrent Sync

Log in to Raspbian and enter the following commands with out the quotes  :

  1. sudo apt-get update
  2.  “sudo apt-get upgrade
  3.  “sudo apt-get dist-upgrade

The steps above will update the software and the raspbian distribution to the latest available.

To install BitTorrent Sync on the Raspberry Pi, at the Console, Enter :

sudo nano /etc/apt/sources.list.d/btsync.list” ( Use nano the word editor to create a file called btsync.list )

Inside, nano, enter the following lines :

deb http://debian.yeasoft.net/btsync wheezy main contrib non-free
deb-src http://debian.yeasoft.net/btsync wheezy main contrib non-free

Press “Ctrl+x” to exit nano and save changes by pressing “Y

Next, Import the repository’s signing key with the following commands :

sudo gpg –keyserver pgp.mit.edu –recv-keys 6BF18B15
” sudo gpg –armor –export 6BF18B15 | sudo apt-key add –

Once the keys are added, enter “sudo apt-get update” to refresh sources.

Install BitTorrent Sync entering “sudo apt-get install btsync” and follow the screen shots :

Choose "Yes"
Choose “Yes”

Choose the default "btsync"
Choose the default “btsync”

Choose "default"
Choose “default”

Choose a niceness level of "0"
Choose a niceness level of “0”

Do not bind interfaces for now

Do not bind interfaces for now

Set it to listen on the default port 8888
Set it to listen on the default port 8888

Click on NO for enable only SSL
Click on NO for enable only SSL

Leave /mnt as the default mount path
Leave /mnt as the default mount path

BtSync will finish installing with all the parameters
BtSync will finish installing with all the parameters

You can return to the configuration menu by entering “dpkg-reconfigure btsync

Your Pi is now running BtSync and is ready to start syncing files and folders.  To log into the web interface, from your PC, enter the IP address of the Pi and Port 8888 (eg 192.168.1.10:8888). You will be asked to create a Username and Password.

192.168.X.XXX:8888  (Pi's ipaddress and port 8888)
192.168.X.XXX:8888 (Pi’s ipaddress and port 8888)

Choose a name to identify your Pi
Choose a name to identify your Pi

Your Raspberry Pi BtSync is now ready
Your Raspberry Pi BtSync is now ready

You Pi is now ready to Sync. Add a folder on your HDD and install BtSync on your PC or Phone. Your Pi can now run securely in a remote location and all your data in the shared folders will be backed up  securely.

 

 

7 thoughts on “Raspberry pi 2 btsync network”

    1. Hey Rudi, Could it be that just the screen is going to sleep and pi hums along doing its thing ? The easiest way to disable to the screen from going to sleep is install xscreensaver and the disable screensaver. hope this helps 🙂

  1. Thanks for this. Works fine.
    But there are some bad characters in:

    sudo gpg –keyserver pgp.mit.edu –recv-keys 6BF18B15“
    ” sudo gpg –armor –export 6BF18B15 | sudo apt-key add –“

    It has to be :
    sudo gpg –keyserver pgp.mit.edu –recv-keys 6BF18B15“
    ” sudo gpg –armor –export 6BF18B15 | sudo apt-key add –“

  2. How do i find my sync folders on my raspberry pi after install? I’ve added some folders through the GUI and now that I want to delete them I can’t find the directories on my pi.

Leave a Reply