SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Recently Changed Pages:

View All Pages


View All Tags


LinkedIn




WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Pages with comments

View All Comments

bootingfromvhd

Booting From VHD

This page is the first in a small series about Windows Server 2012 and Hyper-V 3. The end goal is to have a functional Hyper-V 3 server on my own laptop. To have that working I will use a technology that will allow me to boot directly from a VHD.

What's a VHD

As stated at wikipedia:

VHD (Virtual Hard Disk) is a file format which represents a virtual hard disk drive (HDD). It may contain what is found on a physical HDD, such as disk partitions and a file system, which in turn can contain files and folders. It is typically used as the hard disk of a virtual machine. The format was created by Connectix for Connectix Virtual PC product, which was later acquired by Microsoft in 2003, for what is now known as Microsoft Virtual PC.

It is now the standard virtual hard disk format used in Hyper-V for virtual machines. This is in more depth explained on the Microsoft site in this article:

The Virtual Hard Disk (VHD) format is a publicly-available image format specification that allows encapsulation of the hard disk into an individual file for use by the operating system as a virtual disk in all the same ways physical hard disks are used. These virtual disks are capable of hosting native file systems (NTFS, FAT, exFAT, and UDFS) while supporting standard disk and file operations. VHD API support allows management of the virtual disks. Virtual disks created with the VHD API can function as boot disks. An example of how VHD files are used is the Hyper-V feature in Windows 7, Windows Server 2008, Virtual Server, and Windows Virtual PC. These products use the VHD API to contain the Windows operating system image utilized by a virtual machine as its system boot disk.

An important feature I'll use and explore in this article is the possibility to boot directly from a VHD file. This means you don't have to install a hypervisor to run the operating system installed in the VHD. It's called “Native VHD Boot” and is supported by Windows 7 Enterprise and Ultimated Editions, as well as by Windows 8, Windows Server 2008 R2 and Windows Server 2012.

Configuring Native VHD Boot

Since my laptop is running Windows 8 this article is written for Windows 8. However, given the procedure I expect it to be the same for other Windows editions that support this.

VHD Used:

  • 9200.16384.amd64fre.win8_rtm.120725-1247_server_serverdatacentereval_en-us.vhd

Because the VHD will appear as a disk after you've boot from it and your current OS disk will appear as a different disk it is better to be really precise about your folder structure. It is best to copy the VHD to a new folder structure from the root of a current disk. If you have different disks or real partitions your data disk is fine. If you have a virtual partition it's better to start from the C root, which is also the way to go if you have only one disk.

An example of this folder structure would be:

C:\BootVHDs\WIN2012\

After you've copied the VHD to this directory follow the following steps:

Mount VHD

On Windows 8 there are two ways to get there (among others):

  • Right click the VHD and select mount

Or start Disk Management:

  • By typing “diskmgmt.msc” in a command prompt or Run Box (works on all supported Windows Editions)

or

  • By press Windows Key + X and select Disk Management
    • Note that the X stands for eXpert Tools

In disk management click on the Actions Menu and select “Attach VHD”. If you do not have this option your OS does not support this feature:
bootingfromvhd01.jpg

In the “Attach Virtual Hard Disk” windows that appears browse to the created folder and select the VHD, and click OK.

A new 40 GB disk will now appear in Disk Management:
bootingfromvhd02.jpg

Booting From the Mounted VHD

Now is the time to setup the system so you van boot from the mounted VHD. Open a command prompt as administrator. On Windows 8, the Windows Key + X will help you out again, you can select “Command Prompt (Admin). On Windows 7, type in CMD in the Start menu search and right click the application so you can select “Run as Administrator”.

In the command prompt, type “BCDBOOT D:\WINDOWS”:
bootingfromvhd03.jpg

Check the previous command by starting “MSCONFIG” from the same command prompt and check the boot options:
bootingfromvhd04.jpg

Note that the default OS is indeed the Windows Server 2012 installation from the D-drive. Also note I changed the timeout to 15 seconds. The default is 30.

Now you can reboot the system. Since the installation from the VHD is like a sys prepped image it will start to configure the hardware. It will also ask for a new administrator password so you van logon to the system.

Note that reviewing if all required hardware was properly installed should be your first step. Because the installation was sys prepped this is your first chance to check if everything works properly.

You could leave a comment if you were logged in.
bootingfromvhd.txt · Last modified: 2021/09/24 00:24 (external edit)