In The Mix

As a SharePoint architect I have the business behind me and the Developers and IT Pro on my shoulders.

Why Boot from VHD is not virtualization November 25, 2009

Filed under: Uncategorized — fmuntean @ 11:59 pm

Because of the marketing and the current buzz about virtualization many people think that Boot from VHD means that virtualization is used and thus a performance hit will be on your system.

Let me explain how Boot from VHD really work:

Any operating system has a boot loader that will need to recognize the file system and start loading the bits for your OS. This is the first software that is starting after the BIOS is completed.

The boot loader uses either BIOS calls or special drivers to load all the files from the OS and what Microsoft have done here is to include not only support for NTFS file system but for the VHD format too. So the boot loader can locate the VHD file then read the data from inside as needed.

Once the OS is started another driver, this time a windows driver, is used to continue and read the files and Microsoft have implement here a special disk driver that recognizes the VHD file format.

VHDDriverSo there is no virtualization involved here, all is involved is another layer of redirection until getting to the real data on the disk. What the driver does is to locate the location of the file inside the  VHD file then map that location on the host NTFS file system to be able to read the data for the real HDD. Now there is know for years already that there is actually even another redirection inside the HDD itself too, and the reason there is to be able to hide the bad sectors by remapping them.

There are few types of VHD formats:

  • Fixed VHD: This one allocates the entire size on the physical HDD and is the fastest. I would recommend to always use this type when
  • Dynamic VHD: The space gets allocated on demand however when booting from VHD is enabled the boot loader will enlarge this to the maximum specified size thus making a little bit slower because of the time that it takes to enlarge the file during boot and then resize it back when shutting down. The other problem with this type when used for boot from VHD is that  if there is not enough space you get an error and you can’t boot from it until you make the required space available. There is no much gain from using this type to boot from and lots of pain so I recommend using this type only for Hyper-V VMs.
  • Differential VHD: This type introduce yet another  redirection to a base VHD as it only contains the modified bits from the parent. This is very useful if you have multiple VHD that have small differences between them. One problem with it is that you can’t just path the parent VHD and have it propagated to all the rest. The parent VHD  should be treated as a read only and replacing it will require to replace of the differential ones too.   I don’t see much use for it in our situation as usually your VHDs are very different from each other, however in a QA environment there is much to gain from it.

In conclusion Boot from VHD is a great technology that was finally implemented in Windows (this is available in Linux for decades now). The main performance impact is actually because of the old fragmentation issue both inside VHD file and outside on the host NFTS file system. My recommendation would be to use the fixed size VHD and don’t try to gain a little bit of space by using Dynamic or Differential VHD as it does not worth the headache.

Advertisements
 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s