Top 10 Windows Server 2008 R2 Features #10: Boot from virtual devices
Last month, Microsoft made available to its TechNet partners the first release-to-manufacturing code for Windows Server 2008 R2, the next edition of the server operating system that premiered in January 2008. While I've said here before that I feel Windows 7 is "Vista service pack 3" (and I meant that in a good way), Microsoft is right up front about the fact that R2 is the Windows 7 kernel applied to WS2K8, the result of that alone being an immediate improvement in the system.
But there are other bonuses as well -- so many, in fact, that it took me much more time than I anticipated to pore through the multiple lists of new features, research the potential impact of each one, confer with others as to their significance, and peek into how they are already impacting businesses' deployment plans. In a number of key aspects, WS2K8 R2 is actually the complete package that WS2K8 should have been, minus the Vista core that led some shops to stick with Windows Server 2003.
As server operating systems evolve, the virtual OS is actually becoming the real OS -- the fact that it is hosted within another OS does not de-legitimize it any more at all. In fact, it enables administrators to strip the host OS down to the bare bones, as with Hyper-V, so that the server's integrity no longer is dependent upon the structure of its installation or even the current working order of its hardware. If a security issue takes down a virtual server, it can be immediately replaced.
But one reason systems analysts and architects designed their servers this way is to enable their entire setups to be representable by a single file: the virtual hard disk (VHD) on which virtual OSes are installed. As long as a master record exists of what the VHD should look like, then just like a backup of a spreadsheet template, if one should go down or get lost, it can be replaced from the master. In some cases, having the VHD boot a virtual OS isn't even the true benefit here, but rather simply having a single file represent the way the entire server OS should work. (Getting it to fit on a USB thumb drive is a plus, though.)
With R2, Microsoft has recognized this fact, and has responded by enabling a revolutionary, if obvious, new feature that turns the operating system concept upside down a second time: the ability to boot the physical OS, the one at the processor level, from a virtual hard drive.
"I mean think about it. You go to look at a hard drive and there's a single file but Windows Server 2008 R2 is installed inside it," writes TechNet blogger Keith Combs. "This would certainly simplify the ability to boot your servers on a completely new environment with little effort. This is going to turn change management on its ear."
This capability actually also exists within Windows 7, and if you're familiar with some command line tools and with how Microsoft changed (read: "improved") the boot table manager for Vista/WS2K8, creating a bootable VHD takes an astonishingly short period of time...once you get the technique right. It took me three tries, but I got it. Part of the problem has to do with the fact that not all the new WS2K8 R2 techniques are not fully documented yet, so the tutorials that Microsoft and its MVPs have presented thus far are not yet thorough. For example, some folks forget to mention that the VHD needs to be "sysprepped" (using SYSPREP.EXE) before you enroll it as a native boot device -- doing this strips the OS image of any and all direct ties to the physical hardware on which it was natively installed.
But the principles are actually stone-cold simple: With R2 and Win7, the boot table manager has been augmented to handle VHD as a device type, and the BCDEDIT utility (the same one you use to edit the boot menu on a dual-boot system) now lets you register a VHD as a boot device. Here are the basic concepts of the steps you'll take:
1. Create a virtual machine using Hyper-V Manager in WS2K8 R2 (or in Windows 7, using either the Windows Virtual PC RC add-on, or the Computer Management MMC panel. You know...from the Start menu, right-click Computer, and select Manage. Surprise, under Storage -> Disk Management is the new option Create VHD). Do not use Virtual Server 2005 or VS 2005 R2 or the old Microsoft Virtual PC; its VHD files will not be bootable. (I know, I've tried.)
2. Set up your master OS VHD by installing all the roles, functions, and applications it requires.
3. From the virtual machine, use SYSPREP.EXE to "generalize" the setup, which involves the tool undoing all the Registry settings that bind the OS to the machine (real or virtual) in which it's installed. That way, once the system boots up again, it relearns what it needs to know about its hard drives, processors, and display (and I know I've already set some cogs in motion with regard to Windows activation -- settle down, folks).
4. Use BCDEDIT.EXE from a command line (with administrator privileges, of course) to edit the Windows Boot Menu, so that the VHD becomes one of the options, similar to booting different OSes from separate partitions.
Now, when the VHD boots for the first time, just like the final stage of OS installation, it will detect the specifics of the physical environment in which it's running -- unlike the case when it's running within a hypervisor host. So the VHD-based OS will take advantage of the real Intel or AMD processor, and the real Nvidia or ATI graphics hardware. If you need the VHD to be portable among different physical devices with varying profiles, just use the sysprepped master.
Microsoft's enabling Windows Server to be physically run from a virtual device represents a complete and long-awaited acknowledgment from the company (among several others, particularly with the R2 release) that a server OS does not have to "be Windows" -- it doesn't need to run Office and Media Player, or use transparent Aero frames. It can be the Windows kernel, plus the things that make it useful as a server, minus the components that are only necessary in a client environment. It's been Microsoft's failure to truly act on its endorsement of this viewpoint up to now that has kept the versatile, adaptable Linux entrenched on many servers. So now that Windows is really acting like a server should, there's no further reason for Linux admins to keep saying they have no competition.