用客户端登陆服务端,用下面命令停止虚拟机机器
esxcli vm process list 用如下命令关闭一台虚拟机:
esxcli vm process kill --type=[soft,hard,force] --world-id=WorldNumber
[root@localhost:~] df -h Filesystem Size Used Available Use% Mounted on VMFS-6 216.0G 216.0G 0.0B 100% /vmfs/volumes/datastore1 VMFS-5 223.5G 91.9G 131.6G 41% /vmfs/volumes/datastore2 vfat 4.0G 18.4M 4.0G 0% /vmfs/volumes/5b3a5d3b-2b0006b8-4cb7-801844e242ce vfat 249.7M 145.1M 104.6M 58% /vmfs/volumes/5792c275-c6e9afd4-9266-d1d9f5357e74 vfat 249.7M 8.0K 249.7M 0% /vmfs/volumes/a4324975-49f23314-0b6a-b3ab33d5bec3 vfat 285.8M 205.8M 80.0M 72% /vmfs/volumes/5b3a5d2a-cf05238b-4b7c-801844e242ce
可以看到 ,硬盘datastore1 已经满了,需要回收磁盘
[root@localhost:/vmfs/volumes/5b3a5d3b-e8fe3648-2bcc-801844e242ce] cd /vmfs/volumes/datastore1
[root@localhost:/vmfs/volumes/5b3a5d3b-e8fe3648-2bcc-801844e242ce] du -sh *
4.0G CentOS-7-x86_64-DVD-1511.iso
127.8G fdms_redis
55.6G kafka_test
[root@localhost:/vmfs/volumes/5b3a5d3b-e8fe3648-2bcc-801844e242ce] cd fdms_redis/
[root@localhost:/vmfs/volumes/5b3a5d3b-e8fe3648-2bcc-801844e242ce/fdms_redis] du -sh *
96.0G fdms_redis-8218fe5d.vswp
64.0K fdms_redis.nvram
0 fdms_redis.vmsd
0 fdms_redis.vmx
0 fdms_redis.vmx.lck
0 fdms_redis.vmxf
0 fdms_redis.vmx~
31.7G fdms_redis_0-flat.vmdk
0 fdms_redis_0.vmdk
1.0M vmware-1.log
1.0M vmware-2.log
1.0M vmware-3.log
1.0M vmware-4.log
1.0M vmware.log
110.0M vmx-fdms_redis-2182676061-1.vswp
[root@localhost:/vmfs/volumes/5b3a5d3b-e8fe3648-2bcc-801844e242ce/fdms_redis] vmkfstools --punchzero fdms_redis_0.vmdk
vmfsDisk: 1, rdmDisk: 0, blockSize: 1048576
Hole Punching: 100% done
再次观察磁盘
[root@localhost:/vmfs/volumes/5b3a5d3b-e8fe3648-2bcc-801844e242ce/fdms_redis] df -h Filesystem Size Used Available Use% Mounted on VMFS-6 216.0G 188.8G 27.2G 87% /vmfs/volumes/datastore1 # 已经不是100%,而是 87% VMFS-5 223.5G 172.0G 51.5G 77% /vmfs/volumes/datastore2 vfat 4.0G 14.7M 4.0G 0% /vmfs/volumes/5b3a5d3b-2b0006b8-4cb7-801844e242ce vfat 249.7M 145.1M 104.6M 58% /vmfs/volumes/5792c275-c6e9afd4-9266-d1d9f5357e74 vfat 249.7M 8.0K 249.7M 0% /vmfs/volumes/a4324975-49f23314-0b6a-b3ab33d5bec3 vfat 285.8M 205.8M 80.0M 72% /vmfs/volumes/5b3a5d2a-cf05238b-4b7c-801844e242ce