1) 用ssh登录vsphere主机,查找161-flat.vmdk文件所在的位置以及目录,并记录文件的大小
[root@localhost:~] find / -name "161-flat.vmdk"
/vmfs/volumes/6048f434-6d157002-e011-0894ef262ff1/161/161-flat.vmdk
[root@localhost:~] ls -l /vmfs/volumes/6048f434-6d157002-e011-0894ef262ff1/161/161-flat.vmdk
-rw------- 1 root root 322122547200 Feb 19 11:44 /vmfs/volumes/6048f434-6d157002-e011-0894ef262ff1/161/161-flat.vmdk
2) 重命名161-flat.vmdk 为temp_161-flat.vmdk
[root@localhost:~] cd /vmfs/volumes/6048f434-6d157002-e011-0894ef262ff1/161/
[root@localhost:/vmfs/volumes/6048f434-6d157002-e011-0894ef262ff1/161] mv 161-flat.vmdk temp_161-flat.vmdk
[root@localhost:/vmfs/volumes/6048f434-6d157002-e011-0894ef262ff1/161] ls -la
total 314575888
drwxr-xr-x 1 root root 1120 Feb 19 22:18 .
drwxr-xr-t 1 root root 2660 Feb 19 11:44 ..
-rw------- 1 root root 8684 Feb 19 21:11 161.nvram
-rw------- 1 root root 445 Feb 19 11:44 161.vmdk
-rw-r--r-- 1 root root 0 Feb 19 11:44 161.vmsd
-rwxr-xr-x 1 root root 3094 Feb 19 21:11 161.vmx
-rw------- 1 root root 322122547200 Feb 19 11:44 temp_161-flat.vmdk
-rw-r--r-- 1 root root 205071 Feb 19 21:11 vmware.log
3)用vmkfstools命令在虚拟机目录下创建161-flat.vmdk文件,大小要和原来的161-flat.vmdk一样大
[root@localhost:/vmfs/volumes/6048f434-6d157002-e011-0894ef262ff1/161] vmkfstools -c 322122547200 -a lsilogic 161-flat.vmdk
Option --adaptertype is deprecated and hence will be ignored
Create: 100% done.
[root@localhost:/vmfs/volumes/6048f434-6d157002-e011-0894ef262ff1/161] ls -la *vmdk
-rw------- 1 root root 322122547200 Feb 19 22:25 161-flat-flat.vmdk
-rw------- 1 root root 450 Feb 19 22:25 161-flat.vmdk
-rw------- 1 root root 445 Feb 19 11:44 161.vmdk
-rw------- 1 root root 322122547200 Feb 19 11:44 temp_161-flat.vmdk
4) 将原来的temp_161-flat.vmdk覆盖掉刚创建的同样大小的161-flat.vmdk,使用mv命令
[root@localhost:/vmfs/volumes/6048f434-6d157002-e011-0894ef262ff1/161] mv temp_161-flat.vmdk 161-flat.vmdk
重命名操作很快完成,启动虚拟机即可。