I wanted to use rdiff-backup with my LinkStation Pro Duo as it makes incremental backups and the retrieving of backups just dead easy. Unfortunately, its a pain in the *** to install rdiff-backup on the LinkStation Pro Duo. So I wrote a work-around.
Note: This only works if you are using a public/private key for authentication via SSH and on a user by user basis. To do this read my post titled, LinkStation Pro Duo, enabling SSH.
To get this to work from a Client machine that runs Linux, you need to install “sshfs”. In short, this allows you to mount a drive/share on your LinkStation Pro Duo onto your client machine. This in turn gives you the opportunity to run rdiff-backup locally which DOES NOT require rdiff-backup –server to be installed on the LinkStation.
Once you have sshfs installed, you will need to create a startup script for your username. Now this will vary depending on the distribution you use, but if you use Ubuntu or one of its derivatives, you can do the following:
-
Setup Directory for Mount Detection
We need a directory setup on the NAS so that we can tell if the share has already been mounted. This is needed because every time you login via SSH, it will try to mount this drive, and if you are like me and you run your PC 24/7, this could be a problem.- Remote into your NAS via SSH, using
ssh <username>@<nas_ip_address> - Create a directory on your NAS that you will put in as the CHECK_FOLDER value in the below script by running
mkdir <path_to_your_new_folder>
- Remote into your NAS via SSH, using
-
Create a .bash_login script
- Open your favorite editor (gui, graphical user interface or cli, command line is fine), name it “.bash_login”
- Copy the following into the file:
#!/bin/bashCHECK_FOLDER=/mnt/nas-backup/
REMOTE_FOLDER=<username>@<nas_ip_address>:/mnt/array1/Backup
LOCAL_FOLDER=/mnt/nas-backup# Check if the NAS Backup Share has been Mounted, if it hasn't mount it
if [ ! -d $CHECK_FOLDER ]; then
sshfs $REMOTE_FOLDER $LOCAL_FOLDER
fi - Replace the values of CHECK_FOLDER, REMOTE_FOLDER, and LOCAL_FOLDER so it suites your setup.
- Save the file
- Logout and log back in
Your NAS share should be mounted automatically so long as you have a public/private key authentication setup. - Setting up your rdiff-backup
For rdiff-backup, I simply run
rdiff-backup --exclude-special-files <path_to_directory_to_backup> <mount_location_of_nas_share>
To automate it, I put it as a cronjob that runs every night.
Note on 12/08/2008: I have now started to use rsync as it does not require me to mount the NAS Shares onto my personal computer. It also supports public/private keys allowing me to run it via cronjob daily.
That’s it!
0 comments ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment