3

I have a server with CentOS 5.6, with SVN on it and I would like to take incremental backups of the changes on a daily basis while I take a full backup on a weekly basis. I need to back this up on an external HDD which will be attached to the server.

I did try out the examples provided by Mike Rubel using rsync but it didn't really do an incremental backup - it was doing a full backup. Unfortunately i'm not much familiar with bash scripting :/

Any help is appreciated

2
  • Do you want incrementals of items handled by SVN, or incrementals of the filesystem items not handled by SVN? Jul 26, 2011 at 14:25
  • taking backup of the SVN repositories should be enough - with that i can access anything on the SVN repository including history etc...
    – hex4
    Jul 26, 2011 at 14:26

3 Answers 3

2

There's two reasons to do backups:

  1. Disaster recovery (major hardware failure, natural disaster, etc.)
  2. Oh, @!#%, I need that file back the way it was yesterday.

By definition, regular commits to SVN takes care of reason 2. If you delete or overwrite a critical file, just pull an older version back out of the repository.

That leaves reason 1. As long as you have good verified offsite copies of your repository, you should be set. Make full copies of it on a daily basis, periodically test checking out of the copied repository, and you're set.

If it were me, I'd make sure my repository used the FSFS backend (apparently it's the default since 1.2, but it wasn't when I started). That will store your repository in regular files on the filesystem, and you can back them up with rsync, svnadmin hotcopy (sample script here), or whatever other tool you want.

4
  • I have over 700MB of SVN files - wouldn't a full daily backup be too much?
    – hex4
    Jul 27, 2011 at 7:05
  • 1
    Depends on your media -- my tapes at work hold 400 GB of compressed data. What @voretaq7 and I are both talking about is basically mirroring the repository into a safe location. I'd expect normally if there was a problem requiring a restore, you'd just want the latest repository. Is there ever a time when you'd want the repository restored back to its state as of X days ago? Not your working copy of something, but the actual central SVN repository. I can't think of a case for that, at least. Jul 27, 2011 at 13:59
  • The only cases where I can think of wanting to do an incremental restore of the repository are sabotage (someone damaging the repository itself in a non-obvious but eventually business-damaging way - how likely is that?) or a majorly botched commit that results in several hundred megs of repository bloat (because you wouldn't want to have to keep backing that mistake up forever)
    – voretaq7
    Jul 27, 2011 at 14:47
  • thanks guys :) - we will just go with a full backup twice a week for now.
    – hex4
    Jul 28, 2011 at 6:47
2

rsyncing your SVN repository daily will provide you a "currently-up-to-date" backup of the repository.
The first rsync is a full backup in the sense that every file winds up getting copied over the wire.
The subsequent rsyncs are "incremental backups" in the sense that the sync algorithm ensures that only the changes get sent, but are not incremental in terms of a restore (you won't be able to restore the repository as it was on last Wednesday -- the version you have at your rsync target is the version you have).

In your case if all you care about is keeping a good copy of the repository rsync may be adequate. If you need the granularity of being able to restore to a specific day you should investigate a solution like Bacula or some other kind of backup software solution that's designed for the task of backing up data.
Backup software has flexible scheduling options.
The other major advantage of software like Bacula is that you can use it to back up other things (all your production servers, for example). This will seem substantially more important after your first catastrophic hardware failure, when you are able to restore all your data from the backups :-)


Ultimately you need to consider your goals in making a backup (specifically: What do you want to be able to restore? and How much work is required to reconstruct the things you can't restore?), then select a backup strategy accordingly.

2
  • "The subsequent rsyncs are "incremental backups" in the sense that the sync algorithm ensures that only the changes get sent" - only if they are rsynced with the same folder though right? If I rsync to different folders using dates for example - that would rsync the whole SVN repositories again - which after sometime, it will get too large I guess
    – hex4
    Jul 27, 2011 at 6:59
  • Correct - rsync is designed to syncronize two locations, and it will do so using block-level incremental transfers to save bandwidth. If you're pointing it at a different spot it will have to transfer everything the first time, and since the target location keeps moving to a new, empty directory every time is the "first" time.
    – voretaq7
    Jul 27, 2011 at 14:44
0

I have found this link very useful regarding the incremental backup & full backup on weekends.

https://www.centos.org/forums/viewtopic.php?t=14960

1
  • Please provide at least a summary of what the link is about, instead of just the link. That way your post may still be useful if the link goes away, and you'll also save people from having to wade through a long forum thread. Mar 11, 2014 at 17:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .