Recently one of repository on my SVN server is got corrupted. After checking we found that there was issue with svnrepo/db/current file was got corrupted due to bad sectors in my hardisk. I tried to checkout this repository but failed.
How to Recover Corrupted SVN Repository –
Before start recovery we should know about this file. This file contains the latest revision number of your repository. On each commit svn server increase this value by +1 and keep this on last revision.
Now If you remember the version of your repository, Just recreate new file and put that number in this file. But If you don’t remembers it, then the problem start, but don’t worry. Follow below steps to find revision number.
Enter Any Number –
Enter a number and try to keep it higher than expected last revision. In my case i have put 99999 in db/current file.
rahul@tecadmin:~$ cat db/current 99999Backup Repository –
Now use the following command to backup this repository. When you run the following command, it may end with error like below.
rahul@tecadmin:~$ svnadmin dump /path/to/repo > /backup/myrepo.dump * Dumped revision 0. * Dumped revision 1. ... ... * Dumped revision 576. * Dumped revision 577. * Dumped revision 578.svnadmin: E160006: No such revision 579 As per your output, we got that our repository have 578 revisions. You can just put this value in your db/current file. But if there are any more files corrupted, then continue to following steps.
Backup Repository Again –
Now we have the last revision number, So specify revisions from 0 to last revision to backup.
rahul@tecadmin:~$ svnadmin dump -r 0:578 /path/to/repo > /backup/myrepo.dumpRe-Create New Repository –
Now remove old corrupted repository and create new one with same name or other name.
rahul@tecadmin:~$ mv /path/to/repo /backup/rahul@tecadmin:~$ svnadmin create /path/to/repoLoad Repository from Backup –
Now load repository data from backup file using following command.
rahul@tecadmin:~$ svnadmin load /path/to/repo < /backup/myrepo.dump