Glo Networks Technical Blog (Glo Blog)

Glo Networks team sharing their technical experiences and thoughts.

Hyper-v Backups

hyper-vThere are a few different ways you can backup your virtual servers from Hyper-v, in older version’s of Symantec Backup Exec you could backup the virtual server hard drive files just like any other files.  Symantec more recently released a Virtual Server agent, it allows you to backup virtual servers while adding the ability to restore files from within the virtual server with out having to retore the entire vhd.

The main problem with the Virtual Server agent is that it costs just over £1000, almost twice as much as Backup Exec itself. The other way is to copy the virtual server hard drive files either manually or using a script, we have tried this in the past and found it to not be 100% reliable.

The way we do it now is using scripts that use the hyper-v volume shadow copy service, this can backup all virutal servers with out causing any problems.

There are 3 scripts -

1.Main.bat

set srca=V:\Data\VServers
set srcb=V:\Data
set bkf=E:\
set log=C:\Data\Scripts

C:
CD %log%

echo ======== Job Start ========  > backup.log
echo Source A : %srca% >> backup.log
echo Source B : %srcb% >> backup.log
echo Backup Location : %bkf% >> backup.log
echo %date% %time% >> backup.log

IF NOT EXIST E:\ GOTO NOUSBDRIVE
echo Starting backup

E:
DEL *.* /S /Q
C:
CD %log%
diskshadow /s 2.Shadow.dsh >> backup.log
CD %log%
del *.cab
echo %date% %time% >> backup.log
echo ====== Complete Copy ======  >> backup.log
exit

:NOUSBDRIVE
C:
CD %log%
echo NO USB drive found! >> backup.log

2.shdow.dsh

set context persistent
set verbose on
begin backup
add volume C: alias systemvolumeshadow
add volume D: alias datavolumeshadow
writer verify {66841cd4-6ded-4f4b-8f17-fd23f8ddc3de}
create
expose %systemvolumeshadow% v:
exec 3.CopierA.bat
unexpose v:
expose %datavolumeshadow% v:
exec 3.CopierB.bat
unexpose v:
end backup
delete shadows id %systemvolumeshadow%
delete shadows id %datavolumeshadow%

3.CopierA.bat

xcopy %srca% %bkf% /Y /E
  • Stumbleupon
  • Delicious

Leave a Reply