一:
以下这些情况是无法使用shrink功能的:
★使用默认方式新建的GSX Server虚拟机。
★使用了快照功能的虚拟机。
★使用了物理磁盘为虚拟机磁盘。
★虚拟磁盘保存在CD-ROM或DVD-ROM上。
★你不能收缩预分配的磁盘。
在进行收缩之前,需要删除创建的快照,之后,直接登录虚拟,打开VmwareTools就可能收缩磁盘了。
二:
shrink流程如下:
1.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.
2.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:\hkvision\mpsoc\mpsoc.vmdk"
提示 Shrink: 100% done.
Shrink completed successfully.
注* vmware-vdiskmanager.exe 工具在vmware安装的目录下。
完成
我120G的虚拟机shrink之后,变成了66G多一些。