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

So... we lost our SVN repository. Through unfortunate circumstances, we also have no viable backup.

What to do? Just do an "svn export" from someone with the most recent update and start over? Is there any way to recover any history? Or connect our local checkouts to a new server?

share|improve this question
    
The very first thing to do is take a lesson from it and sort out your backups. –  John Gardeniers Sep 9 '10 at 0:13

4 Answers 4

up vote 5 down vote accepted

If all you have is a checkout, you've got a snapshot of the code, but no history.

You can create a new repo from that. As to having existing checkouts connect to the new repo after you've set it up, it's probably more trouble than it's worth. It'll be easier to create a new repo from the oldest checkout and then commit changes from newer checkouts as updates.

As to recovering history, I don't see how that's possible without a dump of the repo (via svnadmin dump) at some point in time. Even an old dump would give you whatever history there was from the creation of the repo up to where the dump was made.

Maybe somebody used git-svn on your repo at some point? That might have preserved some history but getting that back into a new Subversion repo might not be easy.

Data recovery is expensive, but it might also be an option if the storage device your repo was on hasn't been physically destroyed or destructively overwritten (and it wasn't an SSD).

share|improve this answer
    
Thanks Mark, you covered all the bases. I will just recreate the repository from our latest working copy. –  user21146 Sep 8 '10 at 21:07

In addition to the useful information in the other answers, you might consider this as an opportunity to look into distributed source control (DVCS, e.g. git and mercurial, I think there are others as well). With a DVCS each user has a copy of the repository, providing more redundancy, reducing the risk of losing the full repository.

There is a very nice online book about git here: http://progit.org/

share|improve this answer
1  
+1 for taking the opportunity to migrate to git (or another distributed version control system, like Mercurial). You may have just lost all your history, but taking advantage of the disaster can net you some long-term wins... –  voretaq7 Sep 8 '10 at 20:42
    
+1 @voretaq7: thanks for your thoughtful expansion my my answer, it motivated me to edit - taking your comment as an example of a much more useful contribution. Thank you. –  jmsmcfrlnd Sep 9 '10 at 1:25

As Mark is saying above, if you don't have a dump of the repo (from the server), you can't construct the history. An SVN checkout only contains the tip of where it is checked out. Sorry, you are SOL. I guess this is why people like distributed source control. In our company I set it up to send svn diffs to amazon s3 twice a day.

share|improve this answer
    
+1 for S3 as a inexpensive off-site backup store for SVN –  user21129 Sep 9 '10 at 0:49

If you've truly lost your repo, with no backups, then yes - its gone. There's no magic that can restore truly lost data.

So, if you have a working copy from someone, you can create a new repo and add the files to it. You lose all history (obviously) but history has already been lost.

You could send the hard drive off to a recovery company to try and get any data restored. Once you have the repo (or at least the db/revs and db/revprops directories), you can re-create the repo from them (by copying them to a new repo's directory). If it turns out you don't have the entire db then things will be a bit more tricky, but its still possible to restore the rest of the data - you may have to send it all off to collabnet and get some support from them to restore the mangled data files into a new, working repo.

Now, you say "svn export" from someone with the most recent update.... that suggests the person has a backup copy that you can export from. Is this the case, or were you confusing it with a working copy?

share|improve this answer
    
Export doesn't require the server... I just meant that we should get the export from whoever had done the latest update on their tree, so we get as close as possible to what was on the server. Thanks for the advice. –  user21146 Sep 8 '10 at 21:03

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.