TL;DR: Windows 8 added support for SSD TRIM commands in its VHDX format, making very easy to boot from a virtual drive on an SSD drive. This allows to never install Windows directly on a physical disk anymore, easing backups, cloning and virtualization. It also allows for very easy migration between different versions of Windows 8.

It's been a very interesting year with Windows 8. We've been fed with two new releases since the Build conference, the Consumer Preview and Release Preview, and now it's the RTM that's coming along in August.

With all these releases to play with, it's a game of install, re-install and co-existence of multiple windows instances on my machine.

I do not like losing to much time staring at my computer while it reinstalls everything from scratch, particularly Visual Studio, and both booting a physical machine from VHD and/or virtualizing it Hyper-V has been very helpful to save time.

[more] 

Moving through Windows Installations

Here’s what I’ve been doing to save some time:

  • Install Windows 8 Consumer Preview (CP) from a USB drive in a VHD file
  • While running the Windows 8 CP, install the Windows 8 Release Preview (RP) in an Hyper-V Virtual Machine,
  • Boot on the Windows 8 RP VHD, run the Windows 8 CP in a Virtual Machine to be able to compare behaviors, and migrate settings between both installations.

This is a real time saver, because both instances can run at the same time, meaning that I can continue working with my previous setup while I create the new setup. Cool stuff!

 

Boot on VHDX, The new VHDX format and SSDs

Windows has had the feature to boot a VHD drive since Windows 7. It is very useful to avoid scrapping your actual hard drive to install a new instance of Windows. Your Windows instance runs directly on the hardware, except for the boot disk that is virtualized. It adds a small cost to the performance of the storage device, but the flexibility is a big gain. That is, unless you're on an SSD drive.

In Windows 7, the aging VHD format was not made to support the new TRIM command, which allows the system to report unused blocks of a partition back to the drive, so it can improve the lifetime of the drive. Windows 7 not supporting TRIM through VHD means that putting a VHD on an SSD drive would not be a very good thing for the performance of the SSD drive. The reason for this is that the VHD file may be totally unused, but the file is still placed on the disk, reserving space and ultimately degrades the disk performance (and its life-time).

In Windows 8, the new VHDX format has been introduced, and it now supports TRIM compatible drives, making it a viable solution to put a VHDX directly on an SSD drive.

 

Never installing on a bare disk anymore

The VHDX abstraction adds a layer on top of the original drive. This adds a performance hit, particularly when using dynamically expanding drives. This can make contiguous content in the VHD be non-contiguous on the physical drive, which forces the head to seek a bit more than it should.

However, on an SSD drive where the seek time is very small, impacts of running in a dynamically expanding VHDX are almost irrelevant.

I’ve then decided to never install windows directly on a disk, now that I know that the VHDX supports SSDs. This will make backup, cloning and virtualization a lot easier to do. If I need more performance for a particular Windows instance, I can move the VHDX files around and place them on an SSD drive, and store the other on a multi-terabytes drive.

 

Virtualizing your current drive

I had installed the Windows 8 RP directly on my SSD drive, and I wanted to virtualize the disk to be able to install another Windows instance.

Hyper-V has the ability to do just that, and it is fairly easy to do. Here’s how to do it:

  • Install Windows 8 RP in a VHD, so you can access your original drive exclusively
  • Launch the Hyper-V manager
  • Create a new virtual machine, but do not attach a new drive
  • In the virtual machine settings, create a new VHDX drive, set its size, type and location
  • When a the “Configure Disk” step, use the “Copy the contents of the physical disk” and select the drive where your windows is installed
  • Click finish, wait a bit until the copy finishes and you’re done!
  • Run the VM and your originally bare installation of windows is now working.

Note that you should not be booting your computer on the copied VHDX, unless the partition that contains the original windows has been formatted.

If you do not do this, the Windows installation in your VHDX will be completely destroyed by the fact that the same partition ID exists twice on the system, and that the original partition will take over, forcing the Windows instance on the VHD to remap all the installation paths… An unrecoverable mess, in other words.

Also, you may not be able to mount the VHDX file (using the awesome out-of-the-box explorer right-click extension in Windows 8) unless you change its Unique ID using the Diskpart tool.

Finally, while I do not recommend doing it, I’ve been able to virtualize the disk for which the current Windows was running on, and it seems to work perfectly. I’m a bit puzzled on how that is actually working, because the content of the drive can change during its copy, but maybe the transactional features of the NTFS or VSS are at work…

Happy Windows 8’ing :)