For a while I’ve had a Linux fileserver running at home which collects nightly backups of this site from the RISCOSBlog web server and also serves as a system that I can easily drop files into from various machines or from my phone when I’m out of the house.
It was about time I got my RISC OS systems in on the act too, and although there are options such as Sunfish, sftp and scp available for RISC OS – I decided to opt with rsync, which is far more efficient when transferring files, especially when you’re dealing with backups where most files are unchanged every time a transfer is made.
Rsync is highly configurable local and remote file synchronisation tool. It uses an algorithim designed to minimise the amount of data copied by only moving portions of files that have changed – which in the case of backups is normally only a few locations on a drive.
Available for install through the PackMan package manager as well as from the riscos.info site, Rsync is easy to install and once run can be accessed through the Task Window (F12). Just like the Linux variant, the tool has a command line interface only.
What I’d decided to opt for was to create singular a directory on my Raspberry Pi running RISC OS and set rsync so that it synced everything in that folder with my remote fileserver.
Rsync requires OpenSSH to be installed on both the local machine (in my case my Raspberry Pi) and the remote server, which for me was a system running Debian,
The process can be automated by setting up SSH keys to allow for both your RISC OS system and the remote server to talk to each other, the remote server will need to be configured so that a password isn’t required for the file transfer to proceed.
If you’re transferring to a Linux system then modifying the /etc/ssh/sshd_config file so that password authentication isn’t required when a valid SSH key is present should work. An SSH client such as OpenSSH or Nettle can be used for administering your remote server from RISC OS to do this.
Using the below command in the Task Window (F12) on my Raspberry Pi I was able to setup rsync to sync files located in the ‘Dropbox’ folder I’d created – although the command can easily be modified to sync another folder or an entire drive.
Pushing files to the remote system
The below performs what’s called a ‘push’ operation, this is because it pushes a directory from the local system to a remote system.
rsync -a /dir1 username@remoteserver:
Pulling files from the remote system
The opposite operation is ‘pull’. It is used to sync a remote directory to the local system. If the dir1 were on the remote system instead of our local system, the syntax would be:
rsync -a username@remote_host:/home/
After running both the above commands, your RISC OS machine will connect to the remote server and request that you authenticate. This will be through entering the password used by the username you’re accessing on the remote system unless you’ve setup SSH keys on both systems and configured the far end to accept password-less authentication.