Windows is typically installed in VirtualBox and then used in a seamless mode for certain software.
The VirtualBox virtual hard disk will be larger, and the VirtualBox does not have its own cleanup tool, compared to VMware, VMware comes with a defrag tool.
Here are the specific cleanup methods:
1. If the virtual machine is using a system that is windows:
① into the virtual machine, download sdelete,:http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx.
② running on the command line
Sdelete.exe-z C:
Remember: You cannot use the-c parameter, otherwise you will wear SSD.
This period will stay at 100% for a long time until it is complete.
③, when finished, shut down the virtual machine, compress the VDI files up and down in Ubuntu commands as follows:
Vboxmanage MODIFYHD Xxx.vdi--compact
④ if it is not the VDI format, you need to do a conversion with the following command:
Vboxmanage Clonehd source.vmdk CLONED.VDI-format vdivboxmanage MODIFYHD cloned. VDI--compactvboxmanage Clonehd cloned. VDI COMPRESSED.VMDK--format VMDK
2. If you are using a Linux virtual machine:
Step ③④ above, the previous steps should be changed to:
if=/dev/zero of=/empty bs=/empty
There is also an option to use the Zerofree command as follows:
BusyBox mount-o ro,remount/dev/sda1 /dev/sda1 busybox mount-o rw, REMOUNT/DEV/SDA1
Reference:
Https://superuser.com/questions/388733/virtualbox-how-to-free-up-unused-vdi-disk-place
http://blog.csdn.net/god2469/article/details/8525880
http://blog.csdn.net/ganshuyu/article/details/46360271
http://blog.csdn.net/cnylsy/article/details/52474513
https://forums.virtualbox.org/viewtopic.php?p=29272#p29272
Reduce the size of VirtualBox virtual hard disk files under Ubuntu 16.04