In our previous post, we showed you the steps to create a Virtual Hard Disk in Windows 7. If you no longer require the Virtual Hard disk and wish to regain the local drive space, you can delete and detach the VHD created. In this post, you will learn the steps to delete a Virtual Hard disk in windows.
There are two ways to delete a Virtual Hard disk in windows. One is by using the Disk Management Console window, i.e., in the UI mode and the other is by using the Diskpart in command line mode. Let us discuss both of the ways in detail here.
Steps To Delete A Virtual Hard Disk In Windows:
Method 1: Using Disk Management Console
Step 1: To get started, open up the disk management console. To do that, go to Start and right click on Computer and select Manage from the context menu.
This will open up the computer management window as shown below. In the left pane navigate to Disk Management to get into the Disk Management console.
Alternatively, you can also open the disk management console directly by using the Run command. Press Win + R on your keyboard to open the Run box. Now type diskmgmt.msc in the run box and click Ok to open the disk management console.
Step 2: Under graphics pane in the Disk Management Console, right click on the Virtual Hard drive that you wish to delete and select Delete Volume from the context menu.
Step 3: You will be prompted with a warning message. Make sure that you have taken backup of the disk before deleting it and click Yes to proceed further.
Step 4: Now the virtual hard drive will be deleted, and the space allocated for the virtual hard disk will be now turned into an unallocated space as shown below.
Step 5: To detach the virtual hard disk completely, right click on the Disk n (where n is the disk number with which the VHD is associated) and select Detach VHD.
Step 6: In the Detach VHD Dialog Box, if you wish to remove the vhd file after detaching the VHD, check the box and click “OK“.
That’s it. Now the created Virtual Hard Disk is deleted and detached from your windows successfully.
To know how to create a virtual hard disk using disk management read our article on How To Create A Virtual Hard Drive In Windows.
Method 2: Using Diskpart
Step 1: To delete the VHD using Diskpart, first you need to open the command prompt with elevated privileges. Go to Start, and type cmd in the search box. Right click on the cmd and select Run As Administrator.
Step 2: Now in the command prompt window, get into the disk partition mode by typing diskpart and hit enter.
Step 3: Select the Virtual Hard Disk file that you wish to delete with the following command.
select vdisk file=”F:\install.vhd”
Here, F is the drive where the VHD file is stored, and install.vhd is the name of the vhd file.
Step 4: To detach the selected Virtual Hard Disk, type detach vdisk and hit Enter.
Step 5: Now the Diskpart has successfully detached the Virtual Hard Disk file.
Step 6: Type exit to get out of the Diskpart mode and close the command prompt window.
To know how to create a virtual hard disk using disk management read our article on How To Create A Virtual Hard Disk Using Diskpart In Windows.
If you encounter any issues while following this tutorial, do let me know using the comments section below.