Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

backup and restore linux using rsync

 
Highlighted
Super Advisor

backup and restore linux using rsync

hi

 

I'm looking for scripts to backup and restore the whole linux over network using rsync.

1 REPLY 1
Highlighted
Occasional Visitor

Re: backup and restore linux using rsync

Hi Chris,

 

Do you use ssh (with auto-login) to execute rsync backup? OR, do you use the rsyncd server with no password authentication?

 

I used to backup using the latter method, but I found this to be a security issue so I use the former (the ssh method).  Anyways, here's an example simple rsync script:

 

#!/bin/bash
#Copies all of the following folders from remote computer (remote-pc) to local computer (local-pc)

now=`/bin/date`
export now

echo "================================================="  | tee -a /var/log/start-rsync-backup.log
echo "$now Begin rsync Backup" | tee -a /var/log/start-rsync-backup.log
echo "================================================="  | tee -a /var/log/start-rsync-backup.log
rsync -avzp -e "ssh -i /home/foobaruser/.ssh/foobaruser-key" remote-pc.remotelocation::/home/foobaruser/Documents /u/rsync-backups/local-pc/backupdir/ | tee -a /var/log/start-start-rsync-backup.log

 

The local user ("foobaruser" in this example) must exist on the remote pc as well.  The ssh keys from the remote and local user must also exist in the remote and local $HOME/.ssh/authorized_keys file for password less ssh operation.  Google "ssh password less" and see resources online on how to generate your ssh keys.  Once the keys are installed correctly on both local and remote servers, you can put your rsync backup script into cron as an automatic job.

 

HTH