Fun with Windows 7 – VHD Boot and DISM.exe

If, like myself, you need (or want) to work with more than one Operating System on the same piece of hardware, before Windows 7, you could either create a multiboot environment using separate partitions or run a virtualisation solution like VirtualPC. Both have their pro’s and con’s, most notably:

  • Multiboot:
    • Good performance (runs natively on the machine, no extra abstraction layers)
    • Good hardware integration (everything that is built into or attached to the machine is visible to the running OS)
    • Clunky setup (different boot loaders overwriting each other, partitions cannot easily be resized or moved around)
  • Virtualisation
    • Very flexible (only takes up as much hard disk space as the solution requires)
    • Can run virtually any Operating System
    • Non-Optimal performance (running piggyback off another Operating System, consuming resource in both)
    • Marginal hardware integration (all major system components are virtual only; depending on the virtualisation solution, SOME components might be surfaced inside the virtual machine)

Enter Windows 7 with VHD Boot. Like any ingenious change, it seems so mindbogglingly simple that you keep wondering why nobody had thought of it before…

“Simply” add a storage driver that surfaces a VHD file like a physical disk, support that in the boot loader and voilà – you get a multiboot scenario with the flexibility advantages of a virtualisation solution! Amongst other things, this is an ideal scenario to non-intrusively test Windows 7 on any system, even ones currently running Windows Vista (or earlier). I use this to check out how my media centre would look like in Windows 7 before actually upgrading the machine as soon as the release version of Windows 7 comes out.

Now, the walkthrough on TechNet already gets you pretty far, I won’t bother repeating all the steps described in there, however there is one piece that was missing for my machine:

The Notebook I was trying this on (Toshiba Portégé M400) ran it’s disk controller in RAID mode, requiring a mass storage device driver before it could access the VHDs.

However, with the new DISM.exe tool included in Windows 7, this was most easily overcome:

  1. Download the driver and put the driver directory onto a USB memory stick
  2. In the TechNet walkthrough, after attaching the VHD trough diskpart, all you need to do is add the driver(s) to the offline image sitting inside the VHD. Assuming your Driver sits in directory “M:\Drivers”, all you need to do is:

DISM /Image:V:\ /Add-Driver /Driver:M:\Drivers /recurse

This effectively updates the VHD image with the necessary drivers. The rest is stock standard sysprep post-processing and I ended up with a ready-to-use Windows 7 installation.