Udostępnij za pośrednictwem


Windows 7: Boot from VHD First Impression: Part 1

Hello,

As you all know Microsoft released the Windows 7 BETA build 7000 for testing. Many of you must be excited about the much more enhanced version of the operating system.

Windows 7 is much more faster that the Windows Vista and utilizes the resources more efficiently improving end user performance. We have seen many new features related to UI and Performance.

One of the best features that is being discussed around is the native support for VHD (Virtual Hard Disk) Yes the same VHD files that are used in virtualization platform i.e.. Hyper-V, Virtual Server and Virtual PC.

Today we will see the following key items.

  • Creating native Virtual Hard Disk (VHD) in Windows 7
  • Creating and Attaching VHDs using Diskpart utility
  • Attaching and Detaching the VHD file

 

Creating Native Virtual Hard Disk (VHD) in Windows 7

 

Right Click on My Computer and Click 'Manage' that will open up Computer Management, in that click on Disk Management.

Disk Management

 

Right Click on Disk Management and select 'Create VHD' This will open new windows 'Create and Attach Virtual Hard Disk'

create

 

In this windows select the location where you want to create the VHD file. Make sure you have sufficient free space while creating new VHD file. After that provide the Virtual Hard Disk size and format of the VHD.

By default the Fixed size is recommended but you can select Dynamic expanding if you don't want to allocate the disk space. There would be slight performance difference between fixed size and dynamically expanding.

For production environment it is suggested to go for Fixed size. For the demo purpose we will go ahead with dynamically expanding VHD format.

created vhd

 

Click on OK and that will install newly attached (mounted) VHD. Now next step will be initializing the disk

newly mounted vhd

 

Alright now Right Click on Disk 1 (Blue icon) and click on 'Initialize' This will open a new window 'Initialize Disk.'

Select the partition and click on 'OK.' You can leave the current selection to default.

initialize done

 

As you can see now the status of the Disk 1 is changed to 'Online.' We create a new simple volume on the Disk 1

 

unallocated

So Right Click on the 'Unallocated' area and select 'New Simple Volume' This will launch 'New Simple Volume Wizard.'

After that click on next and specify size, we will  keep the default NTFS File System and select the complete size i.e. 20 GB and click on 'Next' to specify drive letter. I will select Drive Letter 'X:' and click on 'Next'

On the next page we will select Label for the drive (in this case 'Windows7') and click on 'Next.' Now, we will get the brief summary of the choices we selected. Click on 'Finish' to continue.

simple volume

 

This way we have successfully created a new Virtual Hard Disk. As you can see the status of the
disk ready

 

 

Creating and Attaching VHD using Diskpart utility

 

Open the Elevated Command Prompt with Administrator Privileges and type the following commands

DISKPART

CREATE VDISK FILE="c:\win7\win7.vhd" MAXIMUM=20000

SELECT VDISK FILE="c:\win7\win7.vhd"

ATTACH VDISK

CREATE PARTITION PRIMARY

ASSIGN LETTER=X

FORMAT QUICK LABEL=Windows7

EXIT

This will create the VHD file of primary partition. You will see the newly attached disk in Disk Management with Drive Letter X:

create using diskpart

 

Attaching and Detaching VHD in Windows 7

 

Right Click on My Computer and Click 'Manage' that will open up Computer Management, in that click on Disk Management. Just like previous part.

Then Right Click on Disk Management and select 'Attach VHD' This will open new windows 'Attach Virtual Hard Disk'

 

attach

 

Click on OK and that will attach the existing Virtual Hard Disk. Now, if you don't want to make write anything on the VHD, we will select the 'Read-only' check box

attach read only

And subsequently we will have the attached VHD in explorer.

disk ready

 

NOW WE WILL DETACH THE VHD

 

To detach the VHD simply Right Click on the 'Disk 1' (Blue Color) and select 'Detach VHD'

detach vhd

After clicking on 'Detach VHD' you will be prompt you with 'Detach Virtual Hard Disk' message. Click on OK to detach. Also, if you want delete the VHD permanently you can select the Checkbox.

detach delete data

 

This way we have seen how can we create new VHDs, attach/detach existing VHDs using Disk Management and Diskpart utility.

In the next part we will how can we boot the newly created VHDs using Windows 7 or Windows Server 2008 R2 (aka Windows Server 7)

 

Thanks

Comments

  • Anonymous
    January 01, 2003
    הי ושלום לכולם, החלטתי היום להתקין את Windows 7 או בקיצור W7 על המחשב שלי, חשוב קודם לציין כי המחשב שלי

  • Anonymous
    January 01, 2003
    Hello Joe, This is Part 1 of my 3 parts article. Part 2 explains booting from VHD http://blogs.technet.com/aviraj/archive/2009/01/18/windows-7-boot-from-vhd-first-impression-part-2.aspx I will add an update to this post pointing to part 2. Thanks :)

  • Anonymous
    January 01, 2003
    הי ושלום לכולם, החלטתי היום להתקין את Windows 7 או בקיצור W7 על המחשב שלי, חשוב קודם לציין כי המחשב שלי

  • Anonymous
    January 01, 2003
    You can try this method also , looks more easy http://www.sevenforums.com/tutorials/2953-virtual-hard-drive-vhd-file-create-start-boot.html

  • Anonymous
    January 01, 2003
    Hi, I've created a boot VHD on my dual boot (win7, winxp) system. The process ended up as planned and seemed a success. A few days ago, I got an error message which blocked my booting session. I ran a repair session from my installation DVD, but the repair failed to cure the problem. I'm looking now for either of the two:

  1. Deleting the boot VHD
  2. Repairing the defective drive. Can you suggest a solution?
  • Anonymous
    January 01, 2003
    PingBack from http://bh-server.com/windows-7-boot-from-vhd-first-impression-part-1/

  • Anonymous
    June 22, 2009
    This is a very nice feature in windows 7. Also well explained in the article. Thank you very much.

  • Anonymous
    October 29, 2009
    These steps do not explain how to boot from the VHD, only how to create, attach and detach.  Please explain how to boot from VHD as the title eludes.

  • Anonymous
    November 14, 2009
    When i attached or create and reboot my computer, the newly create drive disappears.  I wonder what i am doing wrong.

  • Anonymous
    February 07, 2010
    Hi, thank you very much for this post. Patrick


patricklamber.blogspot.com (SharePoint, ASP.NET, PowerShell)