This is a first version of this package. I expect more to follow with fine tuning and tweaking according to usage by users.
1. Backing up from eTRAYz to USB External HDD (default setting in package):
Look at settings file in /home/sysadmin/.rdiff-backup/rdiff-backup.conf
# for how long to keep backups KEEP=30D # source and destination folder SOURCE="/home/Public" DESTINATION="/External/HDD/part1/backup/Public" # which folders to exclude EXCLUDE="--exclude /home/Public/eTorrent --exclude /home/Public/eDownloader" # rdiff binary file RDIFF="/usr/bin/rdiff-backup" # some common options COMMON_OPTIONS="-v5 --force --create-full-path --ssh-no-compression --exclude-fifos --exclude-device-files --exclude-sockets --exclude-other-filesystems --print-statistics"
This default settings are as follows.
Keep files for up to 30 days. Backup folder /home/Public but exclude folders /home/Public/eTorrent and /home/Public/eDownloader. Make backup on external USB hard drive into folder backup/Public which gets mounted on /External/HDD/part1.
You can edit this file according to your needs. To test it localy disk to disk, I changed the destination folder to /home/sysadmin/backup/Public.
There is also an option to backup to external location via SSH, but this is a bit more advanced. Lets keep it simple for now.
To start backup run this type in SSH:
2. Backing up from Windows to eTRAYz:
You need to do a couple of steps.
First download native Windows build (rdiff-backup-1.2.8-win32.zip) and unzip it to some folder.
Next we need SSH client for windows. Best and easiest to use is our beloved putty. Download following files: putty.exe, puttygen.exe and plink.exe and to make things easier copy there files in the same folder as you unpacked rdiff-backup for Windows.
Now we need to make a private key in order to connect to eTRAYz over SSH without authentication. Run puttygen.exe. He will open a Window where you click on Generate button (1.). Now move your mouse under progress bar to create random key.
Then save it by clicking on Save private key (2.). He will nag if you want to save it without passphrase. Confirm with YES. Name the file privatekey.ppk and save it again in same folder where we have unpacked rdiff-backup files. DO NOT CLOSE PUTTYGEN WINDOW YET.
Login to your eTRAYz via SSH with root username. Now lets copy paste the private key into .ssh folder. Type this first to make the folder if its not existing:
mkdir -p /root/.ssh/
Then copy the string in Public key for pasting into OpenSSH authorized_keys file from puttygen window(3.). Then paste this line into black putty window (right mouse click):
echo "HERE_YOUR_KEY_ALL_IN_ONE_LINE" >> /root/.ssh/authorized_keys
This is example from my puttygen key:
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEArzBORj2Xpu9ltwOvwv7vPY9L2MeD/1pz1bBAgwJA4bN90HWEi1bofbMUm57EZ9qu8GC/GV4vU/WgfN947byoCEH1YJmKyrKNHzElUavPXSf1NJJzZ95Wt25ynsCH4pUDM8BYtRKF4vXlzYqT6GUJyYBuKpJjGHMDGw7rMUfC+88= rsa-key-20100816" >> /root/.ssh/authorized_keys
Now make a new bat file in the same folder as we unpacked rdiff-backup. For example rdiff-backup.bat and put following text inside:
rdiff-backup.exe -v5 --no-hard-links --print-statistics --remote-schema "plink.exe -i privatekey.ppk %%s rdiff-backup --server" "c:\folder on\your hard drive\\." root@etrayzip::/home/folder/on/your/et
Replace the etrayzip with your etrayz hostname or IP number and replace source and target folder with the one you want to use.
To start making backup from windows to eTRAYz just run this bat file:
3. Using crontab to schedule regular backup:
Type in console:
if [ ! -e /usr/bin/vi ]; then ln -s /bin/vi /usr/bin/vi; fi crontab -eu root
First press the i key to put vi editor in edit mode.
And if you want the job to start daily at 00:05 (five minutes after midnight) then paste this into new line:
5 0 * * * /usr/bin/rdiff-backup.sh >/dev/null 2>&1
To close and save vi editor type:
Give it a try and please post your comments and possible improvements.