Boot2VHD-Part 1-Overview of Native Boot To VHD


Native Boot To VHD (Boot2VHD) – Everything You Need To Know…

In this multi-part video series we will dive deep into a the new virtualization feature built into Windows Server 2008 R2 and Windows 7. It is called Native Boot To VHD (AKA: Boot2VHD). This is the one virtualization platform that allows virtualization inside of the virtualized machine. Yes, you can run Hyper-V or Virtual PC from inside a Boot to VHD machine. There are lots of use cases for this technology; we will cover many of them. Just dual boot your machine to a drive that is a VHD file.

It is very clean, as the entire OS is in a VHD file. Having the OS fully encapsulated in a VHD means no changes are needed to partitions, and there is no confusion as to what files are for what OS. We will look at how to deploy it in different scenarios and we will take a deep dive into the boot technology (BCDEdit) that makes this new feature possible. Upon finishing this video series you will know how to setup a system with Boot To VHD. You will be able to deploy Windows 7 or Windows Server 2008 R2 in a VHD on a machine that is already running a new OS, or on a machine with nothing on it yet (bare metal). We even go through the process of having to add the raid drivers for the disk while setting up the boot to VHD.

TechNet Video: (Part 1) Overview of Native Boot To VHD

 

the player will be placed here

Download
WMV Download | WMA | MP3

Transcript: Details of Coverage of this Video

·         Introduction to Native Boot To VHD (Boot2VHD)

o   The VHD file format has become the standard for drive images.  They can be Fixed or Dynamic.  Fixed are larger because they are automatically expanded to take up the full capacity of VHD regardless of how much free space might be available.  This makes them a tad faster but much slower to deploy because it takes longer to move such large files.  Dynamic disks are much smaller.  They are only as big as the actual space used on the disk plus some header and footer data.  This makes them much faster to deploy.  The VHD’s used for Boot to VHD is the same file format as is used in Virtual PC, Virtual Server and Hyper-V.  

o   Windows 7 not supported: Starter, Home Basic, Home Premium, Professional

o   Server 2008 R2 not supported: Foundation Edition

o   There are a number of tools you can use to work with Boot to VHD.  Many of them are simply different ways of doing the same thing.  We will look a DiskPart, the Disk Management MMC and BCDedit in a bit more detail.

o   Transition: Before we get into that, let’s take at some of the benefits of Boot to VHD

o   Tools more details …

