Ubuntu Geek

Ubuntu Linux Tips,Howtos&Tutorials|Edgy,Feisty,Gutsy,Hardy

  • Subscribe RSS Feed

    subscribe to the ubuntu Geek RSS feed




  • Sponsor

  • Categories

  • Meta

  • Sponsor

  • Archives



  • WidgetBucks - Trend Watch - WidgetBucks.com

Backup Ubuntu using rdiff-backup

Posted by admin on December 1st, 2007 Email This Post Email This Post

rdiff-backup backs up one directory to another, possibly over a network. The target directory ends up a copy of the source directory, but extra reverse diffs are stored in a special subdirectory of that target directory, so you can still recover files lost some time ago. The idea is to combine the best features of a mirror and an incremental backup. rdiff-backup also preserves subdirectories, hard links, dev files, permissions, uid/gid ownership, modification times, extended attributes, acls, and resource forks. Also, rdiff-backup can operate in a bandwidth efficient manner over a pipe, like rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up to a remote location, and only the differences will be transmitted. Finally, rdiff-backup is easy to use and settings have sensical defaults.

Install rdiff-backup in ubuntu

If you want to install rdiff-backup in ubuntu use the following command

sudo apt-get install rdiff-backup

Because rdiff-backup is using SSH, which asks for a password upon logging in, it will require human interaction during the actual back-up process. And because we are trying to setup an automated process, this is not what we want. Fortunately, this problem can be easily skipped by using SSH public keys. So, we’ll need to create a pair of keys on the home computer, one of which will be saved on the work computer. Basically, these keys will tell the work machine that the home machine is allowed to login through SSH.first you need to make sure both machines installed with openssh.

Install openssh using the following command

sudo apt-get install openssh

Now you need to Generate a DSA key pair on the USA computer

ssh-keygen -t dsa

Hit enter when you are asked for the target directory and for the passphrase.

Send the public key to the UK computer:

(The UK computer has to have used the ssh client, otherwise, the .ssh directory won’t exist)

cd $HOME

scp .ssh/id_dsa.pub UK-user@UK.computer.IP:~/.ssh

Log in to UK PC and add the key to the list of authorized keys:

ssh work-user@UK.computer.IP

cd .ssh

cat id_dsa.pub >> authorized_keys2

rm -rf id_dsa.pub

Test if everything is ok: Log out and log back in, this time, you shouldn’t be asked for a password.

Back-up process

we want to do here is back-up the scripts/ directory on the UK PC to the USA PC. To do this, type the following command on the USA machine

rdiff-backup -v4 --print-statistics UK-user@UK.computer.IP:://home/UK-user/scripts/ scripts/

Automate Backup process with crontab

On the USA machine, type the following command to open the crontab editor

crontab -e

It will open vi.Once it started, Now, add the following line

15 1 * * * /usr/bin/rdiff-backup UK-user@UK.computer.IP:://home/UK-user/scripts/ scripts/

save and exit the file

As of now, every night at 1:15, the scripts directory from the UK PC will be saved to /home/USA-user/scripts directory and will be updated if any scripts are added to the work directory.

If you want to be notified the next time we write something please subscribe to our RSS feed.Thanks for Visiting!

Related Articles

One Response to “Backup Ubuntu using rdiff-backup”

  1. File Or Directory Cat Says:

    Cat Walks…

    Improve your cat’s health and well-being with wall mounted ramps and perches….

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>