Crypt : A Personal Cloud (Setting Up The Crypt Server)

Setting Up The Crypt Server

This post is the secont part of Crypt : A Personal Cloud.

I bought a 2 TB external hard disk and connected it to the Pi board. Time to mount it. First, create the directory where you want to mount the harddisk.

root@deltastation$ mkdir /media/crypt

Now, identify the partition of your hard disk that you want to mount.

root@deltastation$ fdisk -l

Disk /dev/mmcblk0: 29.8 GiB, 32010928128 bytes, 62521344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe0d6de9e

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 61896127 61887936 29.5G 83 Linux

Disk /dev/sda: 1.8 TiB, 2000398931968 bytes, 3907029164 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xba3ef776

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2516584447 2516582400 1.2T 7 HPFS/NTFS/exFAT

And now we’re good to mount it

root@deltastation$ mount mount /dev/sda1 /media/crypt/

If you want to mount the disk automatically every time the Pi board restarts, you’d need to find the Universally Unique Identifier (UUID) for your partition and put it in the /etc/fstab file with its mount point. You can find the UUID by listing all the block devices on your board.

root@deltastation$ lsblk -f
└─sda1 ntfs 488E5B628E5B4798 /media/crypt
└─mmcblk0p1 ext4 2331b890-814a-4e3a-80ff-35597e4af7d6 /

And now you can mention this UUID in the fstab file.

root@deltastation$ cat /etc/fstab
UUID=2331b890-814a-4e3a-80ff-35597e4af7d6 / ext4 defaults,noatime,nodiratime,commit=600,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults,nosuid 0 0

UUID=488E5B628E5B4798 /media/crypt ext4 defaults 0 0

All you need to do now is to clone my repo, build the docker image and spin up the container. These commands are also given on the GitHub repo Crypt-ARM-Syncthing.

root@deltastation$ git clone

root@deltastation$ cd Crypt-arm-syncthing

root@deltastation$ docker build -t synct .

root@deltastation$ docker run -d -p 22000:22000 -p 22020:22020 \

-p 8080:8080 -p 21027:21027/udp –name syncthing \

-v /media/crypt/BackUp/:/home/syncthing/syncthing_data synct

Once everything is up and running, open up your favourite browser and visit the IP address of your Orange Pi, hit port 8080 and you should be able to see the Syncthing Screen (Something similar to the following screenshot). Remember, we can go to “Actions” and view the QR code for the device’s ID. We’ll use this QR to scan it from the mobile client.

Server 01
Syncthing’s Welcome Screen

Go to “Settings” and name your device. I chose Crypt.

Server 02
Renaming your device

Now, hit the GUI tab and set up a username and its password.

Server 03
Setting up the Authentication

Hurray! Your server is now up and running perfectly. If you want your server to restart automatically every time the Pi reboots, simply set a cron job to fire the command ‘docker start syncthing’ at the time of reboot.

Configuring the Client

Go to Google Playstore and download the Syncthing app. Go to “Devices” tab, scan the device QR code and you have the mobile client all set up. You can set a static IP address for your Pi board from your router’s admin panel and put that IP here too.

Configuring Client
Configuring Client

Now you can select any folder you want to take a back up of. The “Folder Label” is the name of the folder where all the data of the selected folder will reside on the server side. Choe the “Folder Type” to “Send Only”. We don’t want any changes made in the data on the server to be reflected on mobile, do we? Do not forget to toggle the switch with “Crypt” (whatever your device name is) in front of it. It tells the client to share the folder with that device. You’ll be prompted on your Web Browser to accept the request and to select the location where you want to take the backup.

Selecting folder on the mobile device
Selecting a folder on the mobile device

Now, you can wait a little for the data to start synchronising between the devices.

Data Synchronizing
Data Synchronizing

You can return from your office, your college, your wherever-you-go-to and simply turn the Wi-Fi on and all the data will be backed up without a fuzz!

Happy Backing Up!

My Crypt Setup
My Crypt Setup

Leave a Reply