question

gdlr-8380 avatar image
0 Votes"
gdlr-8380 asked XiaoweiHe-MSFT commented

Can't remove virtual disks completely

I'm creating a lot of differencing disks for my project and deleting them after some time.

I use "detach vdisk" command, they disappear from disk management but they are not completely removed...

When i use "list vdisk" command there is a huge list with all the virtual disks ever attached:
34749-b5c13e178e1511c9164ec57698195da7.png



I couldn't find a way to clear this and I have no idea if it will impact performance at some point. Does anyone know where all this info is stored and how to remove it?

Is there any way to completely remove a virtual disk so it won't show up in this list after?

windows-serverwindows-10-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

gdlr-8380 avatar image
1 Vote"
gdlr-8380 answered XiaoweiHe-MSFT commented

I tested and restarting computer clears the list.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Glad to hear the issue is sorted.

--please don't forget to Accept as answer if the reply is helpful--






0 Votes 0 ·

Hi,

Thanks for your sharing. Then, please accept your fix as an answer, so that others meet a similar issue can find the solution quickly.

Thanks for your time!
Best Regards,
Anne

0 Votes 0 ·
DSPatrick avatar image
1 Vote"
DSPatrick answered

Can you remove them?
https://docs.microsoft.com/en-us/powershell/module/storage/remove-virtualdisk?view=win10-ps


--please don't forget to Accept as answer if the reply is helpful--




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

mkobes avatar image
2 Votes"
mkobes answered mkobes edited

Like the command you used "detatch vdisk" suggests, you detach the vdisk. The actual file does not get removed and does stay on the disk until you actualy remove the file.

(If the reply was helpful please don't forget to accept it as the answer, thank you)

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

XiaoweiHe-MSFT avatar image
1 Vote"
XiaoweiHe-MSFT answered

Hi,

As @mkobes mentioned, when we use "detatch vdisk", it only stops the selected virtual hard disk (VHD) from appearing as a local hard disk drive on the host computer, while the vdisk files still exist, we need to delete the VHDXs in the listed location manually.

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/detach-vdisk


Thanks for your time!
Best Regards,
Anne


If the Answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

gdlr-8380 avatar image
0 Votes"
gdlr-8380 answered gdlr-8380 published

But I delete the file after ... I use Remove-Item from powershell.

The disk still remains listed there. I have almost 3000 disks now ...

@DSPatrick
I can't figure out how to use Remove-VirtualDisk here. I tried following commands but they don't work. Where can I find out the name or the friendly name of the virtual disks that show up in diskpart list?

Remove-VirtualDisk -FriendlyName "VDisk 2852"

Remove-VirtualDisk -Name "VDisk 2852"


Also, I have to mention that the disks are created on a virtual machine that doesn't run Hyper-V services. Can this be causing the problem?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DSPatrick avatar image
0 Votes"
DSPatrick answered

Maybe this one helps.
https://norcliffe.com/2019/01/14/merging-and-deleting-a-differencing-disk-in-hyper-v/


--please don't forget to Accept as answer if the reply is helpful--




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

gdlr-8380 avatar image
0 Votes"
gdlr-8380 answered gdlr-8380 edited

Problem is I'm not using Hyper-V and I don't want to merge any disks. I just want to remove them completely.

And I noticed same thing happens even if I don't use differencing disks.

Maybe there is a cache for previous mounted disks or something that resets after some time . Maybe the purpose of it is to automatically assign the same drive letter when you attach the same disk again.
I cannot restart the server right now to check if it clears after restart but i will try tomorrow maybe.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DSPatrick avatar image
0 Votes"
DSPatrick answered

Yes, I'd definitely reboot to see if that clears up a cache.


--please don't forget to Accept as answer if the reply is helpful--


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.