Hi,
I've been asked to share how I solved to backup open and locked Files
under Windows 2003 using ShadowCopies - so here it goes.
Please notice that everything I describe here is just ?puzzeled? together
from various sources ? my own scripting skills are very limited ?
so maybe you?ll come up with a more elegant solution after reading this?
Basically I stumbled across this Post on Adi Olean?s Weblog (Antimail):
Attack of the clones: how to assign a drive letter or directory to a
shadow copy
http://blogs.msdn.com/adioltean/archive/2005/01/20/357836.aspx
The above works only on Windows 2003 Server ? but here is another Script
from Adi Olean that will copy a single opened file and that one should
work under XP as well:
Script recipe of the week: how to copy an opened file
http://blogs.msdn.com/adioltean/archive/2005/01/05/346793.aspx
For theses scripts to work you?ll need the VSHADOW.EXE which is part of MS
VSS SDK. Explained in more detail here:
http://blogs.msdn.com/adioltean/archive/2004/12/30/344476.aspx
I have to backup Windows 2003 Servers ? so I chose the simple approach to
call the first batch script as a backuppc predump script, which gives me a
shadow copy of an entire volume (say C:) and mounts it under another drive
letter (say X:). I extended the script slightly to create a backup of the
systemstate with ntbackup and to write out a RemoveShadowCopy Batch which
than can be called as postdump once backuppc has finished.
I use cwRsync Server from http://itefix.no/cwrsync on the windows server ?
which is a nice lightweight combination of an sshd and rsyncd for windows.
So I do backup the windows server via rsyncd and call the predump/postdump
scripts via ssh. But everything else should work just fine - ...
My variation of the CreateShadow.cmd looks like this:
*************
REM --- Parameter %1 sourcevolume,
REM --- Parameter %2 driveletter for shadowcopy,
REM --- Adjust C:\Programme\cwRsyncServer throughout the script to a
directory of your choice and copy this batch script and vshadow.exe in it.
cd C:\Programme\cwRsyncServer
setlocal
if NOT "%CALLBACK_SCRIPT%"=="" goto :IS_CALLBACK
set SOURCE_VOLUME=%1
set DESTINATION_VOLUME=%2
REM --- Call ntbackup to dump the systemstate on C: leave this out if you
don't want it
del C:\systemstate*.bkf
ntbackup backup systemstate /J "Systemstatus" /F C:\systemstate_%date%.bkf
set CALLBACK_SCRIPT=%~dpnx0
set TEMP_GENERATED_SCRIPT=GeneratedVarsTempScript.cmd
%~dp0\vshadow.exe -nw -p -script=%TEMP_GENERATED_SCRIPT%
-exec=%CALLBACK_SCRIPT% %SOURCE_VOLUME%
del /f %TEMP_GENERATED_SCRIPT%
@goto :EOF
:IS_CALLBACK
setlocal
call %TEMP_GENERATED_SCRIPT%
%~dp0\vshadow.exe -el=%SHADOW_ID_1%,%DESTINATION_VOLUME%
IF "%DESTINATION_VOLUME:~-1%"==":" SET
DESTINATION_VOLUME=%DESTINATION_VOLUME:~0,-1%
REM --- Write out a postdump script that removes the ShadowCopy
@echo cd C:\Programme\cwRsyncServer >
RemoveShadow_of_%DESTINATION_VOLUME%.cmd
@echo VSHADOW.EXE -ds=%SHADOW_ID_1% >>
RemoveShadow_of_%DESTINATION_VOLUME%.cmd
********
I call this batch script form backuppc like this:
# Pre & Post Dump Script
$Conf{DumpPreUserCmd} = '$sshPath -q -x -l SvcwRsync $host
/CreateShadow.cmd c: x: systemstate';
$Conf{DumpPostUserCmd} = '$sshPath -q -x -l SvcwRsync $host
/RemoveShadow_of_x.cmd';
Make sure that your rsyncd.conf on the windows machine reflects the
?swapping? of the drive letters!
In my example backuppc should dump x: therefore the rsync.conf looks like
[cDrive]
path = /cygdrive/x
comment = Entire Drive
exclude = "pagefile.sys" /cygdrive/x/System\ Volume\ Information/
/cygdrive/x/System\ Volume\ Information/** /cygdrive/x/RECYCLER/
/cygdrive/x/RECYCLER/**
Now if you want to restore something ? you must change this back to
[cDrive]
path = /cygdrive/c
Or your restore will fail! ? this can be easily done if you keep two
rsyncd.conf files around and swap them depending on what you are doing
(backup/restore).
Keep in mind that ShadowCopies are not the magic answer for backing up
open Databases !
If you want to backup Exchange/SQL Databases this way be sure to read at
least the comments on
http://blogs.msdn.com/adioltean/archive/2005/01/20/357836.aspx
Have fun !
Dominik Hoffmann
IT-Administrator
-----------
Ortszeit: Montag, 2. April 2007 20:03:30 (GMT+01:00) Amsterdam, Berlin,
Bern, Rom, Stockholm, Wien
wob AG
Werner-Heisenberg-Strasse 6a-10
68519 Viernheim
ICQ: 119783709
http://www.wob.ag
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/