Thursday, May 1, 2014

Backup in Linux using rsync

Let's look a few ways to backup data from remote computer in Linux. For this we use rsync.

Remote computer has an IP address 192.168.10.10.

You can copy catalog prog from remote computer in simple way:
rsync -avz --delete root@192.168.10.10:/etc/prog /local/backup/ &&
 rsync -avz --delete root@192.168.10.10:/etc/ppp /local/backup


Another way.Connect to remote computer by ssh and copy remote catalog /etc/samba/ in /local/backup/current-backup/. Then, after changing some files in /etc/samba/ copy changed or new files in /local/backup/current-backup/ and old files, which situated in /local/backup/current-backup/ move to /locale/backup/backup-`date +%A`. In this command backup-`date +%A` means day of week.
rsync -avz --delete root@192.168.10.10:/etc/prog /local/backup/ &&
rsync -avz --delete root@192.168.10.10:/etc/ppp /local/backup


To automate the backup is recommended to configure passwordless ssh access or configure the nfs and mount as a local drive and create a new task or run manually.

No comments:

Post a Comment