How to Create, Attach a VHD in Windows 7

Written by Kent on May 18th, 2009 | Posted in How to, Virtualization | Tags: , ,
Click here for a FREE Windows speed up & performance scan

One of the good things Microsoft puts in Windows 7 for virtualization is the native support of VHD, which stands for Virtual Hard Disk. If you have used Virtual PC before, VHD shouldn’t be a stranger to you. Since Windows 7, you can easily create, attach, detach VHD files right in the system without using a Virtual platform. You can simply treat a VHD file as a removable disk, like your USB external storage.

There are two ways of doing it, one on the command line and the other uses GUI. Depending on which one you prefer, they are pretty much do the same thing with the same result.

Diskpart – command line

Open an administrator command window. The following are the diskpart commands to create a dynamic VHD that is 25G maximum size, saved in c:\vhd folder. It also formats the partition to NTFS in quick mode, and assigns a driver letter V.

DISKPART
CREATE VDISK FILE=C:\VHD\<filename>.vhd MAXIMUM=25000 TYPE=EXPANDABLE
SELECT VDISK FILE=C:\VHD\<filename>.vhd
ATTACH VDISK
CREATE PARTITION PRIMARY
FORMAT FS=NTFS QUICK
ASSIGN LETTER=V
EXIT

Note that the command diskpart in Windows 7 adds an additional option in Create named vdisk that wasn’t existed in the previous Windows.

Disk Management – GUI option

In Disk Management, click Action box from the top menu, and you can choose either Create or Attach VHD from the menu.

image

When creating a VHD, you need to specify the file name with location, size, and the format. It’s recommended using Fixed size from the performance stand point of view, but usually if you want to quick, you can always choose Dynamic which you can still change later on.

image

We will be covering more on this topic, so stay tuned.

Blog Widget by LinkWithin
Disclaimer
Before you act upon this post, please read this disclaimer.
Daily Email Updates
If you like this post, you may consider subscribing our daily email updates for free. Just enter your email address below:

Delivered by FeedBurner

  • Can a VHD be persistent, so it will be mounted on bootup
  • Kent
    Good question. One way I can think of is to use of the dispart command and add it into one batch file and put this batch file into the startup folder so it gets run every time when you log in.

    I haven't tried it so not sure if it works. If you somehow make it work, feel free to leave the comment here.

    Cheers.
blog comments powered by Disqus