WD MyPassport Wireless with BitTorrent Sync

SD-card backups in the field as well as automatic upload to your NAS whenever you have an internet connection? Yes it can be done with Western Digital MyPassport Wireless and BitTorrent Sync!

In the past I have always uploaded the footage from my GoPro and compact camera via my laptop in the hotel rooms (or where ever I can find an internet connection). I wanted a more streamlined process and an easy way to empty an SD-card in the field. The MyPassport Wireless takes care of the first problem out of the box. With a built in SD-card reader you can move all content on an SD-card to the built in hard drive. Just set it up to do an automatic copy as soon as an SD-card is present in the reader and it will dump everything to disc.

I also wanted to make an “of site” backup whenever possible. I have been setting up a geo-location backup built on BitTorrent Sync so I already have those servers in place. Since the MyPassport Wireless is ARM based, like a Raspberry Pi, it’s pretty straight forward to setup BtSync on this device. It also has built in support for accessing wifi hotspots and connect to the Internet. This can be done via the mobile app. So this guide will give you the following functionality:

  • Dump SD-cards to a hard drive just by carrying the small WD MyPassport Wireless
  • When ever it’s conected to the Internet it will start to sync all the new data to your BitTorrent Sync servers.

I’m not sure what the WD warranty would say about this so you do this on your own risk. There is no package manager installed on the MyPassport Wireless so it all have to be done manually. I’m making no claims that this is the best way to do it but I have been testing it out for a while now and it works great so far.

Setup an internet connection

After connecting to the MyPassport Wireless wifi hotspot you can access the UI, usually on https://192.168.60.1. In the web UI, under Wifi, you can setup a connection to another wifi. This will allow the Passport to access the internet as well as share that internet connection with all connected clients. To be able to install, configure and test BitTorrent Sync we need an internet connection. It does, unfortunately, only support 2.4Ghz networks but that will be good enough for this implementation. In the example below my Passport has a wifi named “PLUTO” and is connected to a wifi, with internet access, named “quicktest“.

wifi_internet

Enable SSH

We also need SSH access to the box. In the web UI under Admin you can enable SSH.

admin_access_ssh

SSH into the box (default root/welc0me). You can change this but I went with the option to leave it as is and just disable the SSH access when done. When you first login you will have a shell. Run bash -l to get the regular bash shell. The -l switch will make bash behave as if it was the shell invoked as login shell.

Install Bittorrent Sync

The space for installed apps and configurations are limited. In my first run of this I made an install on the built in storage and it worked fine but it was cutting it to close to running out of space. So when I did a new install I created a folder in the /DataVolume. A word of caution here is that the folder will be accessible over the Public share on the MyPassport Wireless and you have to be careful not to remove it or change any files. So we create a folder and move into it:

[bash]mkdir /DataVolume/btsync
cd /DataVolume/btsync[/bash]

Then we need to download the latest ARM binary from getsync.com. Under the link View other platforms you will find a link for ARM. I usually just right click in Chrome and use the inspect option to get the URL for the binary. In this case: http://download-cdn.getsync.com/stable/linux-arm/BitTorrent-Sync_arm.tar.gz

So we download and unpack BitTorrent sync and then remove the packed file.

[bash]wget http://download-cdn.getsync.com/stable/linux-arm/BitTorrent-Sync_arm.tar.gz
tar -zxvf BitTorrent-Sync_arm.tar.gz
rm BitTorrent-Sync_arm.tar.gz[/bash]

Then we can give it a test run:

[bash]# ./btsync –webui.listen 0.0.0.0:8888
By using this application, you agree to our Privacy Policy, Terms of Use and End User License Agreement.
https://www.getsync.com/legal/privacy
https://www.getsync.com/legal/terms-of-use
https://www.getsync.com/legal/eula

Webui is listening on 0.0.0.0:8888
BitTorrent Sync forked to background. pid = 28602[/bash]

Now you can try browsing to the BitTorrent webui: https://{name or ip of the WD}:8888

As long as you see that working you know it’s all good and we can start the configuration. First we need to kill the process, just run:

[bash]killall btsync[/bash]

Create config file

We need to dump out a config file that we can run the instance from and make sure that all configuration changes we do in the UI sticks. There is a built in command in BitTorrent Sync for creating an example config file.

[bash]/DataVolume/btsync/btsync –dump-sample-config > /DataVolume/btsync/btsync.conf[/bash]

If you know how to configure BitTorrent Sync you can use nano to change settings in the file. If you ever need to edit this manually make sure to kill the btsync daemon first.

Setup daemon auto start

We also need to make sure that the system will autostart when the MyPassport Wireless is turned on. To be able to do that we first need to create an init.d script.

[bash]nano /etc/init.d/btsync[/bash]

Below is a very simple init.d script. It can be done with more advanced features but this has worked just fine so far for me.

[bash]#! /bin/sh
# /etc/init.d/btsync
#

# Carry out specific functions when asked to by the system
case "$1" in
start)
/DataVolume/btsync/btsync –config /DataVolume/btsync/btsync.conf

