3 Simple Methods to Remove VHD from Virtual Machine

VHD or Virtual Hard Disk is a file format of disk image that is directly related to the virtual machine. The disk image, sometimes called a virtual machine contains data on the computer’s hard drive.(open VHD file to view the data) Virtual machines only work if they have been mounted to the system. It is not particularly difficult to mount VHD or remove it. Generally, after the work is done the VHD is removed from the system to create space for storage. The detaching of VHD also helps in protecting the data stored in it for that much time. Therefore it is important in some cases to remove the VHD from the Windows PC.

There is more than just one method to remove the VHD from a virtual machine. In this blog, the methods will be discussed and all the steps to perform the unmounting properly.

Methods to remove VHD from Virtual Machine

  1. Using Command Prompt
  2. Using Disk Management Console
  3. By shutting down the virtual machine

All the above-mentioned methods are manual and very easy to perform. Let’s see the step-by-step process for removing VHD.

1st Method: Using Command Prompt

This method works by performing CMD commands to detach or remove the VHD. Here are the steps to do so:

  1. In the Search box type cmd and it will show Command Prompt option. Right-click on the command prompt to select the option Run as Administrator.
    Command prompt to select the option Run as Administrator
  2. In the next step, you will see the User account control wizard where you will have to click on the Yes option.
    See the User account control wizard
  3. Command prompt window will appear before you. Type and run the diskpart command to reach the partition mode of the disk.
    Run the diskpart command to reach the partition mode of the disk
  4. Now to select the VHD file from your system run the command- select vdisk file= “<enter VHD file path location>”.
    Select the VHD file from your system run the command
  5. You can now use the command mentioned to detach VHD- detach vdisk.Use the command mentioned to detach VHD
  6. In the last step to perform use the Exit command in the prompt to complete the process of detaching VHD.
    Complete the process of detaching VHD
  7. You can now see that there is no VHD in the disk partition of the system.
2nd Method: Using Disk Management Console

This is another method to remove the VHD from the virtual machine. The disk management console is simple and easy to execute to perform this task. Here is the step-by-step guide.

  1. In the search button type Run or Windows+R to open the Run window and type diskmgmt.msc before clicking OK to open the Computer Management page.
    Open the Run window and type diskmgmt.msc
  2. Navigate and go to Storage to select the Disk Management option. You will now be able to see VHD and other disk drives.
    Select the Disk Management option
  3. Now select the VHD you want to delete and right-click on it. Click on the Delete button to delete the VHD.
    Click on the Delete button to delete the VHD
  4. A Delete Simple Volume box will appear. Click on Yes to proceed further.
    Delete Simple Volume box will appear
  5. VHD is now unallocated from Online status. Select the VHD and right-click on it to select Detach VHD to completely detach it from the disk management system.
    Select Detach VHD to completely detach it from the disk management system
  6. The VHD is now removed from the system.
3rd Method: By shutting down the virtual machine

For this method, there need to be some pre-requisites so that the VHD can be removed. You need to shut down the virtual machine since you need to change settings which are not possible while the virtual machine is online or suspended. After the virtual machine is turned off follow these steps:

  1. From Window select Virtual Machine Library.
  2. In the library select the virtual machine and click on Settings for further procedures.
  3. In the Settings option click on the VHD to be removed and then click on the Advanced button for more options.
  4. Click on the Remove button in the advanced window.

After removing the VHD you can either keep the file in the virtual machine package or you can move the VHD permanently to the trash by deleting it. If you are looking for solution to recover deleted VHD files from corrupted and damages VHD files then you can use VHD recovery tool which is capable to provide complete solution.

Download Now

Summary

VHD stores the data similar to the physical hard drive but needs to be removed to create storage space after the work is done. There are some manual methods mentioned above that can be used to achieve the task properly.