DISKPART
CREATE VDISK FILE="c:\win7\win7.vhd" MAXIMUM=20000This will create the VHD file of primary partition. You will see the newly attached disk in Disk Management with Drive Letter X:
SELECT VDISK FILE="c:\win7\win7.vhd"
ATTACH VDISK
CREATE PARTITION PRIMARY
ASSIGN LETTER=X
FORMAT QUICK LABEL=Windows7
EXIT
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 'AttachVirtual 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.
How to 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.
Comments