/home/shakir

Automatic backup using rsync

Posted on 09 Oct, 2007, categorized under Information Insemination



I’ve suddenly lost all the files in my home folders, and I quickly do these to not let the impact to be as bad, if it ever recurs.

Say 192.168.1.10 is my backup server (anduril), herugrim is my laptop’s name, these are the steps I did to let my laptop automatically rsync to the backup server.

Configure Password-less Login

Generate RSA key for use with SSH. Make sure you dont use any passphrase.

shakir@herugrim ~ $ ssh-keygen -t rsa -C shakir@192.168.1.10
Generating public/private rsa key pair.
Enter file in which to save the key (/home/shakir/.ssh/id_rsa): /home/shakir/.ssh/id_rsa.192.168.1.10
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/shakir/.ssh/id_rsa.192.168.1.10.
Your public key has been saved in /home/shakir/.ssh/id_rsa.192.168.1.10.pub.
The key fingerprint is: 11:d9:23:2e:68:05:59:d9:ac:5a:00:69:17:3a:b4:24  

Copy the public key to the server

shakir@herugrim ~ $ ssh-copy-id -i .ssh/id_rsa.192.168.1.10.pub shakir@192.168.1.10

Test if passwordless login successful

shakir@herugrim ~ $ ssh shakir@192.168.1.10 -i .ssh/id_rsa.192.168.1.10
shakir@anduril:~$

Configure Target Directory

shakir@anduril:~$ mkdir backup/herugrim -p

Manual Rsync (test power)

shakir@herugrim ~ $ rsync --verbose --progress --compress --rsh=ssh --recursive --times --perms --links --delete /home/shakir anduril:/home/shakir/backup/herugrim -e "ssh -i /home/shakir/.ssh/id_rsa.192.168.1.10"

Configure cron

At your machine To edit your crontab entry, issue this command

crontab -e

Add this entry to your crontab

30      9       *       *       1-5     rsync --compress --rsh=ssh --recursive --times --perms --links --delete /home/shakir anduril:/home/shakir/backup/herugrim -e "ssh -i /home/shakir/.ssh/id_rsa.192.168.1.10"

Run cron

sudo /etc/init.d/cron start     #depending on your linux distro

And I guess that’s all..

backup guys, backup… :)

Tags: , ,




Looking for something else? Search Google.

No Responses to "Automatic backup using rsync"

Comment Form


  • si perda: wah.. boleh kasi need for speed test power skali... boleh layan network race ni...
  • Faiz: wah....harganya berapa?
  • shakir: Hmm, I have no lab and that actually was my living room :D Sure I'll move them to one of my available rooms at home and make it a lab, but that'll be
  • peja: whoaaa..at least u have ur own lab...look interesting!
  • Qing Ru: He looks really cute! Fatherhood must have been quite rewarding :)
  • shakir: Chris: Thanks, I've updated the post.
  • shakir: tak cukup banyak guinea pig yang dah try and comment on the wimax service, and so I'll just wait :D
  • shakir: Vadim: Yup, but I prefer to just install dosbox and play the game rather than re-installing my system with 32 bit Linux :D
  • Vadim: 2shakir: wine doesn't support 64-bit linux. You have to use 32-bit linux if you want to use wine.
  • kevler: yerp ...dalam 2 hari nih jer ..aku dah kesan 2 BMW X6 , kat puchong dan jalan ampang ..giler laa lawa



Disclaimer

The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my own personal opinion. Inappropriate comments will be deleted at the authors discretion. All code samples (if any, ever) are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Personal (Blogs) - TOP.ORG