tags:

views:

455

answers:

6

Hi all

I am currently moving my SVN server from my home server to my remote server so I can access it more easily from other locations. My remote server is not backed up so I want to regularly back it up to my home server.

Remote server is Windows 2003 server. Home server is Windows Home Server.

What is the best way to do this? can I get my home server to get a dump of the remote server every night? Bandwidth isn't a huge consideration but if I could just copy any new checkins to an SVN server on my home server that would be fine.

Any suggestions welcome.

Thanks

+2  A: 

You can use a script on a remote server which dumps the repository, then copies it to your local computer (or leaves it in a predefined location for your local computer to copy)

You can either sync the backup directories with rsync or scp.

The script can be run with "Scheduled Tasks" and can produce uniquely named backup files, which will later by synced in the above mentioned way by your local computer. (and then possibly deleted)

EFraim
+2  A: 

EFraim mentioned rsync while I wrote this so that's covered.

If you don't want to work with that, the Subversion Book offers the svnadmin dump --incremental option explained here:

However, to do this successfully, you have to juggle with revision numbers - rsync'ing the raw repository data directories will be easier.

The hard part will probably be setting up rsync so your local and remote machine can communicate securely (i.e. set up an SSH service on the 2003 server). DeltaCopy that Wim mentions is very interesting and would be my first shot; for command line operation only, here is a howto on how to get Rsync running as a service on Windows 2003.

Pekka
+3  A: 

rsync (or DeltaCopy which is a Windows UI on top of it) would be a good choice to incrementally copy the complete repository at the filesystem level.

You can also use svnsync to copy new revisions directly from one SVN server to another.

Wim
The issue with using rsync though is if you are copying the repository while someone is making a change the copy could become corrupted. svnsync is much safer than just copying the repository.
Yes svnsync would be the preferred solution. It's only supported on SVN server since I think version 1.6, but that seems to be widely deployed now.
Wim
+11  A: 

Just use the svnsync command.

First, create a fresh repository on your home machine.

svnadmin create c:\backuprepo

Next, create a file named pre-revprop-change.bat:

echo exit 0 > c:\backuprepo\hooks\pre-revprop-change.bat

then, initialize the sync:

svnsync init file:///c:/backuprepo https://url/of/your/repository

After that, you can simply run

svnsync sync file:///c:/backuprepo

once a day or so, and you'll get only those changes which are not yet in your backup repository. The first time it will take a while, but after you've synchronized your backup repository with the real one, it will only take a few seconds to sync it because only those revisions that are new need to be synched.

Stefan
I'd vote this up twice, if I could. Unlike the other answers posted here, this one is actually correct. rsync: isn't certain to capture the repository in a consistent state. bdb repositories aren't binary-compatible across platforms. svnadmin dump requires access to the server.
bendin
+1  A: 

create your local repository

svnadmin create /Users/jsmith/repo

create an empty pre-revprop-change hook script

echo '#!/bin/bash' > /Users/jsmith/repo/hooks/pre-revprop-change

make the pre-revprop-change hook script executable

chmod +x /Users/jsmith/backup/hooks/pre-revprop-change

initialize svnsync

svnsync init file:////Users/jsmith/repo https://www.smith.com/repo

synchronize repos

svnsync sync file:////Users/jsmith/repo

yanokwa
A: 

I would use either svnsync or svnadmin hotcopy as both of these techniques are guaranteed to copy valid data from the repository, even if a transaction is in progress. Other file synchronisation techniques may not be as reliable, depending upon the repository format.

Damian Powell