Monday, February 21, 2011

Creating VHD using Diskpart

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:



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'



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.


And subsequently we will have the attached VHD in explorer.



How to Detach VHD?

To detach the VHD simply Right Click on the 'Disk 1' (Blue Color) and select '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.




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

Related Posts Plugin for WordPress, Blogger...

Search This Blog

Followers

Twitter Delicious Facebook Digg Stumbleupon Favorites More