o   DiskPart   A command-line tool that you can use to create, attach, and detach VHDs. You can also perform more advanced tasks like compacting, expanding, and merging VHDs. For more information, see DiskPart on Microsoft TechNet (http://go.microsoft.com/fwlink/?LinkId=128458).

o   Disk Management   A Microsoft Management Console (MMC) snap-in that you can use to create, attach, and detach VHDs.

o   BCDEdit   A command-line tool that you use to manage boot configuration data (BCD) stores. For more information, see BCDEdit on Microsoft TechNet (http://go.microsoft.com/fwlink/?LinkId=128459).

o   BCDBoot   A command-line tool that you can use to manage and create new BCD stores and BCD boot entries. BCDBoot can be used to create a new boot entry when configuring a system to boot from a new VHD. For more information, see BCDBoot Command-Line Options on Microsoft TechNet (http://go.microsoft.com/fwlink/?LinkID=155166).

o   Deployment Image Servicing and Management (DISM)   A command-line tool that you use to apply updates, drivers, and language packs to a Windows image. For more information, see Deployment Image Servicing and Management Technical Reference on Microsoft TechNet (http://go.microsoft.com/fwlink/?LinkId=155029).

o   Windows Hyper-V Manager   An MMC snap-in that supports VHD image creation. You can specify the type and size of VHD and install Windows from a CD or DVD, or from an ISO Image file. The Hyper-V Manager is only available on computers that are running Windows Server 2008 or Windows Server 2008 R2 with the Hyper-V role installed.

o   Sysprep   A tool that enables you to remove user and computer-specific data from the operating system image. This enables you to capture the image and deploy it to other computers. For more information, see Sysprep Technical Reference on Microsoft TechNet (http://go.microsoft.com/fwlink/?LinkId=155027).

 

·         Benefits and Performance

o   With Boot to VHD you are NOT running on a virtualization platform, you are running directly on the hardware using native drivers for devices.  The only synthetic driver will be for the VHD storage.

o   Since you are running on native hardware,  you CAN run a Windows Virtualization Platform inside your VHD.  You can run Virtual PC or Hyper-V under a Native Boot VHD.  From a performance standpoint, you are better off running the VHD’s in your virtualization platform on a physical disk instead of a virtual disk. 

o   You can deploy exactly the same VHD file to either physical or virtual hardware.   Boot to bare metal or on a Hyper-V host and go between the two if you need to. 

o   You can use the tools we all know and understand to manage VHD‘s

o   Multiple boot typically means separate partitions which can result in waisted disk space as well as confusion.  Boot to VHD gives us ISOLATION between partitions without wasted space.  Plus if you store your data on the physical disk instead of the VHD, you can easily share data between machines.

o   Re-uasbale environments are typically used for things like development or testing, they can be very quickly deployed and they are very easy to reset to their original state.

o   Your disks can be Fixed, dynamic and even differencing.  The parents can also be differencing disk which means it supports differencing chains.

o   You will be pleasantly surprised at the incredible performance we get out of Boot to VHD.  In fact, let‘s drill down a bit more on performance.

o   A look at the I/O Queue Depth: The read performance of a VHD regardless of size of packet or random vs sequential reads, is identical to the native disk performance.

o   When writing to dynamic disks, there  is a very slight degradation in performance.  This is so slight that in most cases, it will not be noticeable to the users.  If you need rocket performance, you can use Fixed VHD or Passthru disks.  If you do not need every ounce of performance, your biggest bang is with Dynamic as the disk utilization is far superior.

·         Inside look at Boot to VHD Partitions

o   Your physical (non-VHD) installation of windows will show up as the physical C: drive.  Also, the pagefile will be on this physical volume.

o   When you Boot to VHD the Physical drive will be changed to the D: drive and the VHD drive will become the C: drive

o   Note that the physical D: drive will show available space as if the VHD is fully expanded even though it may not be.  If you try to boot a dynamically expanding VHD on a physical disk that does not have the capacity, they system will blue screen when it tries to load the disk driver!

o   These different disks are shown in Disk manager as different disks.  The Blue icon shows that it is a VHD.  The fact that it is the Boot and C: Drive, tells you it is a Boot to VHD.  Also notice the System and Page File are on the F: drive.  These are on the Physical Disk, not the VHD.

 

·         Common Scenarios

o   Offline Image Management or Disk Manager – to activate the VHD file and access it via a drive letter rather than as a –VHD file.

o   As mentioned previously the same VHD can be used in both physcal an virtual environments – may be more useful for server images in data centers where it is not always known where a server will be installed.

o   Boot new hardware without installing an OS

o   Support multiple local images (for different tasks or workloads)  – Demo Environments, Training Environments, etc.

o   Host images centrally for copying where required.

o   Use Windows Deployment Services (WDS) to deploy VHD images via network boot (PF12).

·         Installing … OS Media or Network Boot

o   Start Installation Boot2VHD-Select-Drive

o   Format Media (if doing bare metal install)

o   You should be on the “Where do you want to install Windows?” screen of the installation press Shift-F10 to drop to command prompt

o   Find installation drive (dir c:, dir d:, dir e:, etc)

o   Diskpart

o   Create vdisk file=e:BootDemo.vhd type=expandable maximum=40000

o   Attach vdisk

o   Exit

o   Click “Refresh” button

o   Select “New Drive” and perform normal installation

o   Using this method, the BCD will be updated automatically

·         Preparing for Native Boot and BCDEdit

o   Now that we have looked at installing windows to a VHD let‘s look at how to tweak the boot configuration and/or go through manually adding existing VHD‘s to a machine.

o   You need to make a note of the GUID when you copy.  If you do not, you can obtain it by doing a BCDEDIT alone. If no GUID value is entered for the {current} is assumed and you may just mess up your boot menu all together.  So… Please be careful with this very powerful tool.  If you do by chance royally mess things up, you may want to check out

o   In order to use Boot to VHD you have to have the Windows 7, Windows Server 2008 R2 Boot Manager running on the machine.  If you are running Windows Vista and want to use Boot to VHD to run a Windows 7 vhd on the same machine, you can simply install the boot manager by copying it over from a valid windows 7 installation.

o   You can create a vhd using any number of different tools that perform that function

o   Xxxx

o    

o   BCDEdit is a tool that allows you to change the Boot Configuration Data on a Windows 7 boot managed machine.  You can do things like Copy existing entries, edit entries, change the display order, change the timeout, change the default entry, turn on HAL detaction, etc.  I have a bunch of examples of proper syntax here to make it easier for you to get up to speed quickly

·         An Inside Look at BCDEdit

o   If host system is Vista SP1:

§  Replace Bootmgr and BcdEdit.exe  with Windows 7 versions (BCDBoot)

o   Create bootable VHD file

§  Disk Manager, Hyper-V Manager, ImageX, SCVMM, DiskPart,Etc

o   Copy bootable VHD to a directory on the host system

§  (e.g. ‘c:vhdBootWin.vhd’)

o   Use BcdEdit to copy the existing boot entry  (from administrative cmd prompt)

                bcdedit /copy {current} /d “Windows VHD Boot”

o   Look at the new entry

                bcdedit /v

o   Use BcdEdit to Edit the VHD system

                bcdedit /set {GUID} device vhd=[c:]vhdBootWin.vhd

                bcdedit /set {GUID} osdevice vhd=[c:]vhdBootWin.vhd

                bcdedit /set {GUID} detecthal on

o   Use BCDEdit to change  the description, default start item, menu order, timeout, etc.

                bcdedit /set {GUID} description “New Menu Description

Goes Here!”

bcdedit /set {384cb3f8-afee-11e1-af85-00155def085f} description “2012 RC W510.Camp.VHD”

                bcdedit /default {GUID}

                bcdedit /displayorder {GUID_1} {GUID_2}

                bcdedit /timeout 10

o   If using virtualization on the system…  (Make sure you cold boot after making changes)

                Enable Virtualization in BIOS

                bcdedit /set {GUID} hypervisorlaunchtype auto

o   If you make a mistake while “playing” with BCDEdit seeServer 2008 R2 or Windows 7 System Will NOT Boot After Making Changes To Boot Manager Using BCDEdit

·         Limitations

o   Native Boot is only for Windows 7 and 2008 R2

o   Native Boot does not support Hibernation

o   Sleep mode is supported

o   Native Boot does not support Bit Locker

o   No Over Allocation of Disk Space *

o   No “Nested” boot to VHD

o   Maximum size of dynamic VHD = 2TB (2048 GB)

o   Parent of Differencing disk must be on same volume

·         VHD Boot Guidelines

o   Native VHD boot requires Windows 7 Boot Manager (Bootmgr) and BCDEdit utility

o   Use BCDboot.exe from attached VHD

o   Pagefile and boot manager are outside Virtual Hard Disk (VHD)

o   Dynamic VHD expanded during boot

o   Plan physical disk free space accordingly

o   Store user data outside of the OS VHD

· Limitations

  • Native Boot is only for Windows 7 and 2008 R2
  • Native Boot does not support Hibernation
  • Sleep mode is supported
  • Native Boot does not support Bit Locker
  • No Over Allocation of Disk Space *
  • No “Nested” boot to VHD
  • Maximum size of dynamic VHD = 2TB (2048 GB)
  • Parent of Differencing disk must be on same volume

· VHD Boot Guidelines

  • Native VHD boot requires Windows 7 Boot Manager (Bootmgr) and BCDEdit utility
  • Use BCDboot.exe from attached VHD
  • Pagefile and boot manager are outside Virtual Hard Disk (VHD)
  • Dynamic VHD expanded during boot
  • Plan physical disk free space accordingly
  • Store user data outside of the OS VHD

·         Creating Differencing Disks

o   Wouldn’t it be a great feature if you could restore an operating system to its default configuration within a couple of minutes? This can easily be achieved with the help of VHD differencing disks. Differencing disk in Hyper-V or Microsoft Virtual PC are in essence the same as with Windows Native VHD boot. The disk has a parent – child relationship where all new blocks are written to the child disk, leaving the parent disk to its preconfigured state. This enables the possibility of a quick restore by replacing the differencing disk and re-enabling the parent – child relationship.  Essentially we will use the same steps as before, create VHD’s, and setup the parent – child relationship. As the final step we will need to alter the boot configuration data store to be able to boot off the differencing disks. Use the following steps to create the VHD’s and setup the relationship.

 

o   Create the VHD’s            

diskpart

create vdisk file=”D:WIN7_Diff0.vhd” parent=”D:WIN7.vhd“

exit

This takes care of creating the VHD’s and setting up the parent – child relationship. To be able to boot to the differencing disk, the BCD store will need to be updated to reflect our intended changes.

o   Update the BCD store.

                BCDEdit.exe /set {GUID}  device VHD=[D:]Win7_Diff0.vhd

                BCDEdit.exe /set {GUID}  osdevice VHD=[D:]Win7_Diff0.vhd

·         Thin Provisioning – Be Very Careful

o   Thin Provisioning allows you to not have the vhd auto-expand.  However, if the underlying disk runs out of space you risk VHD corruption which could destroy your entire VHD.

o   Disk expansion happens when driver is loaded

§  Cannot suppress expansion during Installation

§  Stop Error if not enough physical space (Blue Screen)

o   Registry entry will prevent the disk from expanding to its full size. Open the registry editor, browse to

§  The location that’s displayed  below and alter the value to “4”.

§  [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesFsDependsParameters]

§  “VirtualDiskExpandOnMount”=dword:00000004

o   Strongly Recommend You NOT do this!!!!

o   IF you run out of disk space, you will likely corrupt your VHD!

·         Resources

o   Dan’s Blog 

o   http://blogs.technet.com/danstolts

o   http://ITProGuru.com

o   http://blogs.technet.com/danstolts/pages/eventresources.aspx

o   http://blogs.technet.com/danstolts/Contact.aspx

 

o   What’s New for IT Pros in Windows 7

http://technet.microsoft.com/en-us/library/dd349334(WS.10).aspx

o   What’s New in Virtual Hard Disks

http://technet.microsoft.com/en-us/library/dd440864(WS.10).aspx

 

o   Windows(R) Image to Virtual Hard Disk (WIM2VHD) Converter

http://code.msdn.microsoft.com/wim2vhd

·         Tools & Resources

o   Appendix: Tools, Scripts, and APIs.

o   The following tools are included in Windows 7 and Windows Server 2008 R2:

o   DiskPart   A command-line tool that you can use to create, attach, and detach VHDs. You can also perform more advanced tasks like compacting, expanding, and merging VHDs. For more information, see DiskPart on Microsoft TechNet (http://go.microsoft.com/fwlink/?LinkId=128458).

o   Disk Management   A Microsoft Management Console (MMC) snap-in that you can use to create, attach, and detach VHDs.

o   BCDEdit   A command-line tool that you use to manage boot configuration data (BCD) stores. For more information, see BCDEdit on Microsoft TechNet (http://go.microsoft.com/fwlink/?LinkId=128459).

o   BCDBoot   A command-line tool that you can use to manage and create new BCD stores and BCD boot entries. BCDBoot can be used to create a new boot entry when configuring a system to boot from a new VHD. For more information, see BCDBoot Command-Line Options on Microsoft TechNet (http://go.microsoft.com/fwlink/?LinkID=155166).

o   Deployment Image Servicing and Management (DISM)   A command-line tool that you use to apply updates, drivers, and language packs to a Windows image. For more information, see Deployment Image Servicing and Management Technical Reference on Microsoft TechNet (http://go.microsoft.com/fwlink/?LinkId=155029).

o   Windows Hyper-V Manager   An MMC snap-in that supports VHD image creation. You can specify the type and size of VHD and install Windows from a CD or DVD, or from an ISO Image file. The Hyper-V Manager is only available on computers that are running Windows Server 2008 or Windows Server 2008 R2 with the Hyper-V role installed.

o   Sysprep   A tool that enables you to remove user and computer-specific data from the operating system image. This enables you to capture the image and deploy it to other computers. For more information, see Sysprep Technical Reference on Microsoft TechNet (http://go.microsoft.com/fwlink/?LinkId=155027).

o   The following tool are included in the Windows Automated Installation Kit (Windows AIK):

o   ImageX   A command line tool that enables you to capture, create, modify, and apply Windows images. For more information, see ImageX Technical Reference on Microsoft TechNet (http://go.microsoft.com/fwlink/?LinkId=155340).

Ping Dan Stolts on Twitter @ITProGuru (http://twitter.com/itproguru)

Visit Blog: HTTP://ITProGuru.com

Related Articles: