Thursday, June 5, 2008

Update - How to backup Virtual Server in Windows 2008

I've made some changes to how I backup my Virtual servers. The other way I wasn't able to copy over the previous backup so I wasn't get the lastest backup. Here is what I am doing now.

I have 3 files that I use.
1. script.dsh
Here's the content of it.
#DiskShadow script file
set context persistent nowriters
set metadata c:\diskshadowdata\example.cab
set verbose on
begin backup
#add volume c: alias SystemVolumeShadow
add volume d: alias DataVolumeShadow

create

#expose %SystemVolumeShadow% r:
expose %DataVolumeShadow% p:
exec c:\diskshadowdata\backupscript.cmd
end backup
#End of script

As mentioned in the previous post I explained where I got this and what changes I made. The only difference from the previous post is that I'm using the P drive instead of the Q drive.

File #2 - backupscript.cmd
I:
rmdir /S /Q backup
mkdir backup
cd \backup
P:
xcopy /E /Y "virtual servers" I:\backup\
mountvol P:\ /D

After the first file creates the shadow copy of my D drive and mounts it on the P drive, I use this file to remove the previous backup (because I don't have room and for some reason it was not overwriting the previous backup) and then copy the virtual servers.
There are definitely better ways to do this, but here is what this script does.
I change to the I drive which is the drive my USB hard drive is mount to. I then remove the directory that contains the previous nights backup. I don't have room on the USB drive to house more than one backup. I then create the same directory to put the backup virtual files in. Then I switch to the P drive which has the latest mount shadow copies in and start copying just the directory that contains the virtual server files. That directory is called "virtual servers". After the copy is done then I unmount the P drive. If you don't then you will not be able to successfully run the first script the next time you run it.

File #3 - Backup.bat
C:
cd \diskshadowdata
diskshadow /s script.dsh

This file is the one that I have the task scheduler setup to use for the nightly backup. Because I don't have my pathing setup I just cd to the diskshadow directory which has all three files in and run the "diskshadow /s script.dsh" command.

I hope I didn't confuse you.

Ask if you have any questions and I will try to explain better.

No comments: