Comments on Create Incremental Snapshot-style Backups With rSync And SSH
Create Incremental Snapshot-style Backups With rSync And SSHAs neither human nor computers are perfect (humans err / computers may fail) it is quite obvious that a good backup system will prevent from too much damage once the computer may go down. This could be either because the harddrive is failing or because of hackers or because you accidentally deleted something important.In this tutorial I will show you how to automate backups automatically in an incremental snapshot-style way by using rSync.
26 Comment(s)
Comments
rsnapshot is a nice package that automates all this for you in a simple to use command line tool. --Nelson
rdiff-backup is a bit more advanced version of this. It does a sync as above, but, after the first sync, it keeps reverse diffs of changes. Basically, this means, you have both a local copy of the content you are backing up, and, you can also roll back to any backup you've made in the past.
http://www.nongnu.org/rdiff-backup/
refer: http://duplicity.nongnu.org/ A backup tool; opensource; written in python; uses ssh/rsync and optional encryption for backup sets.
you can also check this free script i wrote to backup with rsync: http://blog.pointsoftware.ch/index.php/howto-local-and-remote-snapshot-backup-using-rsync-with-hard-links/
It uses file deduplication (hard-links), MD5 integrity signature, 'chattr' protection, filter rules, disk quota, retention policy with exponential distribution (backups rotation while saving more recent backups than older).
was already used in Disaster Recovery Plans to replicate datacenters, using little network bandwidth with encryption tunnel.
Can be used locally on each servers or via network to central remote backup server. windows server could also be backuped by using a linux box that mount smb shares from them.
Why not just use something like http://www.nongnu.org/rdiff-backup/ ?
Also, you've hit one of my pet scripting hates; what's the point
things like of RM=/bin/rm ?
Just set a sensible PATH and be done with it.
I use rdiff-backup to do the same thing more efficiently.
An alternative to all this things is a program called "rdiff-backup". It also uses rdiff and can use ssh to create backups accross different machines. Only one downside is that you need a Python interpreter on your machine, but almost everyone has it nowadays.
It is an extremely bad idea to let your production server connect directly to your backup server without a password, as suggested by this tutorial.
The reason is simple: If someone compromises your production server then your backup server is compromised as well.
This completely destroys one of the main advantages of having a backup. The superior solution is to allow the backup server to connect to your production server (or multiple production machines for that matter). This backup machine should be running no services and should not be accessible through the internet at all.
In the article I have shown both approaches... backup machine connection to production machine and vice versa....
By putting the shell scripts on the according server and have them run there through ssh you can alter both scripts to do either one method...
However I agree that the production server should not access the backup server. I think I will alter this a bit and then as possibilty add the other way.
Thanks for pointing that out.
Yes this is a very important point. Further details regarding this concept are available from : http://www.lbackup.org/network_backup_strategies
cool article!
I backup roughly 40 servers at remote sites using rsync. At the remote site, there is a rsyncd running, and I pull everything to the data center, deletes and all, everynight, scheduled out of cron. I keep it simple. The rsyncd daemons run on Linux, NT, 2000, 2003. I let a backup program handle the diff's, the Backup Exec client for linux handles it no problem.
I'd have thought it would be best to use mysqldump or equivalent instead of copying the binary files...
I use mysqldump...
I personally use script found on this blog to do my mysql backups: http://crazytoon.com/2007/01/23/mysql-backups-using-mysqldump/ It seems to work great for my databases.
You could just use RSnapshot (www.rsnapshot.org) that automates all of this for you.
Why don't you just install rsnapshot which does all this for you?
rsnapshot is based on the same idea by Mike Rubel as my approach to it.. however I don't like perl, I never did... and I never will... in my opinion perl causes more problems than it does good things and so I try to avoid it wherever possible.
Interesting article, but isn't this exactly what the 'dirvish' script does, on top of rsync and ssh?
http://www.dirvish.org/
Why not rdiff-backup? http://www.nongnu.org/rdiff-backup/
For the simple reason that the rdiff packages for Debian 3.1 Sarge and SuSe 9.1 are incomptible with each other...
There's an open source backup program which does secure remote backups just as you are trying to do here.
The difference is it only does one job, is designed for it , and does it very well indeed.
Suggest you go here and take a look: http://www.fluffy.co.uk/boxbackup/
I found a good howto writeup about rsnapshot at http://www.technetra.com/writings/archive/2005/08/20/backups-are-a-snap-with-rsnapshot
Good! This might also be of interest to you (Mysql Backup & upload to AWS S3) https://simplebackups.io/blog/the-ultimate-mysql-database-backup-script/ Laurent - simplebackups.io