0

I was looking for a way to backup all our SVN repositories, and came across this: http://www.darcynorman.net/2006/04/05/automatically-backing-up-multiple-subversion-repositories/

Because our repositories are organized in a client / project directory structure, i changed the script into this:

#!/bin/sh

SVN_REPOSITORIES_ROOT_DIR="/var/svn/repos/"
BACKUP_DIRECTORY="/home/hyperactive/public_html/svn/"

for CLIENT in `ls -1 $SVN_REPOSITORIES_ROOT_DIR`
do

echo 'dumping client: ' $CLIENT
mkdir $BACKUP_DIRECTORY/$CLIENT

for REPOSITORY in `ls -1 $SVN_REPOSITORIES_ROOT_DIR/$CLIENT`
do

echo 'dumping repository: ' $REPOSITORY
svnadmin dump $SVN_REPOSITORIES_ROOT_DIR$CLIENT/$REPOSITORY | gzip > $BACKUP_DIRECTORY$CLIENT/$REPOSITORY'.gz'

done

After running it (it completed the backup successfully), i get the following error on every repository that was to be backed up:

<m:human-readable errcode="2">
Could not open the requested SVN filesystem
</m:human-readable>

I looked in the apache error log, and this is what i found:

(20014)Internal error: Can't open file '/var/svn/repos/Test2/Test3.gz/format': No such file or directory, referer: http://10.4.2.254/svn/Test2

The way i see it, somehow the backup script added the .gz at the end of the repo path ([...]Test2/Test3**.gz**). After further cheking i noticed the single quotes surrounding the .gz extension in the script.

Any thoughts ?

3 Answers 3

2

Ok, i'm feeling very embarassed right now ... it seems that everything was ok, but since i had the brilliant idea of saving the backups in public_html/ with the exact same directory structure as the repositories, and had a in an Apache conf file, somehow the .gz files were being treated as repositories.

To clarify, i had the following structure for the backups:

public_html/
    svn/
        CLIENT/
            PROJECT.gz

... and this one for the repositories:

/var/svn/repos/
    CLIENT/
        PROJECT/

in a Apache conf file i had:

<Location /svn>
    DAV svn
    [...]

When navigating with the browser to /svn, i encountered the specified error. Renaming or moving the backup folder from public_html/ solved the problem and made me feel stupid.

1
  • Well that explains a lot - I didn't even consider your backup path (other than it was legal and ended in a '/') - Big oops on my part.
    – Chealion
    Jun 16, 2009 at 16:17
0

If you descend into /var/svn/repos, are the backup archives listed there? /var/svn/repos/Test2/Test3.gz should not exist as such; it only exist in /home/hyperactive/public_html/svn

1
  • No, they are not in /var/svn/repos, they are indeed in /home/hyperactive/[...] Jun 16, 2009 at 14:48
0

In the script - to clarify:

Repositories are laid out as follows:

/var/svn/repos/CLIENT/REPOSITORY_NAME? Test2 is the client and Test3 is the repository in your example? It's unclear.

Removing those folders should fix the issue (I recommend moving them before actually running rm on them)

for CLIENT in `ls -1 $SVN_REPOSITORIES_ROOT_DIR`
do

 echo 'dumping client: ' $CLIENT
 mkdir $BACKUP_DIRECTORY/$CLIENT

Where is the done to finish the loop? It's not added to the question - I'm assuming it's at the end of the file.

The '.gz' with single quotes is added to make sure .gz is added to the gzip file and not part of the variable $REPOSITORY

I gave the script a run myself - and it worked fine.


Old Answer

Have you unzipped the backup?

The line svnadmin dump $SVN_REPOSITORIES_ROOT_DIR$CLIENT/$REPOSITORY | gzip > $BACKUP_DIRECTORY$CLIENT/$REPOSITORY'.gz' dumps the subversion repository and then zips it up into one smaller file. Try running unzip REPOSITORY.gz and your folder structure will be revealed.

1
  • The problem is with the repos after backing them up, not with the resulting zipped dumps. After running the script that made the dumps, the repos that were backed up broke. Jun 16, 2009 at 14:34

You must log in to answer this question.

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