Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If the repository is contained in a folder, is it sufficient to take the backup of this folder instead of typing the commands to create a dump?

share|improve this question

migrated from stackoverflow.com Oct 30 '09 at 20:04

This question came from our site for professional and enthusiast programmers.

1  
what is wrong with dump? It supports deltas and increments which could be really useful if you have a big repository and regular backups –  hplbsh Oct 30 '09 at 9:49
    
@hapalibashi: I tried using dump, but my PC started beeping continuously and it started showing machine language on the screen. –  RPK Oct 30 '09 at 15:52
3  
@Rohit: It sounds like dump is working properly. Except, it dumps to standard output; you need to redirect that output into a file. –  Greg Hewgill Oct 30 '09 at 20:04
add comment

4 Answers

up vote 6 down vote accepted

This is described in great detail in the Subversion Book:

As far as full backups go, the naïve approach might seem like a sane one, but unless you temporarily disable all other access to your repository, simply doing a recursive directory copy runs the risk of generating a faulty backup. In the case of Berkeley DB, the documentation describes a certain order in which database files can be copied that will guarantee a valid backup copy. A similar ordering exists for FSFS data. But you don't have to implement these algorithms yourself, because the Subversion development team has already done so. The svnadmin hotcopy command takes care of the minutia involved in making a hot backup of your repository. And its invocation is as trivial as the Unix cp or Windows copy operations:

$ svnadmin hotcopy /var/svn/repos /var/svn/repos-backup

The resultant backup is a fully functional Subversion repository, able to be dropped in as a replacement for your live repository should something go horribly wrong.

...

Additional tooling around this command is available, too. The tools/backup/ directory of the Subversion source distribution holds the hot-backup.py script. This script adds a bit of backup management atop svnadmin hotcopy, allowing you to keep only the most recent configured number of backups of each repository. It will automatically manage the names of the backed-up repository directories to avoid collisions with previous backups and will “rotate off” older backups, deleting them so that only the most recent ones remain. Even if you also have an incremental backup, you might want to run this program on a regular basis. For example, you might consider using hot-backup.py from a program scheduler (such as cron on Unix systems), which can cause it to run nightly (or at whatever granularity of time you deem safe).

share|improve this answer
    
+1 was about to type in the same answer. :-) –  Critical Skill Oct 30 '09 at 9:51
    
Meh, this one was mostly copy and paste, not typing :-) But for most things you can or have to do with Subversion the Subversion Book has the answer so it was a pretty trivial research :-) –  Јοеу Oct 30 '09 at 9:54
    
+1 do an svnadmin hotcopy and take a backup of the hotcopy output. –  Anonymous Oct 30 '09 at 13:38
add comment

You can have a look at this page.

If you only want to backup a checkout you can archive it like a normal folder, the svn configs are stored in the .svn folders located in every folders of your repository.

(The question should be moved on superuser)

share|improve this answer
    
My repositories are in my localhost. –  RPK Oct 30 '09 at 9:44
    
Then it will look exactly the same. –  hplbsh Oct 30 '09 at 9:46
3  
As others have said, directly backing up a repository from the filesystem is generally considered a bad habbit. If a commit is taking place when your backup script fires, you're going to find yourself in a world of pain if you need to restore. –  iAn Oct 30 '09 at 9:50
add comment

No, you cannot backup a repository folder without locking the repository. See this chapter of the SVN book for more information regarding backups.

A dump is one way to do a backup. You could also make a hotcopy:

svnadmin hotcopy /var/svn/repos /var/svn/repos-backup

Or you can use svnsync to constantly keep around an up-to-date copy of your repository. If you don't have a powerful SVN server, this also has the advantage that it prevents bringing the server down to its knees for backups.

share|improve this answer
    
What is the difference between a dump and a hotcopy? –  RPK Oct 30 '09 at 10:36
    
The document I linked to says regarding hotcopy: "The resultant backup is a fully functional Subversion repository, able to be dropped in as a replacement for your live repository should something go horribly wrong." A dump doesn't do that. –  sbi Oct 30 '09 at 13:31
add comment

If you are sure that no user will commit anything while you are copying the repository folder, then it's safe.

Otherwise, using the hotcopy or dump command is recommended.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.