Jump to content



Photo

How do you backup SVN?

visualsvn

  • Please log in to reply
6 replies to this topic

#1 -Alex-

-Alex-

    Noob Hunter

  • Joined: 08-August 06
  • Location: Oslo, Norway

Posted 06 January 2013 - 04:28

I'm wondering if I have all bases covered, so how do you backup your repos?

I have the following batch script running on a scheduled task, which creates a 7-zip file like this:

SVN backup 7-zip file.png

Looking for any input - thanks a lot! :)

@echo off
echo Backing up SVN... do NOT close!
echo.
echo.
for /f "tokens=1-4 delims=/ " %%a in ('date /t') do (set bdate=%%c-%%a-%%b)
for /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set btime=%%a-%%b)
cd %temp%
rd /s /q svnbackup >nul 2>&1
md svnbackup
cd svnbackup
md certs
md conf
net stop VisualSVNServer >nul 2>&1
svnadmin dump --deltas --quiet S:/Customers > Customers.dump
svnadmin dump --deltas --quiet S:/Internal > Internal.dump
net start VisualSVNServer >nul 2>&1
for %%I in (S:\authz S:\authz-windows S:\htpasswd C:\INTERNAL\SVN\Backup.bat) do copy %%I . >nul
copy "%VISUALSVN_SERVER%\certs\*" certs >nul
copy "%VISUALSVN_SERVER%\conf\*" conf >nul
"%ProgramFiles%\7-Zip\7z.exe" a -mx9 %bdate%_%btime%.7z *
move *.7z C:\Users\DB\Dropbox\Backups\SVN >nul
cd ..
rd /s /q svnbackup >nul 2>&1



#2 Kamil Kowalski

Kamil Kowalski

    Resident One Post Wonder

  • Joined: 05-January 13

Posted 07 January 2013 - 02:02

I'm wondering if I have all bases covered, so how do you backup your repos? I have the following batch script running on a scheduled task, which creates a 7-zip file like this: SVN backup 7-zip file.png Looking for any input - thanks a lot! :)

@echo off echo Backing up SVN... do NOT close! echo. echo. for /f "tokens=1-4 delims=/ " %%a in ('date /t') do (set bdate=%%c-%%a-%%b) for /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set btime=%%a-%%b) cd %temp% rd /s /q svnbackup >nul 2>&1 md svnbackup cd svnbackup md certs md conf net stop VisualSVNServer >nul 2>&1 svnadmin dump --deltas --quiet S:/Customers > Customers.dump svnadmin dump --deltas --quiet S:/Internal > Internal.dump net start VisualSVNServer >nul 2>&1 for %%I in (S:\authz S:\authz-windows S:\htpasswd C:\INTERNAL\SVN\Backup.bat) do copy %%I . >nul copy "%VISUALSVN_SERVER%\certs\*" certs >nul copy "%VISUALSVN_SERVER%\conf\*" conf >nul "%ProgramFiles%\7-Zip\7z.exe" a -mx9 %bdate%_%btime%.7z * move *.7z C:\Users\DB\Dropbox\Backups\SVN >nul cd .. rd /s /q svnbackup >nul 2>&1



#3 +DonC

DonC

    Neowinian

  • Joined: 16-August 07
  • Location: England

Posted 07 January 2013 - 02:15

I just use a scheduled svnsync to back mine up to another computer.

#4 OP -Alex-

-Alex-

    Noob Hunter

  • Joined: 08-August 06
  • Location: Oslo, Norway

Posted 07 January 2013 - 03:38

<snip>

Not exactly the answer I was looking for, but thanks for the effort, and welcome to Neowin! :)

I just use a scheduled svnsync to back mine up to another computer.

Thanks Don. The only off-site service I have to backup to though is Dropbox.

#5 +BudMan

BudMan

    Neowinian Senior

  • Tech Issues Solved: 93
  • Joined: 04-July 02
  • Location: Schaumburg, IL
  • OS: Win7, Vista, 2k3, 2k8, XP, Linux, FreeBSD, OSX, etc. etc.

Posted 07 January 2013 - 17:51

Just use svnsync to copy the files to your dropbox folder. Or have your script place your 7z files in the dropbox folder - and then dropbox will sync them to the cloud and there you go a backup and DR all at the same time.

#6 OP -Alex-

-Alex-

    Noob Hunter

  • Joined: 08-August 06
  • Location: Oslo, Norway

Posted 08 January 2013 - 01:17

Just use svnsync to copy the files to your dropbox folder. Or have your script place your 7z files in the dropbox folder - and then dropbox will sync them to the cloud and there you go a backup and DR all at the same time.

The latter of your ideas is exactly what's going on right now ;)

move *.7z C:\Users\DB\Dropbox\Backups\SVN >nul

Tell me though, when I was deciding which route to go down, it was a choice between hotcopy and dump, since these create a backup file. From a quick scan of Google, svnsync creates a replica. Which is easier to restore? Just got a VM installed to test out a restore using the file the batch script above makes... when I get a chance.

#7 articuno1au

articuno1au

    Neowinian Senior

  • Tech Issues Solved: 2
  • Joined: 20-March 11
  • Location: Brisbane, Australia

Posted 08 January 2013 - 01:25

I just robocopy the SVN into folders based on date.

So if I need to rollback the repo, I can just overwrite the files >.>