Shrinking Virtual Disks of VMWare

来源:互联网 发布:node.js microservice 编辑:程序博客网 时间:2024/05/21 06:20

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.

    Link to w_tools_shrink_supported.png

    3. Select the virtual disks you want to shrink, then click Prepare to Shrink.

    A dialog box tracks the progress of the wiping process.

    Link to w_tools_shrink_preparing.png

    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.

    Link to w_tools_shrink_want.png

    A dialog box tracks the progress of the shrinking process. Shrinking disks may take considerable time.

    Link to w_tools_shrink_progress.png

    5. Click OK to finish.

    Link to w_tools_shrink_complete.png

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------

    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.

      完成


    原创粉丝点击