Dynamic Disks
If you use a Dynamic Disk in Oracle VirtualBox then you’ll probably notice that your disk space usage will increase over time however this space never reclaimed when you delete data from your virtual machine.
How do I recover that lost space?
1. First you need to “zero out” any unused bits on your disk. VirtualBox will only try to recover the lost space that has been “zeroed” on the disk. By default when Windows deletes a file, it won’t “zero” the space used by the deleted file. To do this, use Sysinternals SDelete within your Virtual Machine – https://technet.microsoft.com/en-us/sysinternals/bb897443.
sdelete.exe <disk drive> -z e.g. sdelete.exe C: -z
2. Then on your host machine run the following VirtualBox command to shrink the virtual disk. I’d advise you take a backup of your VM before doing this, just in case. Once this process completes, you should notice that your dynamic disk is now consuming less space.
C:\Program Files\Oracle\VirtualBox\VBoxManage modifyhd <path to *.VDI disk> –compact E.g. C:\Program Files\Oracle\VirtualBox\VBoxManage modifyhd C:\temp\MyVMImage.vdi –compact
- Solved: Build Errors Not Showning in VS 2022 - 21st November 2024
- How To: Configure VSCode to Trust Self-Signed Certs - 16th August 2024
- Solved: GitHub Actions – HTTP 403: Resource not accessible by integration - 13th June 2024
Leave a Reply