When you want to use your SPP as network storage media to back up your data, rsync is tool of choice, especially if you use a wireless connection.
rsync offers incremental, compressed, ssh-secured, recursive synchronization of directories.
rsync is uni-directional. For bi-directional synchronization, you have to run rsync twice.
Visit the rsync homepage for further information about rsync.
Prerequisites[]
enable ssh access and configure it so that you can ssh to your SPP without entering a password.
- download the rsync binary (statically linked) here: rsync.zip and unzip the file.
Installation[]
The network name of my SPP is "screenplay" which I prefer over using the IP address (192.168.1.1 in my network).
The following code snippets assume, that ssh is already enabled and configured for root (I already created a home directory for root (/root) and also a ssh-key-file (/root/.ssh/authorized_keys) to ease administration of my SPP).
- re-mount your SPP disk to make it writable ("ssh -l root mount -o rw,remount /") if not already done.
- copy rsync to your SPP ("scp rsync root@screenplay:/usr/bin/rsync")
- log into your SPP and make the file executable ("ssh -l root screenplay chmod 755 /usr/bin/rsync")
- check the installation by fetching a file from the SPP using rsync: "rsync root@screenplay:/etc/passwd passwd"
Configuration[]
I created a personal environment for every user to preserve file permissions, etc.
- create the user accounts on the SPP ("ssh -l root screenplay adduser foobar")
- create a home directory for every user ("ssh -l root screenplay mkdir -p /home/foobar")
- create a backup directory for every user ("ssh -l root screenplay mkdir /tmp/hddmedia/foobar")
- Please note: The dvdplayer application runs as root, so everybody can browse the files which are stored on in the backup directories. You might prefer to name your backup directory /tmp/hddmedia/.foobar rather than foobar to create a hidden directory which is ignored by dvdplayer application.
- link the backup directory into the home directory of the user ("ssh -l root ln -s /tmp/hddmedia/foobar /home/foobar/foobar")
- change the ownerschip of the new files to the user ("ssh -l root chown -R foobar.foobar /home/foobar /tmp/hddmedia/foobar")
- every user has to generate his own ssh secret:
- Generate a key ("ssh-keygen"). Answer all prompts with empty string to generate a password-less key.
- Copy the public key to the SPP ("ssh screenplay mkdir .ssh", "ssh screenplay chmod 700 .ssh", "scp .ssh/.id_rsa.pub screenplay:.ssh/authorized_keys")
Operation[]
Now rsync is ready to use ("rsync -auvz /home/foobar/ screenplay:foobar").
Add a cron job to execute rsync on a regular basis (if your host speaks Unix, Linux, MacOSX,...)
Notes[]
I tried to create the users' home directories directly in /tmp/hddmedia/, but then rsync synchronisation overrides the important file ".ssh/authorized_keys" during operation.
I tried "rsync -auvz /home/foobar screenplay:" but this removed the link and replaced it with a directory (the root filesystem is too small to back up the users' data).