Windows Valley

It's all about Windows and its experience!

  • Home
  • Windows
  • Downloads
  • Internet Explorer
  • Office
  • Help & How-To
  • Contact Us

Published: September 8, 2009 by RKONIT

Create a bootable Windows 7 VHD (Virtual Hard disk)

Windows 7 supports VHD natively and it has lots of benefits. We have already posted Native VHD Support in Windows 7, which covers “What’s new in Windows 7 for VHDs. In this blog post, we’ll explore some practical use of VHDs, like Create/Attach/Detach/Format VHDs and make bootable VHD of Windows 7.

Windows 7 VHD acts like the same Real OS(Windows 7 on physical machine). It has some sort of limitation but it is excellent addition to Windows 7 and help for IT Pro, Devs and Testers. The Goals for Native Support for VHDs in Windows Server 2008 R2 and Windows 7 are as follows:

  1. Simplify the experience of creating, managing, and deploying Windows images across both physical and virtual machines using a single image format and common tools.
  2. Enable systems to have multiple instances of Windows installed without using separate disk partitions for more flexibility to change server application workloads as needed.
  3. Enable efficient development and testing for software that requires an isolated test environment using a common image that runs on either a physical or virtual machine

Lets come to the point and start it.

Required:

  • A PC running Windows 7/Windows Server 2008 R2
  • Install.wim Image files of Windows 7/Windows Server 2008 R2, is found in sources folder of DVD
  • WAIK for Windows 7/Windows Server 2008 R2

I have created a folder called VHD on root of C: drive and copied Windows Server 2008 R2’s install.wim and will use the folder to create VHD as well. So the location of files etc. may differ.

How To:

1. Run elevated Command Prompt and launch Diskpart utility. On DISKPART prompt, execute the following commands one by one.

create vdisk file=C:\VHD\W08R2x64.VHD Maximum=25000 Type=Fixed

It creates a VHD file named “W08R2x64.VHD” with maximum size of 25000MB. It is the time taking process. There are two type of VHDs can be created.

Dynamic: The size of VHD increases as data is written to it.

Fixed: The size of VHD is fixed and doesn’t increase as data is written to it.

attach vdisk

Attaches the VHD to disk list, you can check it by executing list disk.

sel disk 1

Selects disk which has ID#1, for more info see the results of list disk command.

create part primary

It creates a primary partition and usages all available space of VHD i.e. 25000MB or approx 24GB.

format fs=ntfs quick

Quick format the partition with NTFS file system.

assign

Assign a drive letter to the partition. for instance G:

active

Mark as the active partition. finally exit and leave the diskpart.

Creating VHD

Once you are done. you’ll see an extra drive in Computer i.e. the partition of VHD, because the vdisk is still attached.

The partition of VHD

2. Now run elevated Deployment Tools Command Prompt (If UAC is enabled)

Start > All Programs > Microsoft Windows AIK > Deployment Tools Command Prompt and execute the following command to copy the Windows 7 to VHD partition.

imagex /apply C:\VHD\Install.wim /check 3 G:\

