Page 1 of 1

VDI file size not decreasing after deleting files in guest.

Posted: 5. Aug 2020, 10:38
by TheGuyNextDoor
So I am using Ubuntu and I have kali as virtual machine but recently I used a large password list files for testing something and then deleted it but when I analysed , the Host OS still shows that Kali is using 76GB where as running analyser in Kali shows that it's only 10GB I don't know why the host os is still not refreshed back. I used multiple packages to test disk usage I checked the VDI file it's 76GB but why ?. Any idea?.

Re: VDI file size not decreasing after deleting files in guest.

Posted: 5. Aug 2020, 10:55
by mpack
That is correct. VDI size does not decrease when you delete files inside the guest OS, because the latter is simply a book-keeping exercise, it does not unwrite the disk sectors.

You can compact the disk using CloneVDI (on Linux hosts this will require Wine). Be sure to choose the "Keep UUID" option. The cloned VDI will be smaller and a one for one replacement for the large VDI. Note however that the VDI will grow again the next time you store data on it, so maybe best just get used to it.

Re: VDI file size not decreasing after deleting files in guest.

Posted: 5. Aug 2020, 11:07
by TheGuyNextDoor
Thanks for the info ..so the best option is to keep the VDI file before copying large files and then after work I can switch back to the older smaller VDI.

Re: VDI file size not decreasing after deleting files in guest.

Posted: 5. Aug 2020, 11:53
by mpack
Yes, that would do it too, though it would also undo changes you wanted to be permanent, e.g. OS updates.