1、VSphere 6.0环境,ESXI主机异常宕机重启后有个共享存储datastore不可用,ESXI主机上查看该datastore处于“(非活动)已卸载”的灰色状态。
2、手动执行datastore挂载,报错“Lock was not free. Please see the VMkernel log for detailed error information”
3、通过SSH登录ESXI主机
a) 查看/var/log/vmkernel.log日志,发现datastore被主机59f66b1b-c4093fdc-3c55-90e2ba34590e加锁了
2018-07-03T07:14:08.426Z cpu13:34765 opID=571f3738)LVM: 6370: Device locked by 59f66b1b-c4093fdc-3c55-90e2ba34590e at 1529868629936994 (0 tries left)
2018-07-03T07:14:08.863Z cpu13:34765 opID=571f3738)WARNING: LVM: 15119: The volume on the device naa.60000000e0a000073757037800010002:1 locked, possibly because some remote host encountered an error during a volume operation and could not recover
2018-07-03T07:14:08.863Z cpu13:34765 opID=571f3738)WARNING: LVM: 6451: If you are _sure_ this is the case, please break the device lock with `vmkfstools -B /vmfs/devices/disks/naa.60000000e0a000073757037800010002:1`
2018-07-03T07:14:08.863Z cpu13:34765 opID=571f3738)LVM: 6112: Forcing APD unregistration of devID 58124fbb-c4217589-5418-90e2ba34590e in state 1.
2018-07-03T07:14:08.863Z cpu13:34765 opID=571f3738)LVM: 13750: Failed to open device naa.60000000e0a000073757037800010002:1 : Lock was not free
b) 执行df命令,查看该datastore对应的文件系统状态显示“VMFS-unknown version”
4、执行以下命令查看datastore对应的磁盘设备名“Device Name”
[root@localhost:~] esxcli storage vmfs extent list
5、执行vmkfstools -B命令强制释放锁
vmkfstools -B /vmfs/devices/disks/naa.60000000e0a000073757037800010002:1
6、在ESXI主机上重新挂载datastore,状态正常。