Copy the OS files(which has Index#3) to G: drive(VHD partition). Where /check

To know about Index, you can execute the following command imagex /info C:\VHD\Install.wim which will display WinInfo with all available index associated Windows editions.

ImageX

3. Now we need to use diskpart once more to detach the VHD.

Detach VHD First command selects VHD and second one detaches.

4. Now we are to add boot entry in BCD using bcdedit.exe command, which is so easy as A,B,C.

bcdedit /copy {current} /d “Windows Server 2008 R2 – VHD”

Here we are copying BCD data, because both OS are same. The command creates a copy all settings of currently running Windows i.e. Windows 7. It also adds boot entry with an unique identifier. See {47aa7c3d-833d-11de-afc5-dec4cb4d83bb}. It may differ PC to PC.

Now we need to modify device and osdevice for VHD’s boot entry which Unique ID is {47aa7c3d-833d-11de-afc5-dec4cb4d83bb}

bcdedit /set {47aa7c3d-833d-11de-afc5-dec4cb4d83bb} device vhd=[C:]\VHD\W08R2x64.VHD

and

bcdedit /set {47aa7c3d-833d-11de-afc5-dec4cb4d83bb} osdevice vhd=[C:]\VHD\W08R2x64.VHD

Add boot entry to BCD

5. Now reboot your PC and perform few essential part of installation, like installing device drivers, updating registry and services, creating User account and set regional date/time/languages etc. When you are done… Your Windows 7 VHD is ready to use.

Last Review: December 13, 2010

Comments

  1. Lin Lin says

    December 18, 2010 at 10:40 PM

    When I am using this command: bcdedit /copy {current} /d “Windows Server 2008 R2 – VHD ” says
    “A description for the new entry must be specified.
    Run “bcdedit /? ” for commed line assistance.
    The parameter is incorrect.”

    Reply
  2. KeNSei says

    December 13, 2010 at 12:33 AM

    Hello!!!

    I can’t find sources folder and Install.wim in DVD WAIK for Windows 7/Windows Server 2008 R2.

    can anyone halp me plz?

    THNX!!!

    Reply
    • Admin says

      December 13, 2010 at 11:55 AM

      install.wim is not in WAIK DVD, It can be found in Windows 7/Windows Server 2008 R2 DVDs/ISOs.

  3. AH says

    September 22, 2010 at 12:37 PM

    When you using this command: bcdedit /copy {current} /d “Windows Server 2008 R2 – VHD”
    you copy the GUID from current Windows installation.

    This GUID is used for the VHD.

    But what do you think will happen if you want to delete the VHD from the boot menu using:

    bcdedit /delete {GUID} ?? 

    Reply
  4. Rose says

    June 10, 2010 at 7:07 AM

    How do you delete a bootable VHD properly? When I delete the .vhd file under c:, at next reboot, error message screen appears at predesktop saying ” The windows boot configuration date (BCD( store file contains some invalid information..

    Object GUID:
    description:
    status..

    The associated windows boot loader entry may not be available for selection until the problem is rectified by an administrator”

    How do i delete a VHD properly so this error would not appear??

    Thank you.

    Reply
  5. armani sunglasses says

    May 22, 2010 at 9:12 AM

    nice share, good

    article, very usefull for me…thank you

    Reply
  6. Railsroller says

    December 13, 2009 at 6:21 PM

    Is it possible to create a VHD file of my current Win XP SP3 and boot on it in a PC running windows 7 ?

    Thank you !

    Reply
    • Author says

      December 13, 2009 at 7:48 PM

      Windows XP deosn’t support VHD natively. You can create Windows XP SP3 VHD or can download Windows XP Mode and Virtual Windows PC/Virtual PC 2007 to run Windows XP SP3 Virtual Machine on Windows 7.

  7. Daren says

    November 13, 2009 at 12:53 AM

    With Portlock Leap Frog ( http://www.portlock.com/products/leap_frog/) a preconfigured VHD can easily be added to the boot entry even with Windows XP or Vista. NO AIK or OPK is needed. Portlock Leap Frog will automatically upgrade the boot manager to support VHD boot. Portlock Leap Frog will also setup or create a VHD and a bootable OS within it such as Windows 7 ultimate or Windows 2008 R2 ( windows 7 server).
    http://www.portlock.com/support/knowledge_base/download_windows_7_vhd.aspx

    Reply
  8. ArvindK says

    October 1, 2009 at 12:09 PM

    Thanks, great share and very important and needed feature of Windows 7 by Microsoft.

    Reply

Leave a Reply to Lin Lin Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Google promotes Google Chrome 28 to the Stable Channel
  • OEM partners to get Windows 8.1 RTM in late August
  • Opera 15 is stable now, brings fresh design and a new engine
  • Windows 8.1 Preview goes live, Download Now!
  • Windows 8.1 Preview’s minimum system requirements

Recent Comments

  • Mukul on How to reset/leave HomeGroup completely
  • harmony on How to Reset Microsoft Office Dictionary to Factory default
  • Moyin on How to Uninstall/Clean MySQL from Windows completely
  • Ricardo on How to Uninstall/Clean MySQL from Windows completely
  • Thunder on Remove “Shared Folder Synchronization” from Right-click Context Menu

Archives

Categories

  • Ebooks
  • Internet Explorer
  • More
  • Office
  • Reviews
  • Software
  • Visual Studio
  • Windows
  • Windows Live
  • Windows Phone
  • Windows Server

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2021 · Windows Valley · Some rights reserved · Privacy & cookies · Terms of use
All trademarks mentioned are the property of their respective owners.