How to Delete Hard Disk Image File in Windows 10
- Home
- Windows
- Windows Server
Hi Folks,
I have an orphaned VHDX that I can't delete.
I have ran
Get-VM – ComputerName HYPERV01 , HYPERV02 | Get-VMHardDiskDrive | Select-Object -Property VMName , VMId , ComputerName , ControllerType , ControllerNumber , ControllerLocation , Path | Sort-Object -Property VMName | Out-GridView -Title "Virtual Disks"
The disks aren't attached to any VMs
I've looked at the processes associated with disk usage and can not find anything there either.
I've also stopped the VMM service and attempted to delete it, with no luck.
I can't reboot the server, so I'm trying to find solutions that will allow me delete the vhdx without a reboot.
Any thoughts?
Edited Oct 14, 2014 at 12:54 UTCHave a look with Process Explorer and see if it lists what process has the VHDX open?
Process Explorer can be downloaded from -> Process Explorer
23 Replies
Have a look with Process Explorer and see if it lists what process has the VHDX open?
Process Explorer can be downloaded from -> Process Explorer
How can I get the GUID for a disk that isn't attached to a VM?
Is it mounted somewhere? That can be enough to prevent it from deletion as well.
Go to the VM where it is mounted, unmount it and try to delete it again.
No it's not mounted somewhere.
Which is what the below determined.
Get-VM –ComputerName HYPERV01, HYPERV02 | Get-VMHardDiskDrive | Select-Object -Property VMName, VMId, ComputerName, ControllerType, ControllerNumber, ControllerLocation, Path | Sort-Object -Property VMName | Out-GridView -Title "Virtual Disks"
I have several VMWP's running, but it is unclear if any of them have the VHDX opened.
Just a suggestion-double check disk manager on your local machine. I've accidentally mounted vhdx files to my local computer while working with them.
Thanks for the suggestion. I checked already. It isn't mounted.
I see this often.
1.Try stopping then re-starting the vmms service.
2. Reboot if all else fails. Not ideal, but it works...
Yeah, I did already restart VMM, and a reboot is off the table until the weekend.
It's unfortunate I can't identify the process that has a lock on this thing.
Okay okay, Gary has this one.
I took a look in the docs for process explorer and did a search by handle or dll substring. I found my vhdx file and the PID of the process. Which is great. But why it doesn't show up in the main window is still puzzling.
But though I've found it I can't close the handle. (Which might be for the best.)
I ran into this on a machine a few weeks ago, it took a restart in order to delete it.
Yeah I'm not okay with that. I need to find a way to close this bastard without a reboot. :D
Ok so it is settled: Don't close a virtual machine worker process handler on a running system. Ultimately the VMMs service and likely others locked up after attempting to remove the handler from memory. So I had to reboot the system anyway.
Thanks for all the help everyone.
Take care,
I have also facing same issue while deleting image hard disk image file (.vhdx) Virtual machine is already deleted, any have solution without reboot or without stop vmms.
- I used process explore showing .vhdx file using PID 4
@techienateafs alluded to this earlier
I was able to solve the problem by opening diskmgmt.msc on the host server. The disk was listed there, right click and choose detach. It prompts for confirmation that you have the correct file. At that point, process explorer confirms that the file is no longer open by pid 4 (nt kernel & system) and I am able to work freely with the .vhdx file.
I wanted to add to this thread that I'm having the same issue with a VHDX file on one of our servers. All the errors trying to delete it lead me to believe we also need to reboot. Once the right time comes (it's our file share server, so will have to wait for a late night or weekend), I'll post back with the results.
for me it was locked because it was merging the snapshot / checkpoints in the vhdx after I deleted the VM in the GUI.
after a while I was able to delete it.
For me that was the best option.:
(because I'm using Win10 insider preview so default option for me is PS)
Open PS -> net stop vmms
If it says that the service stopping try again later, open task manager and find vmms.exe and end process tree, then you can delete the .vmdk and after that on PS -> net start vmms
This worked for me.
Hi there,
I had the same issue and just to let you know it kind of resolved its self.
I deleted some VM's which had some check points (avhdx files). After I deleted the VM in the HyperV manager the disk IO went nuts over these vm's. So I waited and as thought its was merging the checkpoint back in. Once complete I could delete the vhdx file without issue.
A little nutts but I guess its trying to keep things clean in case you need to re use that vhdx file etc
Old thread, but I came across this while trying to delete the files for a VM I had deleted. The comments about checkpoints being merged was spot on. In my case, I had a VM I was doing some experimentation with, and had saved multiple checkpoints at different stages. Since I was done with it, I deleted the VM, and was just trying to get rid of the files. Same errors as OP. Then I started looking a bit closer, and noted that the VHDX file was growing in size. After a bit, all the checkpoint files disappeared, at which point, I was able to delete the VHDX without any problem.
A "I care nothing about this VM...Nuke it and all its Files NOW" option would be nice. Or maybe just call it "Skip merging the checkpoints, just trash everything associated with this VM immediately".
moka works is an IT service provider.
Hi there.
Another suggestion : Server Manager, This server, Files & Disks services, iSCSI : Delete iSCSI Virtual Disk.
Have a good day.
I had to detatch it in Disk Management first.
This is a little bit painful to watch, but it worked.
https://www.youtube.com/watch?v=1c25bEq1ekg
This topic has been locked by an administrator and is no longer open for commenting.
To continue this discussion, please ask a new question.
How to Delete Hard Disk Image File in Windows 10
Source: https://community.spiceworks.com/topic/603713-solved-vhdx-can-t-be-deleted
0 Response to "How to Delete Hard Disk Image File in Windows 10"
Post a Comment