Before you start
Objectives: learn how to create, initialize, format, attach and detach a VHD file using Disk Management tool in Windows 7.
Prerequisites: you have to know what is VHD in general.
Key terms: disk, vhd, file, management, size, create, format, select, detach, drive, case, computer
The first thing that we will do is create a VHD file. To do that we can use Disk Management tool, which is available in Control Panel > Administrative Tools > Computer Management > Disk Management. Once in Disk Management, we will go to Actions and select the ‘Create VHD’ option. When we do that we will have to select the location where we want to store our VHD, disk size, and the format of our VHD.
In our case we will save our VHD file to the C: drive. The name of the VHD file is ‘UserFiles.vhd’. The size of our virtual disk will be 256 MB. Since our disk is so small we will select ‘Fixed size’ for our disk format. Fixed size will create the VHD with the complete size of 256 MB, wile the ‘Dynamically expanding’ will create the VHD with zero MB and will expand up to the 256 MB as we write information to it. When we click OK, the Disk Management tool will attach our newly created VHD automatically.
Initialize and Format
So, now our VHD exists (Disk 1), but its not initialized nor formatted.
VHD Created (Disk 1)
To initialize disk, we will right-click on Disk 1 and select the ‘Initialize Disk’ option.
Right-click Disk 1
Here we will leave default options and click OK.
Now we can create new volume on our VHD and specify a drive letter. To do that we will right-click on unallocated space on our Disk 1 and select the ‘New Simple Volume’ option.
Right-click Unallocated Space
The wizard will appear. The wizard will first ask us about the size of the volume. We will leave maximum size in our case.
Next, it will ask us about the drive letter. In our case ti is E.
Next, we will choose the file system and perform a format. In our case we will select NTFS as our file system with default allocation unit size, volume label will be ‘UserFiles’, and we will perform a quick format.
Once the format is complete, we can browse to our computer and see our newly created E: drive.
Disks on our Computer
Everything that we do on E: drive is actually saved in UserFiles.vhd file. If we go to the C: drive, we can see the UserFiles.vhd file which is used as our virtual disk.
Files on Dick C:
We can also detach VHDs from our computer. To do that, let’s go back to Disk Management, right-click our virtual hard disk (Disk 1 in our case) and select the ‘Detach VHD’ option.
If we only want to detach the VHD, and don’t want to delete the VHD file, we mustn’t select the ‘Delete the virtual hard disk file after removing the disk’ option. So, we have to be careful here if we want to use the VHD file on another computer.
We also have a video tutorial on how to create and manage VHD using Disk Management.
We can use Disk Management tool to create, attach, and detach VHDs in Windows 7. When creating VHD we have to determine the location for VHD file, disk size and disk format (expanding or fixed size). Disk Management tool will automatically attach VHD for us when we create it. VHD has to be initialized and formatted before we can save files to it. When we detach VHD, we have to be careful not to delete the VHD file if we plan to use it again.