Raspberry Pi & BitTorrentSync for dummies like me

By 24/01/2014October 13th, 2020Computers, Platform

I finally found time to do something worth with my Raspberry Pi.

I had already installed BitTorrentSync in a couple of computers. BitTorrentSync allows you to synchronize folders between all your devices like Dropbox, but the data are not stored in the cloud. If you have concerns about privacy, this is the definite tool.

But be aware, unless you synchronize with a remote PC you are fully exposed to data loss due to a fire at home.

The great thing about Raspberry is that power consumption is low to be able to have it always on, so all your devices can synchronize immediately with your Raspberry HDD. You don’t have to wait anymore for the two PCs to be on at the same time, for example.

Raspberry Pi

Well, let’s do a step by step walk-through over the process I used to install it, for dummies like me.

First the sources. I took all knowledge from the following articles where more details can be found, though not repeating again:

First,

How to add the HDD

Generally Raspberry autodetects HDDs. For better performance it is recommended to format the disc to EXT4.

First find how your disk appears with this command

df -h

It is usually /dev/sda1. With the mount command you can also retrieve the list of mounted units.

Now you will have to format the disk, replace “sda1” by yours:

sudo mkfs.ext4 /dev/sda1 -L untitled

“untitled” is the disk label, in my case I don’t care. If you have problems when you run it try to first umount (check below).
If you have to mount the disk you will need to create a folder where to mount it. We will call it “mydisk” in the example.
sudo mkdir /mnt/mydisk

Then you can mount the disk
sudo mount /dev/sda1 /mnt/mydisk

And now you can use /mnt/mydisk as an additional drive. Create folders, copy files, etc.
If you have to shutdown the Raspberry it is recommended to unmount the unit

sudo umount /dev/sda1

If you have a NTFS disk and you don’t want to format it because you have data already, there is an option described in the first link of the list. But it makes sense to have a disk fully dedicated to the Raspberry, so format it in EXT4!

You will also want that the disk gets mounted in the folder every time you reboot, you can do it by registering it in /etc/fstab. Let’s edit it to add our unit.

sudo nano /etc/fstab

In our case we only have to add a line in the end (use tabs in between)
/dev/sda1 /mnt/mydisc ext4 defaults 0 0

If after this you apply sudo mount -a you will mount all the units referred in the file /etc/fstab.

Now we have a disk,

Let’s go for BitTorrentSync

[Update 2020: this part is no longer valid since BitTorrentSync is no longer available. Install SyncThing instead]

To install it you need to download the ARM version with these commands

mkdir ~/.btsync && cd ~/.btsync
wget http://btsync.s3-website-us-east-1.amazonaws.com/btsync_arm.tar.gz
tar -xfv btsync_arm.tar.gz

And now you only need to run the app
cd ~/.btsync
sudo ./btsync # can be killed with `sudo killall btsync`

You should get a message BitTorrentSync forked and a pid. Everything ok.

And now you only need to add the folders to synchronize. Open your browser in the IP address of your Raspberry and port 8888.

IP_RASPBERRY:8888

You will see an option to synchronize folders. Choose anything you want within /mnt/mydisk
If you already have a secret form another computer, paste it here, if not just generate a secret and keep it. You will have to add it in the computer you want to synchronize with.
All set. You can create several folders and synchronize them, independently and in addition you can decide which devices synchronize with which folders. Up to you!

I missed one step, how to modify the config to have the program run at boot. There is an explanation in the fourth link.

I hope this has been useful, if not you always have the links I posted for more details.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.