
Set rsync to start automatically: `update-rc.d rsync enable`.I think you might need to reboot here, but I can’t remember.Edit /etc/default/rsync and set RSYNC_ENABLE=true.Create the secrets file, with a username:password in it (separated by a colon).The contents of mine are (and yes, I probably shouldn’t be using root for the uid/gid): Make sure its installed (apt-get rsync).
Make sure your disk is writable (touch /hdd/test). It should read something like this:ĭwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait rootdelay=10 This allows the USB disk to mount on boot without failing.
Edit /boot/cmdline.txt, and add rootdelay=10 to the end of the line. Edit fstab, and add the following line, obviously replacing the UUID and mount point with yours: UUID=0b4e2012-c5dd-492c-bd3f-ce3b7038c108   /hdd   ext4   defaults   0   2. Some decent instructions for that can be found here: At this point you might want to mount and format the disk, if you haven’t already formatted it. Make a directory where you want to mount the hard disk. You should see the UUID of the device you just plugged in – it’s probably the bottom one, but should have the name “sda” in it, something like this: lrwxrwxrwx 1 root root  10 Nov  8 13:00 0b4e2012-c5dd-492c-bd3f-ce3b7038c108 ->. You should see a bunch of messages about it being connected, and somewhere in there should be the name of the device – usually sda. Follow the message log (tail -f /var/log/messages) and plug in the USB hard disk. I’ve left it on DHCP, so that wherever I go plug it in, as long as it has a wired connection it will just work (we’ll set up autossh to establish a tunnel as soon as the network comes up later). Set up the remote pi with Raspbian, and connect it to the same LAN as the NAS. Configure them to boot to console, not GUI (these will be headless). This lets you test that the rsync works, and also lets you do the initial sync (which might be a big one) on the LAN rather than uploading it to the internet over ADSL! Initially though, it’s best to set up this: NAS - LocalPi - InternetServer - RemotePi So the topology will end up looking like this: I could have cut out this second Raspberry Pi by going straight via the external box too, but I didn’t want to open the forwarded ports to the internet – using the second Pi, the forwarded port is only open to my LAN. For this reason I ended up with another Raspberry Pi next to the NAS, but I suppose you could use any device that’s always on. Grsync raspberry pi software#
Another stumbling block was synology trying to be too clever – initially I tried to set up a reverse tunnel on the NAS, but the HyperBackup software won’t let you back up to a local IP. So I decided to use an intermediate server which I already have in the internet, and tunnel the rsync over a reverse SSH tunnel.
The main issue is that family members don’t have static IP’s (they are behind typical ISP routers with dynamic IP and NAT), and the synology makes an outbound connection to do the rsync. If I do this in the middle of the night, then it won’t noticeably interfere with internet connections. I came up with the idea of putting a Raspberry Pi at a family members house with an external drive attached, and rsync’ing to it. So I started to think up ways of doing an offsite backup, without having to remember to do it or drive around with hard disks. It’s ok having 4 disks for resilience, but if my house burns down or gets burgled, I still lose everything. The main issue I had was off-site backups. I recently bought a 4 bay synology NAS (DS416 Play).