LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rsync backup (https://www.linuxquestions.org/questions/linux-newbie-8/rsync-backup-930493/)

amartlk 02-21-2012 07:30 AM

rsync backup
 
Hi

i have centos 5.3 installed i use rsync to backup local to remote with rsync -avz -e "ssh -i /root/rsync-key" /sourcefolder/ root@remoteip:/destination folder/ . it also works properly
but i want to copy this data on destination with datewise incremental backup how it possible


AMAR

ba.page 02-21-2012 08:18 AM

this is probably more involved than you expect since the notion of modified time or incremental are not built into rsync.
I figure you have to options:
option 1) setup a local backup process to generate weekly fulls and daily incrementals to a folder on your source pc. then rsync that backup folder to the destination.
depending on the distribution you're using, you may have access to a simple backup program that will handle the generation of backups for you. if you don't have access to pre-fabricated backup applications, you can make your own. I found a good guide here: http://www.linux-backup.net/Full_Inc/

option 2) is more complex and will require a lot of script. if found a decent guide here: http://www.howtoforge.com/rsync_incr...apshot_backups

good luck.

wpeckham 02-21-2012 03:26 PM

Backup using rsync
 
Rsync is a wonderful tool for fast syncronization and backups, but not for datewise incrementals. What you need is a serious backup/restore tool.

polinux 02-22-2012 05:22 PM

Bacula should be good for it. :).

rhbegin 02-22-2012 07:18 PM

Also, there is amanda (zmanda has a front-end interface) which makes configuration a lot easier.

We use Zmanda and it is a life saver when you need to restore critical files.

Satyaveer Arya 02-22-2012 10:21 PM

rsync is a very useful and powerful program for doing incremental transfers of files, whether that is locally or remotely.
Suppose I want to backup to my USB memory stick so I have an up-to-date copy of them wherever I go. My source folder here is ~/Documents and my memory stick is mounted at /media/disk right now.

Initially, you will have to use rsync to copy all the files across, since an incremental copy doesn't yet exist.

Quote:

# rsync -avh ~/Documents /media/disk
That sets up an archive copy. Depending on how much stuff you have and where you're copying, it might take some time, but the verbose option we used (-v) should show you the name of each file as it is copied over.

Once that's done, you've got your initial copy done. Now when you need to synchronise the two copies, simply run the same command again. This time, rsync will go off and find only the files that have changed, and copy those over. When it has finished, both copies will then be up-to-date, and you can get back on the move.

Check these links also, helpful for incremental backups:
http://www.marksanborn.net/howto/use...nthly-backups/
http://www.linuxhomenetworking.com/f...-backup-script
http://fluff.info/blog/arch/00000204.htm

rhbegin 02-23-2012 09:28 AM

One important aspect of rsync is using the --delete option because you do not want to leave files that were deleted.

Be very CAREFUL with using the delete as you do NOT want to purge the files on the source.

For a valid backup you would need to implement this, otherwise you will create a quagmire of non-valid data.

I have used the --delete option when migrating server to server, the end user never knows their data be it email, file_shares, ect... was ever migrated. Otherwise the end user will be inundated with data they do NOT want.

Satyaveer Arya 02-23-2012 09:52 PM

If you'd prefer both copies to remain completely synchronised, even if that means deleting files from either copy, add the --delete option, like so:

Code:

# rsync --delete -avh ~/Documents /media/disk
Do be careful with that option, however, as you don't want to be deleting things you might need.

rhbegin 02-24-2012 08:12 AM

Quote:

Originally Posted by Satyaveer Arya (Post 4610630)
If you'd prefer both copies to remain completely synchronised, even if that means deleting files from either copy, add the --delete option, like so:

Code:

# rsync --delete -avh ~/Documents /media/disk
Do be careful with that option, however, as you don't want to be deleting things you might need.

Correct and there is no 'undelete command' to run in case of 'oops'.

However, for backups to be valid they need to mirror what you are backing up. Otherwise you will have a quagmire of erroneous files.


All times are GMT -5. The time now is 11:49 PM.