Reduce the size of VirtualBox virtual hard disk files under Ubuntu 16.04

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.