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