How should I back up my virtual machine?

InorganicMatter

[H]F Junkie
Joined
Oct 19, 2004
Messages
15,461
We are running Windows Small Business Server 2008. I needed to run a Ruby on Rails application, so I created a virtual machine with Hyper-V installed Ubuntu+Apache+MySQL+mod_rails. Works great! :)

My question: how do I back it up? Should I just back up the entire .VHD hard disk file? Or should I install backup software inside the virtual system and back up the files themselves? Obviously, just grabbing the .VHD file is easiest, but can I do a bare metal restore with that? Would it be better to install something like Bacula and backup my the MySQL database for real?
 
My question: how do I back it up? Should I just back up the entire .VHD hard disk file? Or should I install backup software inside the virtual system and back up the files themselves? Obviously, just grabbing the .VHD file is easiest, but can I do a bare metal restore with that? Would it be better to install something like Bacula and backup my the MySQL database for real?

Bare metal means OS + applications as they were when you installed the system, not accounting for data that changed during usage.

Yes, if you create a backup of the VHD file after installation, you can use it as your bare metal backup. Once you have started to actually use the server, the VHD file will essentially give you a snapshot of your current condition at the time of the backup.

There are a number of different ways to back things up. Which solution you implement depends on your needs and available resources.

The decision making that I applied for my stuff at work went like this:

What do I think I need to back up?
Why do I need to back those things up?
What do I really need to back up based on the answer to the previous question?
How quickly do I need to be able to restore my backup?
How much space do I have available for backups?
How much time do I want to spend monkeying with my backup/restore solution?

It's tricky to give good advice without knowing the details.
From what you wrote it may be that creating a bare metal backup based on backing up the VHD, and then just scripting the actual database backup may be sufficient. Keep in mind though that your "bare metal" VHD needs to be patched every now and then which may present a significant challenge.
 
Keep in mind though that your "bare metal" VHD needs to be patched every now and then which may present a significant challenge.

What do you mean by this? apt-get dist-upgrade? How would updating the OS affect the VHD backup?
 
What do you mean by this? apt-get dist-upgrade? How would updating the OS affect the VHD backup?

Ok, so let's say you create a VM in Hyper-V with all the OS settings that you need, and all the apps that you need. Then you create a "bare-metal backup" by simply making a copy of the VHD file and store that copy somewhere.

Your VM is running along just fine, your database does its thing, yadda yadda yadda.
Then it comes time to patch your OS or app. On your running VM that's not a problem, you just patch it and are done with it.

How do you patch your "bare-metal backup" VHD that you put somewhere else?
You power it on ..., but wait ..., the settings (hostname, IP, networking, etc) are the same as your running production VM.

In Hyper-V you don't have the capacity to patch an "offline" VM. You can't create a template from a VM and patch the template either. Basically the only way to patch your backed up VHD would be to power it on such that it doesn't interfere with your running production VM, and that may require some fiddling. That's all I am saying. ;)
 
Ok, so let's say you create a VM in Hyper-V with all the OS settings that you need, and all the apps that you need. Then you create a "bare-metal backup" by simply making a copy of the VHD file and store that copy somewhere.

Your VM is running along just fine, your database does its thing, yadda yadda yadda.
Then it comes time to patch your OS or app. On your running VM that's not a problem, you just patch it and are done with it.

How do you patch your "bare-metal backup" VHD that you put somewhere else?
You power it on ..., but wait ..., the settings (hostname, IP, networking, etc) are the same as your running production VM.

In Hyper-V you don't have the capacity to patch an "offline" VM. You can't create a template from a VM and patch the template either. Basically the only way to patch your backed up VHD would be to power it on such that it doesn't interfere with your running production VM, and that may require some fiddling. That's all I am saying. ;)

Make a new backup of the VHD file if needed. If using Vista or Server 2008 you can use windows backup to automate the whole process.
 
The most efficient method of backing up VMs is to simply boot them into BARTPE or WINPE with the integration tools installed (I used to do this with VMWare Server 2.0 and ESX, and now I do it with Hyper-V Server), and simply Ghost to either a spare local drive share on the virtual host server, or over the network to a NAS device or another PC. Ghost is much more efficient than backing up VHD files, especially if you have the VHD files configured in "fixed" mode, as opposed to dynamically expanding, for performance reasons.
 
Back
Top