VirtuallyAware

Experiences in a Virtual World

Archive for April 2008

Interim Backup Solution for Hyper-V

with 11 comments

The organization I belong to is part of the Hyper-V rapid deployment program which is a program run by Microsoft to get organizations to deploy production virtual servers on early RC and RTM code so that when the code is deployed to the rest of the world, they can note that they have X number of organizations already running it in production.  If you have been to any release event, these are the early adopter stories.  It also comes with great support from Microsoft and Partners who really want the early implementations succeed.  If you ever get the chance to be part of a TAP or RDP, I would recommend it.

So back to the backup script.  Being part of the rapid deployment program, and the desire to test out Hyper-V with production based virtual servers, we needed a way to protect the data that is the servers incase of problems.  Of course we could have just put a backup agent on the child servers and completed file based backups, but that can be a scheduling and resource nightmare once you get a large number of child servers on a particular parent server.  It also did not meet our standard of how we backup our servers in our Virtual Server 2005 R2 environments.  So, to mimic the success we had with backing up our Virtual Server 2005 R2 environment using the VShadow SDK, we looked for a similar solution. 

What we discovered right off the bat is, the VShadow SDK does not work on Windows 2008.  After a little reading of Windows 2008 documentation and a some Googling we came to realization that there was  a new and improved utility called DiskShadow.  What we came up with is a fairly simple compilation of a Diskshadow script and CMD files that takes live snapshots (using the VSWriter) of child servers, mounts those snapshots and then uses rob0copy to copy the files to an alternate location for backups to tape that happen during the daytime hours. 

Below are the scripts that consist of the backup procedures as it stands today.  This has already gone through many different derivatives, and I suspect this will evolve over time or maybe as others add their input.   Randy Pausch makes a good point about feedback from your peers and the inability to grow without it.  Please feel free to leave feedback.

 

Take note of line wraps.

VSBACKUP.CMD

*****************************************

REM Date Formatting
FOR /F "TOKENS=1* DELIMS= " %%A IN (‘echo %date%’) DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN (‘echo %date%’) DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN (‘echo %CDATE%’) DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ eol= " %%A IN (‘echo %CDATE%’) DO SET yyyy=%%B
SET dateStamp=%mm%%dd%%yyyy%
c:
cd vsbackup
Echo %date% %time% >>c:\vsbackup\logs\%dateStamp%_%computername%_VSBackup.log
REM Execute DiskShadow script
diskshadow /s c:\vsbackup\vsbackup_step.dsh >>c:\vsbackup\logs\%dateStamp%_%computername%_VSBackup.log
Echo %date% %time% >>c:\vsbackup\logs\%dateStamp%_%computername%_VSBackup.log

 

VSBACKUP_STEP.DSH (coordinates backup proceedure)

*****************************************

#Diskshadow script file

#Maintenance task to clear all previous Volume Shadow Copies
DELETE SHADOWS ALL

#Allow for shadow copies to be persist across program exit, reset or reboot.
SET CONTEXT PERSISTENT

#Cab location for process
SET METADATA c:\vsbackup\cab\Backup.cab

#Verbose on because knowing what is going on is good.
SET VERBOSE ON

#Start Backup process
BEGIN BACKUP

#Alias volumes for easier use in process. 
#Both Drive letters and volume GUIDs are used.
#Volume GUIDs are used for those virtual guests
# on volumes with out a drive letter.
ADD VOLUME D: ALIAS G1
ADD VOLUME \\?\Volume{ac9658ca-fa80-11dc-85fa-001b785788b0}\ ALIAS G2
ADD VOLUME H: ALIAS G3
ADD VOLUME J: ALIAS G4
ADD VOLUME \\?\Volume{6019c063-1540-11dd-b48d-001b785788b1}\ ALIAS G5

#Create Snaps
CREATE

#Maintenance script that deletes previous days file backup from
#secondary backup drives
EXEC c:\vsbackup\backupscript_maint.cmd

#Exposing of shadows and coping to secondary backup drives
#for each volume alias above.
#Using UNEXPOSE as a fallback proceedure incase Volume Shadow
#Copy malfunctions.
EXPOSE %G1% X:
EXEC c:\vsbackup\backupscript_step.cmd
UNEXPOSE X:
EXPOSE %G2% X:
EXEC c:\vsbackup\backupscript_step.cmd
UNEXPOSE X:
EXPOSE %G3% X:
EXEC c:\vsbackup\backupscript_step.cmd
UNEXPOSE X:
EXPOSE %G4% X:
EXEC c:\vsbackup\backupscript_step.cmd
UNEXPOSE X:
EXPOSE %G5% X:
EXEC c:\vsbackup\backupscript_step.cmd
UNEXPOSE X:

END BACKUP
#End of script

 

BACKUPSCRIPT_MAINT.CMD

*****************************************

FOR /F "TOKENS=1* DELIMS= " %%A IN (‘echo %date%’) DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN (‘echo %date%’) DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN (‘echo %CDATE%’) DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ eol= " %%A IN (‘echo %CDATE%’) DO SET yyyy=%%B
SET dateStamp=%mm%%dd%%yyyy%
Echo %date% %time% >> c:\vsbackup\logs\%dateStamp%_%computername%_maint.log
REM Delete directory with previous nights backup.
rd /s /q f:\%computername%
Echo %date% %time% >> c:\vsbackup\logs\%dateStamp%_%computername%_maint.log

 

BACKUPSCRIPT_STEP.CMD

******************************************

REM Reusable file copy proceedure for mounted shadows.

FOR /F "TOKENS=1* DELIMS= " %%A IN (‘echo %date%’) DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN (‘echo %date%’) DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN (‘echo %CDATE%’) DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ eol= " %%A IN (‘echo %CDATE%’) DO SET yyyy=%%B
SET dateStamp=%mm%%dd%%yyyy%
Echo %date% %time% >> c:\vsbackup\logs\%dateStamp%_%computername%_xcopy.log

REM Check to see if backup drive and directory exist.
if not exist f:\%computername% md f:\%computername%

REM Copy mounted volume data to secondary backup drives.
REM I used Robocopy for its logging and retry capabilities.
REM Any Copy proceedure would work
REM Note the exclusions that could cause problems with coping files.
robocopy X:\ f:\%computername%\ /E /V /NP /LOG+:"c:\vsbackup\logs\%dateStamp%_%computername%_xcopy.log" /ZB /R:2 /W:30 /XJD /XJF /XD $RECYCLE.BIN SYSTEM* MP* /XA:SHO
Echo %date% %time% >> c:\vsbackup\logs\%dateStamp%_%computername%_xcopy.log

So, here is the code we are using to backup the servers.  In the next post, I will go through the scripts in more detail.  Until then, send your feedback.

Rob

Written by VirtuallyAware

April 25, 2008 at 11:13 PM

Posted in Hyper-V

Update – Virtual Server 2005 R2 SP1 Hang Issues Continue, but with hope.

with one comment

The troubleshooting continues from the problems I have been having with Virtual Server 2005 SP1 (see http://virtuallyaware.spaces.live.com/blog/cns!549C424F228D6040!125.entry for the background). 

It looks like the root cause to the "Hang" problem is the hypervisor.  Not sure who’s fault it is, Microsoft or HP, but if I uncheck ALL the "Enable hardware-assisted virtualization if available" check boxes from the general properties of each guest, the "Hanging" of the guest during startups and save state restores goes away.  I also do not get the "Hang" if I disable processor virtualization on the processor in the BIOS.  I have a ticket open with MS at the moment and hopefully will get a fix.  When I do i will pass it on.  I know there is a growing number of you that are seeing similar problems.

 

-Rob

Written by VirtuallyAware

April 12, 2008 at 10:07 PM

Follow

Get every new post delivered to your Inbox.

Join 284 other followers

%d bloggers like this: