Wednesday, April 16, 2008

This is how I'm backing up my Virtual Servers

I've been trying to figure out a way to backup my virtual servers unto a External USB Hard drive. This server will be our disaster recovery server and the facility where it will be hosted does not do backup tapes. So I wanted a way to back to a 1TB hard drive. I thought about the online backups, but they were going to be too expensive for the size that we have and toooooooo slow. Have you every tried to restore from one of those sites? I've had customers do it and it takes forever.

I looked at many scripts that our out there. Most caused my VM to hang. The one that I settled on is from: http://blogs.msdn.com/adioltean/archive/2005/01/20/357836.aspx
His name is: Adi Oltean

His script creates a Shadow Copy and mounts it to a Drive. For instance, his script will take a shadow copy of my D: drive where my Virtual Servers reside and mount them to my H: drive. I don't have an H: drive normally, but his script will mount this volume(Shadow Copy) that is created to whatever drive you select that is not already in use.

From there you can go to your H: drive or whatever drive you selected and view copy of your Virtual Servers.

This is great. From here I copy the files to my USB Hard drive which I have mounted as my Q: drive. Because the files that are now on H: are not in use, you can copy them without any file in use errors.

Here is what I've done.
I created a small script that start off my unmounting the volume from H: that was created the night before. I then call for Adi Oltean's script to create the Shadow Copy and mount it to my H: drive. Then I start a xcopy command to copy it over to my backup folder on the Q: drive. Remember the Q: drive is my external USB Hard drive.

@echo This will remove the mounted volume.
mountvol H:\ /D

@echo This script will create a shadow copy and mount it to H:
createshadow.cmd D: H:

@echo This will copy the Virtual Server to Q:\backup.
H:
xcopy /E /Y "virtual servers" Q:\backup\

So on my D: drive I have my script which is the one above that I call backupVMs.bat and Adi Oltean's script createshadow.cmd. I setup the task scheduler to run every night. It takes about 6 hours to backup my approximately 660 Gigs.


No comments: