Windows 7: Attempting to install to VHD – an odyssey

One of the things I am most impressed about with Windows 7 is the latest Media Center. As a result, I wanted to install the build 7000 beta release onto our media PC at home. However, I already have that working nicely with Windows Vista and, frankly, I didn’t want to have to repeatedly reinstall if the beta caused problems.

The solution seemed simple: install Windows 7 to a VHD file sitting on the Vista disk. Whilst at TechEd, Mark Russinovich had mentioned that he was running Windows 7 in exactly this way, so I was pretty confident it would work.

Maybe that was my first mistake. Perhaps my second was trying Win7 x64, but when you have a 64-bit CPU why use anything less?

So, I started my quest with a 500GB hard disk which had a single partition, onto which Vista Ultimate x64 had already been installed. The disk had the thick end of 400GB free (there’s nothing installed but Vista and some codecs).

I had planned to boot from USB (the install goes much quicker that way) but whilst the BIOS of the machine saw my USB stick as a drive, the boot menu didn’t want to let me boot from it. I could have spent a while messing, but for the time it takes these days to burn a DVD, I did that instead.

So… boot from DVD into Windows 7 setup. When the first screen appears, I hit shift+F10 to get a command prompt (that’s something I didn’t know until today, and I shall be remembering it, you can bet on that!).

Once inside the command prompt I execute the following sequence of commands to create the 100GB VHD file I want to install Win7 to:

diskpart create vdisk file=c:win7beta.vhd maximum=100000 Diskpart successfully created the virtual disk file select vdisk file=c:win7beta.vhd Diskpart successfully opened the virtual disk file attach vdisk Diskpart successfully attached the virtual disk file

I then exited diskpart and the command prompt, and stepped through the install as normal by selecting a language, choosing to install, not upgrade, agreeing to the licence etc.

I then got the familiar screen asking ‘Where do you want to install windows?’. This showed my a shiny new disk (listed as disk 5) which had 97.7GB of unallocated space.

Buoyed with success, I selected the disk.

‘Windows cannot be installed to this disk. The computer’s hardware may not support booting to this disk. Ensure that the disk’s controller is enabled in the computer’s BIOS menu’ said the installer.

Darn!

I didn’t have any drivers to hand that I knew were for the system I was installing to, and I couldn’t be bothered rummaging around the web for them when I didn’t know what the chipset was. So I decided to experiment a bit…

My thinking was this: Perhaps it’s because I had Vista underneath, or perhaps if I could get Windows 7 onto the machine in some other way, I might suck the drivers out of that install. I had some time, so why not experiment…

I still wanted to keep my Vista installation, so why not clear some space on the hard disk to install to a new partition? I opened a new command prompt and started diskpart:

Select disk 0 select partition 1 Partition 1 is now the selected partition shrink desired=100000 Diskpart successfully shrunk the volume by: 98 GB

I really like that diskpart will let you shrink partitions. The fact that I can tinker with my disk layout on the fly all from within Windows 7 installation is great!

I exited the command prompt and refreshed the installation location screen. I now saw 97.7GB of unallocated space on disk 0, and chose that to install to. That ran through just exactly how you’d expect, with no issues.

At this point, however, as I watched the installation screen sitting on ‘Completing installation…’ I was thinking how doing this on a machine with no hard disk activity LED was not the best plan. Blinking lights are annoying when you’re trying to watch TV, but they’re really nice when you’re installing stuff!

Windows 7 started OK and installed a few updates. I then checked the disk controller drivers. Windows 7 was reporting ‘Standard Dual Channel PCI IDE Controller’ times two, with two each of ‘ATA Channel 0’ and ‘ATA Channel 1’.

Before attempting to find more specific drivers, I decided to try again with the VHD installation. My reasoning was that Windows 7 would now have updated the bootloader on the system, and perhaps that had some involvement in whether or not I could successfully install to the VHD.

You may be thinking that I am now drifting into the realm of folly – I have a working Windows 7 installation on the system so why continue? The answer is that I hadn’t had chance to experiment with installing to VHD before this and I wanted to get as far as I could and learn as much as I could.

Booting from the installation DVD again, I once more attached the VHD I had created on the vista drive and once more could not install. At this point, I wondered if the type of VHD had a bearing. I had failed to specify a type when I created the original VHD, meaning that it would have defaulted to being dynamic. Perhaps only VHD’s of type fixed would do the job. I therefore created a second VHD, of type fixed, called win7betafixed.vhd. Note to self – next time, choose a smaller size when testing stuff! After a good thirty minutes of staring at task manager reporting virtually no disk or CPU usage I decided that perhaps something was wrong and killed the process.

I booted Windows 7 to create the VHD through the GUI. Interestingly, Win 7 hadn’t automatically assigned a drive letter to my Vista disk in the way that Vista itself always does with multiple partitions. This time the sound of disk access and the automatic installation of a Microsoft VHD HBA device gave me more confidence. It still took a long time though…

I rebooted again and started the Win7 setup process. Once again I attached the VHD file, once again the installation routine saw the disk and once again it refused to install. At this point my frustration levels got the better of me. I will try this again on a different system, but I’m admitting defeat on the media PC.

If I have more success on other systems, or if I figure out exactly why I got nowhere with my media PC, I will let you know. My gut says that I need to find drivers for the disk controller to load during setup.

For ref, the PC is  Hyper barebones media PC  HMC-2K53A-A3) with an MSI K9AGM2, AMD 690G chipset motherboard and an AMD Athlon X2 4450e CPU.