;;
stop)
killall btsync
;;
*)
echo "Usage: /etc/init.d/btsync {start|stop}"
exit 1
;;
esac

exit 0[/bash]

We make the script executable and set the correct permissions on it.

[bash]chmod 755 /etc/init.d/btsync
chown root:root /etc/init.d/btsync[/bash]

Then we need to use this script to start and stop the btsync daemon whenever the MyPassport Wireless is turned on or off.

[bash]nano /etc/inittab[/bash]

Find the line below:

[bash]# now run any rc scripts
::sysinit:/etc/init.d/rcS[/bash]

Just below it we add the line below to make btsync start when the MyPassport Wireless is turned on.

[bash]::sysinit:/etc/init.d/btsync start[/bash]

Then we find the line below:

[bash]# Stuff to do before rebooting[/bash]

There we add the line below to shutdown the btsync daemon when we turn the MyPassport Wireless off.

[bash]null::shutdown:/etc/init.d/btsync stop[/bash]

Now just save and exit this file and issue a restart command to see that it all works.

Additional config

Now you can access the webui and change the settings.

add_config_general

Change the default folder to /DataVolume so you don’t accidentally fill up the file system with stuff. Then you can go ahead and share any folders you like. In my case /DataVolume/SD Card Imports, I then copy the read only code and apply it to my Bittorent Sync server at home. Whenever I connect the the MyPassport Wireless to the internet it will start syncing your files to your other server.

Tips & Trix

To make sure you get a connection you should tick the Use relay server when required option in the folder options. This will make sure you get a connection even if both your servers are connected to the internet behind NAT devices. I prefer to have a DynDNS name setup for my home server and add that as a Predefined host to make sure a have a direct connection. The relay server will give you a connection but it will bot be “peer-to-peer” and it will reduce the speed.

Please share and let me know in the comments below what you think!

 

16 Comments on “WD MyPassport Wireless with BitTorrent Sync”

  1. Hello, thank you for your tutorial. Just finished the installation (yet to test the sync speed) with zero unix/linux experience. As btsync is getting less feature for the free version user. Have you thought about switching to Syncthing and make a new tutorial how to remove Btsync and install Syncthing on this device? Once again very interesting to read about the hacking of this small device and rest of the project/Tips on this site.

    Greeting Terry

    Like

    • Hi Terry,

      At this point I have been running tests with syncthing on other devices. There is a post about it and my thoughts. At this point I feel that syncthing is much to unstable for my implementations and that the free version of btsync is both stable and fill my needs.

      Thanks for the feedback! Always appreciated!

      /Kris

      Like

  2. Hello Kris, thank you for the reply I have read the other post you mentioned. I understand your point of view. I hope one day syncthing will be mature enough, as I see more and more people are looking into it. Hope that will get the ball rolling.

    Greeting Terry

    Like

  3. Hi Kris, do you know any option to install Bittorrent in this device? Any place to find valid precompiled binaries? Thx!

    Like

    • Haven’t tried it my self but I can’t see why not. Depending on what client you want just there are a number of different places to download from. Aim for the official repository for the software if your worried about dodgy builds.

      Like

  4. Hi… I got btsync to work on a WD wireless Pro. but it cannot auto start. Any Ideas of where I could start to look for the problem.

    Like

    • Double check that the init.d script works to stop and start the service with from the CLI. If not look at what ever error is thrown. To check what’s happening during boot look at the logs. So start with testing the process manually step by step to verify that all the components work then check for any errors thrown after reboot.

      Like

  5. Okay… I’ve checked manually from CLI each step and it works. I can get the the message logs but there is nothing in there on btsync. Is there another way to auto start in busybox besides putting a script in inittab? Sorry I’m a linux noob.

    Like

    • You have very limited options due to the slimmed down linux version on the device. That is the only good way I found so far. Have you checked all the logs in \var\log? It can be in the system message log as well.

      Like

  6. this is the only entry I found on the message log file that has to do with btsync –

    Dec 26 01:02:00 MyPassport daemon.warn kernel: [ 3.632532] systemd-sysv-generator[1098]: Overwriting existing syml$
    $g symlink /run/systemd/generator.late/btsync.service with real service

    Like

  7. Did anyone manage to ever get it autostarting on a Pro? I’ve tried literally everything I can think of, including trying to start crond and set it up as a cron job, and I’ve failed miserably. This serious limits the utility of the device. The lack of any sort of syslog is really making it hard to find out wtf is going on.

    Like

  8. @varun

    Did you have any luck? I ended up just using a terminal program on my iphone to turn it on and off when I needed. which is a pain but I could not get auto start to work.

    Like

  9. @varun

    I got it to auto start but it’s a hack. I added a line into /etc/init.d/S99confchk
    “/etc/init.d/btsync start” before “source /etc/system.conf”
    It’s the last “S” script that the passport pro uses during startup

    I know it’s not the right way but it does work. Dirty but it does work.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: