The Shrinking Process
For Ubuntu 10.04:
In a Linux or FreeBSD guest operating system, to prepare virtual disks for shrinking, you should run VMware Tools as the root user. This way, you ensure the whole virtual disk is shrunk. Otherwise, if you shrink disks as a nonroot user you cannot wipe the parts of the virtual disk that require root-level permissions.
To shrink a virtual disk:
1. Launch the control panel.
- Windows guest — double-click the VMware Tools icon in the system tray, or chooseStart > Settings > Control Panel, then double-clickVMware Tools.
- Linux or FreeBSD guest — become root (su -), then runvmware-toolbox. Or runsudo -i apt-get install open-vm-toolbox to install vmware-toolbox, if you couldn't run vmware-toolbox.
2. Click the Shrink tab.
3. Select the virtual disks you want to shrink, then click Prepare to Shrink.
A dialog box tracks the progress of the wiping process.
Note: If you deselect some partitions, the whole disk is still shrunk. However, those partitions are not wiped for shrinking, and the shrink process does not reduce the size of the virtual disk as much as it could with all partitions selected.
4. Click Yes when VMware Tools finishes wiping the selected disk partitions.
A dialog box tracks the progress of the shrinking process. Shrinking disks may take considerable time.
5. Click OK to finish.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
For Ubuntu 12.04:
1. 虚拟机设置的硬盘选项中先Compac一下;
2.开虚拟机,参考http://www.howtoforge.com/how-to-shrink-vmware-virtual-disk-files-vmdk:
Before we try to shrink the virtual disk files, we should 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.宿主机执行命令:vmware-vdiskmanager.exe -k F:\*****\ubuntu-10.04.4-desktop-i386.vmdk
提示 Shrink: 100% done.
Shrink completed successfully.
完成