Uncategorized

BTSync with Orange Pi

This is a work in progress…

BTSync (now known as Resilio Sync Home) is a fantastic tool for syncing files between devices.  Here’s my diary on installing it onto a little Orange Pi One running Armbian.

First download the Armbian image and copy it to an SD card using Win32 Disk Imager.  Install as recommended setting a root password and sudo user.  Once set up you can use Putty to access the device.

I’ve found it simplest to use windows to prep the USB drive.  Plug it in and use DISKPART – select the partition and use CLEAN.

Once cleaned format the drive NTFS.

Remove the drive and plug it into the Orange Pi.  Ensure it’s working using lsblk:

root@orangepione:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 3.7T 0 disk
├─sda1 8:1 0 128M 0 part
└─sda2 8:2 0 3.7T 0 part
mmcblk0 179:0 0 14.5G 0 disk
└─mmcblk0p1 179:1 0 14.3G 0 part /

With the disk formatted we can mount it. First create a folder in /mnt – I’ll use windrv (since we want to read it ultimately in Windows):

mkdir /mnt/windrv

Then mount it using mount:

mount -t ntfs-3g /dev/sda1 /mnt/windrv

If this was successful we can add it to /etc/rc.local (I was having problems with /etc/fstab – seems the drive may not be ready when fstab loads)

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

mount -t ntfs-3g /dev/sda2 /mnt/windrv

exit 0

Next we can install Samba for sharing folders:

apt-get install samba

This will take a little while. Once installed we need a user for BTSync, create one and give it a password:

root@orangepione:/dev# adduser btsync
Adding user `btsync' ...
Adding new group `btsync' (1001) ...
Adding new user `btsync' (1001) with group `btsync' ...
Creating home directory `/home/btsync' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for btsync
Enter the new value, or press ENTER for the default
        Full Name []: btsync user
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y

Create a folder to share in /mnt/windrv – I’ll use Video:

mkdir /mnt/windrv/Video

With the drive mounted and Samba installed we can now add a share to Samba. Edit /etc/samba/samba.conf and add to the bottom of the file:

[Video]
   comment = Video Share
   path = /mnt/windrv/Video
   available = yes
   browsable = yes
   guest ok = yes
   read only = yes
   write list = btsync
   create mask = 0755

This will create a share with guest read only and write access to btsync. Reload the Samba service:

service smbd restart

And then test in Windows in a file explorer to \\192.168.xxx.xxx\Video.

Now we need to install Resilio Sync. First add the repository to the list:

vi /etc/apt/sources.list
deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free
~

Then add the Resilio key so we can install packages – change to the tmp folder first as the key is not necessary once done:

cd /tmp
wget https://linux-packages.resilio.com/resilio-sync/key.asc
apt-key add key.asc

Install Resilio Sync:

apt update
apt install resilio-sync

Start Resilio Sync and set it so it autostarts:

systemctl start resilio-sync
systemctl enable resilio-sync

All should now be working. Check by browsing to http:\\OPSync:8888

Creating an OctoPrint Atom Server

This is a work in progress – not complete yet…

  1. Optional: Go through the Windows install on the NUC and setup (and updated) the pre-installed Windows 10 Home – once fully updated I created a full disk backup ISO using the Windows tools.  I’ll probably never use this but I think of it as a safety net.
  2. Download the linux distribution.  For this I’m using Ubuntu 16.04 LTS (64 bit) – this was current at the time of writing.  Download the iso to your local disk (ubuntu-16.04.2-server-amd64.iso).
  3. Create a bootable install USB stick.  I’ve tried a number of tools but Rufus 2.15 had the best success.
  4. Boot up the NUC with the USB stick – you may need to head into the bios and select the boot drive.
  5. Install Ubuntu.  There’s many tutorials on how to do this – only ‘additional’ package in installed was SSH.
  6. Reboot and login with your own account.
  7. Enable root and root SSH.  First you need to give the root account a password:
    sudo passwd root

    and then edit the ssh config with ‘vi’:

    sudo vi /etc/ssh/sshd

    find the ‘PermitRootLogin’ line, press ‘Insert’ key to edit, and change it to:

    PermitRootLogin yes

    press ‘Esc’ key to exit edit then ‘:w’ to write and ‘:q’ to exityou can restart the service but I find it just a quick to reboot:

    sudo reboot
  8. Move the NUC to where you want it to go and attach power and ethernet.  At the time of writing I was unable to get WiFi working but this may change in the future.
  9. Download and install WinSCP and Putty.
  10. Optional: I like to set a reservation for the NUC in your DHCP (router) – this way you’ll always have the same IP for the NUC.
  11. Start WinSCP and login as root, also start Putty and login as root.


  12. From time to time you’ll need to update Ubuntu – we’ll do it now:
    apt-get update

    and

    apt-get upgrade

    Note that you don’t need sudo since you’re logged in as root.

The ‘Computer Room’

Here’s the home man cave.   Lars is running an i5, beside him is a spare first gen i7, and I’m sporting an i7-6700.

My desk is the hobby shop with shelves of electronic parts, a bench power supply, soldering station and a number of meters – hoping for an oscilloscope in the near future.

Currently have three 3D printers all web enabled on OctoPrint (which was set up on an Atom X5-Z8350 NUC)

Have a few projects underway.  There’s a toster oven re-flow soldering oven, a single board BT Sync device and a new Hypercube printer (making improvements from the first).