The virtual machine is used for a long time to find that the virtual file is getting larger, the physical host disk space will not be reduced after deleting the files in the virtual machine, so the actual space occupied is not as large as the virtual file size, so we need to compress it. But VirtualBox doesn't seem to provide a way to compress the graphical interface, but we can do it through the command line. Note: ① This method can only compress virtual files for virtual machines in a VDI-formatted Windows system.② due to the large size of the company's virtual machines, the execution of sdelete-z and vboxmanage modifyvdi FilePath Compact needs to wait for a long time, please wait patiently. ③ the Vboxmanage modifyvdi FilePath Compact process may consume a lot of memory, please close unnecessary programs early. The amount of space compressed by ④ depends on the actual space footprint within your virtual machine. ⑤ is wrong and I hope you will criticize me.
the first step. Defragmentation (Operation in virtual machine)① into the virtual machine, copy the Sdelete.exe (see attachment) to the C packing directory; ② open a command-line window and execute
CD \Switch to c packing directory; ③ executionsdelete-zDefragment, patiently wait to finish; ④ shut down the virtual machine. (Be sure to turn it off, or you will get an error when compressing the disk)
step two. Compressing disks (operating in a physical host)① Open a command-line window and switch to VBox's installation directory to execute the following statement: vboxmanage modifyvdi FilePath CompactWhere filepath is the path to the VDI virtual machine file to compress, such as: d:\ virtual machine \ ikea \itl.vdi② wait for the end of the run to complete the compression. Methods of Extension:
====================== increase VBox virtual machine hard disk space ================================
Use command Vboxmanage MODIFYHD to expand hard disk space
This command is supported by version 4.0.
First shut down the system you want to extend the hard drive, then open the terminal, enter the virtual hard disk directory, run the command:
1, go to cmd, then go to VBox's installation directory
CD D:\Program Files\oracle\virtualbox
2. Run the command
Vboxmanage Modifyhd D:\VM_IDE\tuv\TUV_win2008r2_x64 (sql2012_x64). VDI--resize 400000
After you run the command, you will receive 0% ... 10% ... 20% ... 30% ... 40% ... 50% ... 60% ... 70% ... 80% ... 90% ... 100% when the 100% is finished.
Command explanation: Windowxp.vdi I want to expand the space of the virtual hard disk. I installed the windowsxp.
The--resize 40000 option specifies the size. The unit here is MB, I set the 40000, about 40G. It turns out to be 10G and now expands to 40G. It is important to note that the space set cannot be less than the space occupied by the original system.
====================== increase VBox virtual machine hard disk space ================================
Ways to compress virtual machines and extend virtual machine space