Reclaim disk space occupied by vmwarevm

Source: Internet
Author: User

Ubuntu 10.04 is installed in the virtual machine, which is a long time ago. Because only the development environment and Oracle 10 Gb are installed, the occupied space is about 8 GB.

I upgraded 12.04.01 a few days ago. The trouble is that the hard disk space of the virtual machine has soared to around 16 GB. I uninstalled unnecessary software such as openoffice, apt-get clean, and apt-get autoremove.

Df-H: OK. The disk occupies about 8 GB, but the size of the virtual machine's hard disk is 16 GB!

After a long time, I checked N more information and finally got it done:

1. Perform Compac first in the hard disk option set by the virtual machine;

2. enable virtual machines

Before we try to shrink the virtual disk files, we shocould try to remove any unneeded files from the virtual machine to free space. For example, on Debian-based VMs, you can run

Apt-get clean

To clear out the local repository of retrieved package files.

Next, run

Cat/dev/zero> zero. fill; sync; sleep 1; sync; rm-f zero. fill

To fill the unused space with zeros.

Then power down the VM and open the command window on the Windows host:

3. Host Execute Command: vmware-vdiskmanager.exe-k F: \ ***** \ ubuntu-10.04.4-desktop-i386.vmdk

The message "Shrink: 100% done." is displayed.

Shrink completed successfully.

Complete

Note: It is because there is no cat/dev/zero> zero. fill; sync; sleep 1; sync; rm-f zero. fill, so failed. It may be necessary to use wipe.

Tips

The shrink function cannot be used in the following cases:

★Use the default GSX Server VM.

★A vm that uses the snapshot function.

★A physical disk is used as a virtual machine disk.

★The virtual disk is saved on the CD-ROM or DVD-ROM.

★You cannot shrink the pre-allocated disk.

Before shrinking, You need to delete the created snapshot. Then, log on to the virtual machine and open VmwareTools to shrink the disk.

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.