Syncing images from android smartphone to raspberry pi


I was looking for a solution to backup the photos taken with my smartphone to our raspberry pi.

Android side

I searched for synchronization apps and ended up using rsync as backup tool. Therefore I installed the app ‘Rsync Wrapper‘ on my smartphone and configured it with the following parameters:

Source:

/storage/9C33-6BBD/DCIM/Camera/

Destination:

martin@192.168.2.106:~/photos/handy-samsung-s7/

Option:

-r --ignore-existing --progress -e "ssh -l martin -i /data/user/0/net.letscorp.rsyncwrapper/files/06a73f67-6234-40e7-81de-7add8fa4c783.key -y"

I removed the –verbose parameter and added the –ignore-existing parameter. The –ignore-existing parameter was added by me because the synchronization took up to twenty minutes where the most of the time was used to check which files are new and should be transferred. After I added this parameter the synchronization of the file lists takes only some seconds.

When you start the app you can tap on the question mark on the top and then a short tutorial appears which explains how to setup the rsync configuration.

Currently I am not using scheduled jobs to synchronize the pictures automatically. I have to start the job manually but the app offers the possibility to automate this job.

 

Raspberry Pi 2 side

You have to install rsync also on the raspberry pi. I think it was already installed with the base raspbian image on mine. If it is not installed it can be installed with the following command:

# as root user:
apt-get install rsync
# with sudo
sudo apt-get install rsync

Our raspberry pi has an external two terabyte SATA-disk connected via an USB adapter. The home directory of my user ‘martin’ is on the external disk. The disc is connected permanently to the pi and is mounted via /etc/fstab on startup automatically. When I copied some files from the SD-card to the external disk the pi has written on the disk with approximately twenty megabytes per second. Our pi is connected via WiFi to our network like my phone – so I think this is the limitation which leads to transfer rates of seven- to eight hundred kilobytes per second.

Resources

 

Conclusion

The setup with the SSH-keys in the app was not very smooth because you have to copy and paste the key to your accepted keys file on the raspberry pi. And I feel that working with copy and paste of texts on a smartphone is always a little pain. But this is a one-time job and if it is configured correctly it works flawless. I am really happy with this solution so far because when it is configured it is easy to use. Additionally the app has no annoying advertising included.

 

Featured image resources

The featured image is made from the logos of Raspberry Pi, Rsync and Android. I used the logos from the corresponding Wikipedia sites:

 

Raised Flower Bed – 2017-03-26

Raised Flower Bed - 2017-03-26

Raised Flower Bed – 2017-03-26

Leave a comment

Your email address will not be published. Required fields are marked *