Hello,
In my previous post i.e. Windows 7: Boot from VHD First Impression: Part 1 we seen creating and attaching the VHDs. Using the Disk Management or Diskpart utility we can attach the existing VHDs. In this part we will actually cover the boot from VHD feature.
We will cover the different ways by which we can actually boot from VHD file. In order to boot from VHD, the bootloader needs to support boot from VHD file. So, what are the basic benefits of having VHD Booting.
You can use Boot for VHD feature in your test environment or development where you want to try out different applications or devices, which is not possible in Virtual Environment.
Booting from VHDs means booting the machine as if running from primary hard disk so your operating system will leverage all the hardware available in your system like Graphics, Wireless, USB etc. which is not possible in most of the virtual environment.
This is good for multi-boot environment where you want to run multiple operating systems on same machine without losing the performance. This is possible by VHD booting. As every VHD is like a Hard disk with primary partition; so you can create multiple VHDs with operating systems installed onto it.
In this discussion we will cover the following key points.
- Booting a Windows 7 VHD or Windows Server 7 (aka Windows Server 2008 R2) VHD
- Preparing VHD file using Windows 7 or Windows Server 7 Media or existing VHD running Hyper-V
- Adding the VHD entry in Boot Menu for VHD Boot and then Boot from VHD
Booting a Windows 7 VHD or Windows Server 7 (aka Windows Server 2008 R2) VHD
This feature is only supported by the Windows 7 client VHD and Windows Server 7 aka Windows Server 2008 R2 VHD.
In order to boot from VHD we need to prepare the VHDs using any of the two methods.
- The first method is obtaining the existing Windows 7 or Windows Server 7
DVDVHD and make sure it is sysprepped to clear all the hardware information. So why sysprep ?
Benefits of Sysprep
Sysprep provides the following benefits:
- Removes system-specific data from Windows. Sysprep can remove all system-specific information from an installed Windows image, including the computer security identifier (SID). The Windows installation can then be captured and installed throughout an organization.
- Configures Windows to boot to Audit mode. Audit mode enables you to install third-party applications and device drivers, as well as to test the functionality of the computer.
- Configures Windows to boot to Windows Welcome. Configures a Windows installation to boot to Windows Welcome the next time the computer starts. In general, you configure a system to boot to Windows Welcome immediately before delivering the computer to a customer.
- Resets Windows Product Activation. Sysprep can reset Windows Product Activation up to three times.
For more information about sysprep visit How sysprep works ? and What is Sysprep ? that will give you clear idea about sysprepping a system.
- Applying a WIM Image directly to the VHD file using ImageX utility. The ImageX utility can be used to extract the required operating system edition directly to the attached VHD file in Windows 7
The ImageX utility is part of WAIK. i.e. Windows Automated Installation Kit. You can download the WAIK for Windows 7 from here
Preparing VHD file using Windows 7 or Windows Server 7 Media or existing VHD running in Hyper-V
From my previous post create a new VHD and attach it using Disk Management. Now, you will have newly attached X: created with label ‘Windows7’, which is of size 20 GB.
Now, you will require the ‘install.wim’ file from the Windows 7 Media or Windows Server 7 Media. Along with that we will require ImageX utility.
In order to extract image to the X: we will use the following syntax.
d:\imagex>imagex /apply d:\install.wim 1 x:\
In the above syntax we can see we have used ‘d:\install.wim’ followed by ‘1′ and ‘X:\’ (this is the attached VHD.) Now this 1 denotes Image Index i.e. edition of the Operating System.
As you can see I have used the ‘install.wim’ file from the Media of Windows Server 7 Beta and 1 denotes Enterprise Edition.
In order to check the Image Index we will use the following command
d:\imagex>imagex /info "d:\Download\Windows Server 7 R2\install.wim" (i.e. the location of the install.wim file)
Once finished the extracting the OS using ImageX it will look like this
Once the image is applied to particular drive in our case X:\. Detach the X: Drive from the Disk Management. Now your VHD file is ready to boot.
Preparing the VHD file using Windows Server 2008 Hyper-V
If you have Windows Server 2008 running Hyper-V, launch the virtual machine running Windows 7 or Windows Server 7 aka Windows Server 2008 R2 and the run the following command
c:\windows\system32\sysprep>sysprep /generalize /shutdown
After running the above command in the virtual machine, this will launch the System Preparation Tool 3.14. Select the checkbox for ‘Generalize’ and click on OK.
Once the sysprep is completed the virtual machine will be shutdown and ready for booting. You can copy that VHD now.
Note: Sysprep does not work on upgrade. You need to have Clean Installed Windows 7
Adding the VHD Entry in Boot Menu and then Boot from VHD
Now that we have successfully created VHD files. The last step is adding boot entry for the VHD file in your Windows 7 or Windows Server 7 using BCDEdit.exe tool.
For this step open the Elevated Command Prompt with Administrator Privileges and type the following commands.
C:\>bcdedit /copy {current} /d "My New VHD Description"
Note: This will Return the GUID of the Loader Object that you will use to replace <guid> below
C:\>bcdedit /set <guid> device vhd=[driveletter:]\<directory>\<vhd filename>
C:\>bcdedit /set <guid> osdevice vhd=[driverletter:]\<directory>\<vhd filename>
Note: vhd=[driveletter:]\<directory>\<vhd filename> is the new syntax supported for BCDEdit.exe to locate VHD File and Bootmgr will locate the partition containing the VHD File to boot from.
C:\>bcdedit /set <guid> detecthal on
Note:
Following is the attached screenshot of the my machine. In this case I have Windows 7 as the default OS and I have added the VHD File in the Boot Entry.
Well just after that run the following command to test if your boot entry is successfully created using C:\>bcdedit /v
Similarly, if you want to add multiple VHDs into Boot entry you can use the following lines to the command prompt
C:\>bcdedit /copy {current} /d "New VHD Description"
C:\>bcdedit /set <guid> device vhd=[driveletter:]\<directory>\<vhd filename>
C:\>bcdedit /set <guid> osdevice vhd=[driverletter:]\<directory>\<vhd filename>
C:\>bcdedit /set <guid> detecthal on
Note: detecthal is used to force windows to auto detect the Hardware Abstraction Layer.
If you want to delete any existing VHD entry from the Boot Menu you can always use the command C:\>bcdedit /delete <guid> /cleanup This deletes the specified operating system entry from the store and removes the entry from the display order.
Well, we are ready to Boot from VHD. Once you restart the computer you will see additional entry in Boot Menu along with the default Windows 7 or Windows Server 7 OS.
Here is the screenshot from newly booted Windows Server 2008 R2 Beta from VHD. I have installed Desktop Experience Pack and enabled Aero Glass.
Happy Virtualization
Update 1: Thanks much Mark Shyn for pointing out method 1 correction.
NOTE: This is some advanced stuff and you may lose a finger. No warranty express or implied. There’s
I received my brand new Dell Latitude E4300 laptop today and I wanted to make sure i could boot both
bcdedit /enum
This will list out the GUID
Hello Shivam,
You may check out this blog post http://www.hanselman.com/…/GuideToInstallingAndBootingWindows8DeveloperPreviewOffAVHDVirtualHardDisk.aspx
Boot From VHD is only supported by Windows 7 and Windows Server 2008 R2. No downlevel OS support. That means you cannot boot Windows Vista or Windows Server 2008 using Boot From VHD option
thanks
Make sure you are attaching the VHD, which was already created with Hyper-V and not the the one that was created using imagex method.
VHD created in hyper-v already contains primary 200 mb system active partition containing bootmgr. In case of VHD created with imagex, we are just extracting files onto the single partition.
/*以下内容根据 Aviraj Ajgekar 的博客文章编译和修改。*/ 之前的文章提到了Windows 7对VHD文件的内建支持,从此以后VHD文件的地位得到了提升:-) 它可以被操作系统认为是一块物理的硬盘进行管理和读写。
Hello Suneel,
First of all, boot from VHD is supported only for Windows Server 2008 R2 and Windows 7. This is by architure only that it supports booting from VHD directly. NO DOWNLEVEL OS SUPPORT i.e. you can’t boot Vista, 2008, XP, 2003 or any other downlevel OS using VHD Boot.
You will have to run the guest os withing Virtualized s/w such as Hyper-V or Desktop Virtualization S/W like VPC or Win VPC etc.
Thanks much Peter.
thanks
thanks
@Raymond
You are confusing with the process.
Preparing VHD file using Windows 7 or Windows Server 7 Media
-In this we are manually creating VHD, applying OS files using ImageX and then detach.
Preparing the VHD file using Windows Server 2008 Hyper-V
-In this we are actually working on the VM, then installing Windows 7 and syspreppint the OS. They copying that VHD frm the Hyper-V based VM to boot from VHD scenario.
@sam
You need to download and install display drivers in order to get the graphics.
In the Boot from VHD scenario we are accessing the hardware directly from the computer. So we need to install the appropriate drivers.
I suggest you can use Windows Update for display drivers.
Hello Milka,
Couple of checks, have you created proper GUID? On what type of HDD you are storing the VHD?
Hi Tom,
Boot from VHD supports only Windows 7 Enterprise, Ultimate & Windows Server 2008 R2.
No that will not work, you can try sysprepping the VHD that might work.
In my blog I have given example of using VHD from Hyper-V VM by sysprepping it.
Also, boot from vhd works only with Windows 7 Ultimate & Enterprise Edition along with Windows Server 2008 R2. No downlevel OS support.
Hi Aviraj,
Is it possible to boot older OSs like Windows 98? I have been attempting to but have had no success. Can you post instructions if possible?
Not yet supported on USB drive
I follow yours instructions on your blog and i would know how you can directly attach the created vhd to Hyper-v
I tried it and the boot manager is missing
Maybe have i missed one step ?
Hi Aviraj,
I have created a Windows 8 VHD using Oracle virutal Box 4.0. And it works perfectly fine in the VBox software.I have used Windows 7 disk Manager to attach my VHD file. Now when i update the boot configuration using BCDEDIT tool, When everything is set i see still the osdevice shows Partition=C: . And due to which when i restart my computer with this VHD from the boot option this goes into Windows 7 Repair setup. Is there any method i can change this osdevice to my VHD file name so that it may boot from here.
Thanks and Regards,
Shivam
@Andriy – First delete currently configured GUID using BCDEDIT /delete {GUID}
Then move the VHD to D: or E: and then recreate the Boot Entry using BCDEDIT command.
@Surins – Yes, you can use Boot from VHD if there is no OS on the the DISK. You will need a system partition and other partition for storing VHD File. Refer this file for more info
http://technet.microsoft.com/en-us/library/dd799299(WS.10).aspx
As per the VHD BOOT FAQ
http://technet.microsoft.com/en-us/library/dd440865(WS.10).aspx
Native boot from VHD is only available with Windows 7 Enterprise, Windows 7 Ultimate and all versions of Windows Server 2008 R2.
Which edition you downloaded?
Retail DVD contains Home Basic, Premium, Professional and Ultimate.
For Ultimate Edition Image Index is 5.
You need to use imagex /apply install.wim 5 X:/
Where 5 is edition id for ULTIMATE and X is Target drive.
Enterprise SKU not included in retail DVD. It comes in different media as VL.
Thanks a useful post and i have some problem regarding that.
I am using Windows 7 as base os and i am try to install the Windows server 2008.
First i created a vhd using diskmgmt.msc and then using imagex it applied the same as mentioned in the above.
I found the boot entry while booting but it go for repair console.
Aviraj previous blogger explained it i understood that.
But is there is any way to do this i.e. without hyperv ?
I guess you need to change the guid brackets to flower brackets in these 2 lines…
C:>bcdedit /set <guid> device vhd=[driveletter:]<directory><vhd filename>
C:>bcdedit /set <guid> osdevice vhd=[driverletter:]<directory><vhd filename>
So this should be edited as…
C:>bcdedit /set {guid} device vhd=[driveletter:]<directory><vhd filename>
C:>bcdedit /set {guid} osdevice vhd=[driverletter:]<directory><vhd filename>
Could we have the VHD’s on an External HDD..
Coz’.. There was blue dump error when tried with external hdd on Windwos Server 2008 R2..
Thanks for this information – but hae you any idea how I can make this boot from a USB stick? I have it working with the bootloader on C: and my VHD on the USB drive but can’t seem to get the BCD configured correctly for the USB drive to be the only disk in the system.
Do I get in trouble if I use this stuff on a SSD (is TRIM-Command trough a VHD "Container" supported?)
Having a bit of trouble with the last step. After configuring everything, I reboot my Windows 7 box and it tells me that there is an error in the Boot Loader and it has to be fixed by an adminsitrator. If I select the VHD, it instead just boots to Windows 7.
This entire process can be made way way more simple:
* You need to download the following 3 files and run the script:
* YOU WILL FIRST NEED the program ImageX.exe Here is a shortcut to get the 32 or
64 bit versions (WITHOUT the need to download the 1 GB Developer’s kit iso from
Microsoft and burn it to cd to extract it.)
http://www.tipandtrick.net/2008/imagex-600118000-x86-and-x64-for-windows-server-2008-and-vista-sp1-standalone-download/
* Second, You’ll need to download "Wim2vhd.scr"
http://thelazyadmin.com/blogs/thelazyadmin/archive/2009/02/10/create-a-bootable-windows-7-vhd.aspx
* I STRONGLY recommend that you create a folder name VHD and put ImagX.exe,
Wim2Vhd.scr and COPY BcdBoot.exe and BcdEdit.exe (from your windowssystem32
folder) into it – then go to the command prompt in the VHD folder, verify you
have those 4 files and THEN run the script.
As you will find (on that web page) the command line ( you run from the command prompt) is:
cscript wim2vhd.wsf /wim:X:sourcesinstall.wim /sku:ULTIMATE /vhd:C:Win7Ultimate.vhd /size:40960 /disktype:Fixed
This command won’t work until you change the X to C because install.wim is on
your C: drive by default. Make sure the path to install.wim is correct before
you run the script. Install.wim also on the Windows 7 cd.
NOTE the VHD file size is 40 gb in the example. Windows VHD only needs 7 gb for
Win 7 BUT you need space for installing programs and downloading files, so I
changed mine to 20 gb. The file size can be set to dynamic, rather than fixed…
and it will expand if/when needed HOWEVER, you system will be VERY SLOW when/if
it has to expand the file size. This is not recommended – but keep in mind that
you can not increase the size of a fixed VHD once it has been created.
* Here is the exact command I copied and pasted to the command prompt in my VHD folder:
cscript wim2vhd.wsf /wim:C:sourcesinstall.wim /sku:ULTIMATE /vhd:C:vhdWin7Ultimate.vhd /size:20960 /disktype:Fixed
Note I also put the Win7ultamate.vhd file in the VHD folder rather than the root
drive in the example. This makes it easier to find, backup, and increment.
* When your VHD file is ceated you can finish the process with this handy tool:
VHD Mount for Windows 7 — adds all VHD related action like Mount, Un-mount,
Boot from VHD images right in your Right Click Context menu. After you run it,
just right click on any VHD image and select "add to boot menu."
https://brentf.com/blog/software/misc/VHDMount.exe
I have Win7 Ultimate as a host OS and am trying to boot a WinServer 2008 Enterpize VHD. I followed all of the instructions outlined in the blog. Everything goes smooth up until I attempt my first boot into the Win 2008 VHD. I am then greeting with a dialog telling me that my Boot Configuration is Corrupted (Error 0x490).
what are the locate=custom parameters into VHD config?
Are they needed? How to locate this value for my VHDs ?
And … why don’t you explain this ?
i tried using boot 7 from vhd but it fragments to quickly so both it & vista are slow to boot
Portlock Leap Frog, makes it very easy to setup a VHD for booting or an existing VHD, even if you only have Vista or XP. Portlock Leap Frog will upgrade the boot manager to support VHD boot.
In your demonstration , in the middle of it …. you say
If you have Windows Server 2008 running Hyper-V, launch the virtual machine running Windows 7 or Windows Server 7 aka Windows Server 2008 R2 and the run the following command
c:windowssystem32sysprep>sysprep /generalize /shutdown
————————–
and then you say
Once the image is applied to particular drive in our case X:. Detach the X: Drive from the Disk Management. Now your VHD file is ready to boot.
————————–
My confuse is if I shutdown my windows 7 by sysprep , then how can I detach the X: ?
————————–
In the above
"launch the virtual machine running Windows 7"
I don’t understand what is "the virtual machine" mean. I’m using an DVD installed Windows 7 , how can I sysprep it ?
If you won’t mind , make this clear for me, thanks
This is very nice post. I followed steps and was able to boot into the VHD properly.
I am having trouble with Graphics. Detected adaptor is shown as Standard VGA adaptor. Why this is happening and how to solve this?
Excuse me if this may sound a bit ignorant.
How exactly does VHD benefit you in contrast to using dual-booting ?
I mean why go with the fake virtual thing (i know its not fake) when you can go full blown and use a second partition to create another bootable OS?
If you have to restart your computer to go on to the VHD in essence it is like dual booting.
How would this application be used in an IT Enterprise environment ?
Thanks,
Steve
Hey, that’s a nice post.
I followed you post and was able to boot my laptop from Windows 7 Ultimate VHD.
But after booting from VHD, my laptop dosent detects any WIFIs and hence i am not able to connect to internet.
Can you suggest me any resolution for that?
Thanks!
This seemed to work for a Win7 vhd install except when I booted to the vhd and ran thru setup – when I entered the license key for the Win7 DVD that I got the install.wim from, it said the key was invalid. This was my MSDN win7 download.
anyone know the solution to this? seems like the install.wim wasnt’ built correctly on the dvd.
thanks
How can I know {GUID}?
Thanks.
Windows Backup creates a .vhd file. Is it possible to boot from this vhd using the bcdedit parts of the above mentioned procedure?
Thanks
when .vhd is on C:
device vhd=[C:]win7.vhd
osdevice vhd=[C:]win7.vhd
works perfect.
but when move win7.vhd to D: (or E:)
->
bcdedit /set {guid} device vhd=[D:]win7.vhd
bcdedit /set {guid} osdevice vhd=[D:]win7.vhd
->
bootmgr error:
The configuration for an element within the object is invalid in the boot configuration data store.
The associated windows boot loader entry may not be available for selection until then problem is rectified by an administrator.
The windows boot configuration data (bcd) store file contains some invalid information.
Status : 0xc000000f
or
Status : 0xc000000e
so, how boot win7.vhd from D: or E: ??
Thnx
Can boot from VHD if there is no operating system on the disk.
I can format the disk and create system partition, place all the boot files and then place the VHD..will this work?
>First delete currently configured GUID using BCDEDIT /delete {GUID}
>Then move the VHD to D: or E: and then recreate the Boot Entry using BCDEDIT command.
I did this. but get again Status:0xc000000e
bcdedit.exe /create /d "w7vhd-E:" /application osloader
bcdedit/set {guid} device vhd=[E:]win7.vhd
bcdedit/set {guid} path windowssystem32wi
nload.exe
bcdedit /displayorder {guid} /addlast
BTW D:&E: in on raid0 GPT disk. could it cause this problem?
Very nice post, thank you. I have an working WIN7 environment where I have created a couple of VHD’s to boot from (WS2008; WIN7; HYPER-V Server) by creating them from scratch.
Is it possible to take an existing Hyper-V vhd’s, aka. one of the demo hyper-v’s from MS (WS2008R2), copy them to the HDD and insert them in the boot loader directly so you can boot them?
can i boot from the windows 2008 vhd file which has created by windows 2008 backup utility ?
Hi, nice post.
I am having the same problem as Andriy, can you explain the detailed steps of resolving his problem?
Thank you 🙂
hi Aviraj i have a few question
1. suppose i have win 2008 R2 server. and i created vhd and installed windows xp64 in it. so basically my xp64 is virtualized and running inside 2008 r2.
2. now suppose i follow your instruction, sys-prep it and boot it with direct access to hardware.
q1) what will happen to my installed files and programs in xp64 vhd?
q2) Now if i boot again from my server 2008 R2, and virtual boot from this vhd, will i be able to run it as a virtual guest os?
q3) Now i want to migrate to new hardware. And suppose my new hardware is also running windows server 2008 R2, will i be able to boot and use the vhd in my new system ?
i am very interested to know what is possible
With the launch of Microsoft’s newest technology known as Windows 7 last October 22, 2009, a lot of computer users are trying to wonder about hardware and software updates that they might need to upgrade to Windows 7. Do you wonder how it is to find and install this version’s printer driver for your HP printers?
<a href="http://printerinkcartridges.printcountry.com/printer-ink-cartridges-how-to-do-troubleshooting/how-to-find-and-install-windows-7-printer-driver-for-your-hp-printers/">How to Find and Install Windows 7 Printer Driver for Your HP Printers</a>
I have a bunch of VHD with old demos on them, will this work or do the guest OS needs to be Windows Server 2008 R2 (as I understand from the post)?
@Aviraj
This doesn’t see to work with Windows Ultimate N edition (downloaded from MSDN). I get error either "Windows cannot configure Hardware.." or after sysprep "An error occurred .. Windows will restart and try" both ending in a infinite loop…
Any ideas?
Regs
Ravindran
Great article, but the one question I can’t find the answer to is this.
If I have a VHD already created by VMWare, Virtual PC or Parallels, of my currently installed OS and applications, can I use that to boot into?
Thanks,
Jeff
@Andriy and @Joyee,
I had the same issue, and my problem was that the device where I had the VHD stored was a second HDD. That second HDD was not enabled for booting in the BIOS. Once I added the physical HDD containing the VHD to the boot list, everything worked fine.
http://blogs.msdn.com/brchris/archive/2010/05/06/windows-server-2008-r2-native-boot.aspx
Hope that helps,
Brien
Hi Aviraj,
Great guide. For people not experienced at using Command Prompt, is there some sort of easier GUI or program that can help us set up our VHD's? Or is it only through Command Prompt?
Thanks!
I follow yours instructions on your blog ,i created vhd use the system windows server 2008 R2 runing in Hyper-v.but when i choose the new system to boot ,and write the password,it's always wrong .
Excellent doc and I got referred to this site from Beth Massi's blog.
Great instruction and worked well for me on both VHD for 2008r2 and Win7.
I am having major problems with a WinXP partition with a Win7 vhd copied there. Everything works for booting, running, etc. it's only when I want to make an image with drive snapshot is when problems occur. Tried this last night twice and same thing. When it make the image of the WinXP partition with the .vhd in the root, then restore the image to a brand new hard drive, I get a bootstore error upon boot. When I use the Win7 install dvd to boot up and look at the bootstore I see that under the "Windows Boot Loader" heading there is only the "identifer" line there, everything else has disappeared including the path to the .vhd file, etc. I can fix it with the bcdedit.exe commands but I want to know why I have to do this. Why is my imaging application losing that info when it makes the image. The rest of the bootstore info is fine and after the boot screen error, pressing enter I boot into WinXP.
Don't know if it's drive snapshot or all imaging apps that have this problem. Please tell. I can't believe I am the only one on the internet that this is happening to!
Hi,
Tx for that Blog, it is really helpfull
I am using a lot of VHDs for booting my labs PC for training purposes and I am planing to use that functionnality for production environment.
I am already using it on my personal laptop.
I even went a bit further while using differencing disks for having a faster way back, aka, I have a W7Master.VHD(around 8Gb) and W2K8Master.VHD(around 8Gb), created Differencing Disks Diff-W7.VHD and DiffW2K8R2.VHD, both are less than 1Mb (size vary from 128kb to 549kb depending on the tools used to create them) and do a backup copy of the differencins disks, before using them.
If any trouble occurs, I just copy the backup of the Diffrencing disks and rename it back to Diff-W7.VHD, and reboot on it, and voila!, I get the exact status that was at first boot, aka Snapshots in Hyper-V.
Sometimes I may have to reconnect Diff disk to its parent and I didn`t find anything else than Hyper-V Manager to do this.
I was wondering if is there any tool available that could let me reconnect a diff disk to its parents from W7? Or even better be from WinPE? Command line would be great!
Tx again for your blog, it is really nice!
I could´t make my VHD bootable, it is showing the message below:
C:Windowssystem32>bcdedit /set {957d47c0-72ea-11e0-bf26-943fb99fed63} device vhd=[H:]VHD-2008vhd-2008.vhd
An error has occurred setting the element data.
The request is not supported.
I am using Windows 7 x64 as the base and I am trying to create a VHD with Windows Server 2008 R2 x64…
What can I do now?
Thanks for the awesome post. I followed this procedure to create a VHD of windows Server 2008 r2 and boot into this VHD from windows 7 so that i can work on SharePoint 2010. I was sucessful in creating a VHD of windows Server 2008 r2 and booting into VHD by making an entry to BCDedit store in windows server 2008 r2. But when i try it from Windows 7 it fails and alsways results in BSOD. I did cross check the free space available. I created a vhd with 50 gb maximum fixed and i had about 180gb of free space. I hope thats more than sufficient. What do you think might be the issue?
Hi!
I have a question for really experts.
I boot directly from vhd (windows 7 ultimate) without any other system installed. I divided my hdd 320 gb into two partitions/volumes 100 gb and 197 gb
(remaining place 23 gb may be used by fat). the vhd was set to (i do not remember in detail) – i think – to 97 gb. after some updates for windows the blue
screen of death appeared with "VHD you must have enough capacity on the underlying disk to fully expand the VHD". so i did a look on the facts. booting with
dos showed me the the vhd is about 18 gb large. i changed the two volume sizes with acronis disk director suite to 150 gb and 147 gb. after that the pc
started up normal without blue creen of death. then i opened the windows explorer and look at the free and occupied space of the started vhd and the two
volumes. and here i found something very interesting:
started vhd: free 78,4 gb /total 95,7 gb which compares to 100.000.000 mb which had to be set in diskpart
volume 1: free 47,5 gb / total 148 gb
volume 2: free 142 gb / total 149 gb
now my question: under dos the vhd only occuppy 18 gb which expand after starting from it to the set 95,7 gb,. that is ok. but on volume 1, where the vhd
lies, the started vhd uses 100,5 gb (148-47,5=100,5)!!! and 100,5 gb is larger than my set 100 gb for volume 1. that should be the reason for the blue
screen. but what i not understand is:
why expand the vhd over 100 gb when there is only 18 gb occupied under dos. i expected that the vhd file expands when the 95,7 gb runs full, not that it
expands when nearly 80 gb are free in the vhd. can someone explain this because this is not the purpose of a vhd?
another questions is: where are the 4,8 gb, difference between 100,5 gb (if vhd is startet, occupied on volume 1) and the shown size of 95,7 gb of vhd in
windows explorer? or i misunderstood something or mismatch some figures.
if someone can explain me this facts this may help a lot of other people to set the size of the vhd more sensible.
with kind regards
Rainer
Great post – very useful, thank you Aviraj!
For dynamically expanding VHDs I've discovered that booting form the VHD expands the VHD to it's maximum size before continuing. i.e. Bootable VHDs effectively need to be fixed size VHD files.
My Os is Win 7 Ultimate 64Bit
Great Post Aviraj
Thanks for this! Really clear guide, I now feel confident sysprepping. q1: If I ever get new HD but don't wanna re-install, do I need to sysprep the vhd, before copying to new clean drive? q2: Can you also copy and import your BCD to a new drive? I think
I had some BCD corruption (had to create another VHD after cleaning my internal HD full of poorly partitions… thankfully I salvaged the VHD, but it's no longer listed as 'bootable' (or 'crash dump?!') unlike the new vhd (running now) http://i.imgur.com/KXU0QWi.png
q3: Can I recover the VHD? I've already created a BCD entry for it (copied a GUID and /set the device and osdevice to new VHD path) q4: Do I have to create a new VHD that's bootable and copy ALL THE files? (what about reg?) There is a will 🙂