locked
How do I delete old VHD files off a hyper V host machine RRS feed

  • Question

  • I have created several test VMs and moved a production VM away from a particular host machine.  the only remaining VM cannot start do to a lack of disk space.  there should be plenty, the problem is all of the old unused vhd files. But I cannot figure out how to delete them.  the Hyper-V Manager only allows me to select them.

    I certainly have to be missing something simple.

    Thursday, August 8, 2013 7:00 PM

Answers

  • There may be a way to do it from the hyper-v manager, but I could not find it.

    instead I went to the host machine and used the command line to navigate to the directory and delete them.

    • Marked as answer by BrianEhMVP Thursday, August 8, 2013 8:15 PM
    Thursday, August 8, 2013 7:45 PM

All replies

  • There may be a way to do it from the hyper-v manager, but I could not find it.

    instead I went to the host machine and used the command line to navigate to the directory and delete them.

    • Marked as answer by BrianEhMVP Thursday, August 8, 2013 8:15 PM
    Thursday, August 8, 2013 7:45 PM
  • That is the way.  You found it.

    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Disclaimer: Attempting change is of your own free will.

    Thursday, August 8, 2013 8:15 PM
  • Just to add you must delete the VM first in the hyperV manager or the files are in use.
    • Proposed as answer by Tia_bert Wednesday, March 26, 2014 11:12 AM
    Friday, August 9, 2013 1:02 PM
  • Can you please provide me the command to delete the VHD file....?

    Friday, September 4, 2015 7:26 AM
  • Del <vhd name>.vhd

    I am not sure what you are looking for.

    Basic windows command line commands apply.

    Or, you can get fancy and do it in PowerShell.


    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.

    Friday, September 4, 2015 1:16 PM
  • You cannot delete the vhd files from Hyper-V manager. When you delete a VM, it leaves them behind as a failsafe.

    If your VM had checkpoints, they are merged into a single vhd that is left behind.

    the vhd delete action is a manual file system action.


    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.

    Friday, September 4, 2015 1:19 PM
  • I have deleted VM from Hyper-V manager, and my VM has snapshots. Now I am trying to delete VHD but i am unable to do it as it says this file is open in system. Any way to troubleshoot this?
    Monday, November 14, 2016 6:58 AM
  • You cannot delete the vhd files from Hyper-V manager. When you delete a VM, it leaves them behind as a failsafe.

    If your VM had checkpoints, they are merged into a single vhd that is left behind.

    the vhd delete action is a manual file system action.


    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.

    I have deleted VM from Hyper-V manager, and my VM has snapshots. Now I am trying to delete VHD but i am unable to do it as it says this file is open in system. Any way to troubleshoot this?
    Monday, November 14, 2016 6:59 AM
  • Dear, I had the same issue. I had deleted de VM, but couldn't delete the VHD (some process was locking it). I retried a couple of minutes later and i could delete it manually from explorer, as you delete any common file. Maybe the removing process takes a bit longer that you can see in the screen.

    Hope you have solved that problem.

    CG

    Wednesday, November 30, 2016 1:22 PM
  • A VHD/VHDX, at times, can get stuck in the system as mounted virtual drives.

    What you have to do is:

    1. Win + X

    2. Win + K

    (That will lead you to the disk manager)

    3. Refresh the "Disk Manager".

    4. Find the problematic mounted drive, and simply unmount it.

    5. Delete the VHD successfully.

    Alon Reich.

    • Proposed as answer by Sonal Perera Tuesday, March 19, 2019 7:46 AM
    Friday, November 2, 2018 6:08 PM
  • Control Panel\All Control Panel Items\Programs and Features

    Turn Windows features on or off

    Uncheck the box next to "Hyper-V"

    Restart the PC

    Delete all the files from "C:\Users\Public\Documents\Hyper-V\Virtual hard disks"

    • Proposed as answer by okkeh27 Thursday, October 10, 2019 8:21 AM
    Thursday, October 10, 2019 8:21 AM