How are you booting into the VHD? (So many questions. So little time. Part 43)

The following question was asked by Joobly-Goop (not his real name) at a recent TechNet Event, in the context of our doing a Boot-From-VHD configuration and then dual-booting into the Operating System that was in the Virtual Hard Disk (.VHD) file…

Server 2012 RC

I certainly understand your confusion, J.G. (May I call you J.G.?)   If I’m running an operating system from within a VHD file, which is the file representing hard disks used in Hyper-V based virtual machines, then it might make sense to assume that Hyper-V is involved in some way.  But actually, it’s not. 

VHD files are really just a standard file format that represent a container of sorts.  It represents a disk.  And if that “disk” is formatted and populated, it contains a file system. 

“You mean.. like a hard disk can contain a file system?”

Bingo.  So if I can boot and run an operating system from my mounted (and that’s the important part) hard disk, which is a container for files of an operating system, then maybe I could also mount (see?) a VHD file in such a way that the computer sees it as a hard disk containing a file system and a bootable, runnable operating system.  That’s why we talked about the requirement of having the proper “boot loader” available to you.  Windows Vista, Windows Server 2008 and newer operating systems boot and run from a boot loader that supports treating a VHD file as a mountable disk with a runnable operating system, so that you can run that operating system right on the physical hardware.

“Why would you want to do that, Kevin?”

Think about the flexibility this provides.  I can modify the boot loader (or let the operating system installation do that modification for me) to add another boot option that is really just a file (.VHD) on my hard disk.  I can use it on my physical machine.  And when I’m done, I just remove that entry from the boot-loader; all without disturbing any other operating system install (physical or .VHD based).

And what about using this capability to support quick deployments?  If I can deploy an operating system to a bare-metal machine that doesn’t yet have an operating system simply by scripting the configuring a boot loader and copying a .VHD file to it.. that’s a pretty quick deployment.  And that is exactly what Virtual Machine Manager in System Center 2012 is doing when it supports deploying .VHD files containing Microsoft Hyper-V Server for you when you take advantage of bare-metal deployment for new virtualization hosts.

Fun Fact: This capability was originally created to support the quick deployment of operating systems and virtualization onto the millions of physical servers that support Windows Azure .

So to summarize my answer to your question J.G…

Required: A Boot-loader that supports it

Required: VHD file that has a bootable operating system inside of it

NOT Required: Hyper-V.

For those of you interested in learning more about Boot-From-VHD, how it works and how to configure it, check out these further resources:

Understanding Virtual Hard Disks with Native Boot

“How to Boot from a VHD” TechNet Wiki Article

“Windows 7 Boot From VHD”

---