I had the opposite problem of having lots of old VDI images that were no longer registered in virtualbox that I wanted to delete from my host.
I had been using snapshots and linked clones for a couple of years (on a 2TB drive) and had lots of old unused images who's state was not obvious .
My technique was to generate two text files. One containing the list of registered hdd images (as in the main article above), and the other containing the list of images on the host HDD and do a DIFF to compare them (after they were sorted). Then manually delete each as indicated by the difference report:-
- Open a command prompt.
a. CD \program files\oracle\virtualbox
b. md temp
c. cd temp
d. ..\vboxmanage list hdds | find "Location" | sort > allregisteredhdds.txt
e. Use a good text editor to manually delete the left column of "Location " to leave the start of each line reading, for example "E:\"
f. dir E:\VM*.vdi /s /b | sort > all_vdi.txt
- Right mouse click and select KDIFF allvdi.txt allregistered_hdds.txt
Repeat step 1.f to find VMDK, etc.
Note, all my images were under E:\VM.