Rsync USB backup

Rsync is a simple tool for synchronizing two directories while minimising data transfer by only transferring the differences.

I use the following script to automatically sync the files on my USB drive to my home directory on a remote server and then safely remove the drive. The files are transferred over SSH, and so the entire transfer is secure. I also use public key authentication to ensure I do not require a password to log into remotehost.

#!/bin/bash
rsync /media/USBDRIVENAME/FOLDERTOSYNC -avz -e ssh user@remotehost:~/
sudo umount /media/USBDRIVENAME

I use this to backup the my college work folder to a remote server in college. It has saved me once or twice when I have left my USB drive at home. It also means that you only have to roll back a day if you lose your USB key. No more lost college work.

Leave a Reply