esx无法删除lun处理
esx无法删除lun处理_第1张图片

上述操作建议在维护模式下操作,操作前重启esxi。如果失败再次重启esxi。
如果还是删除不掉,可以将硬盘拔下,安装到其他服务器上进行清除分区。然后安装回原服务器,如果发现自动挂载,请进行重启esxi,挂载会自动取消。

上述环境是在vsan集群的esxi。

参考文档
Cannot remove datastore because file system is busy.
时间 2014-02-04 03:40:33 Virten
原文
  http://www.virten.net/2014/02/cannot-remove-datastore-because-file-system-is-busy/
主题 文件系统 vSphere
The following error message appears when you try to delete or unmount a VMFS datastore:
The resource Datastore Name:
VMFS uuid: is in use.
Cannot remove datastore ‘Datastore Name:
VMFS uuid: *’ because file system is busy. Correct the problem and retry the operation.

ESXi 5.5 has a new feature to store coredumps in a file residing on a datastore. It may sometimes create this file automatically and thus blocking datastores from being deleted.
Check for dump files. You can run this command from any ESXi host with access to the datastore:
~ # esxcli system coredump file list
Path Active Configured Size


/vmfs/volumes/Datastore/vmkdump/684938663845.dumpfile false false 1714421760
/vmfs/volumes/Datastore/vmkdump/684938663233.dumpfile false false 1714421760
/vmfs/volumes/Datastore/vmkdump/684938663533.dumpfile false false 1714421760
The output shows that I have 3 dump files which are blocking my datastore. Only the owning ESXi host can disable and delete them, so you have to find out which ESXi is responsible for each file:
~ # vmkfstools -D /vmfs/volumes/Datastore/vmkdump/684938663845.dumpfile
Lock [type 10c00001 offset 200392704 v 10, hb offset 3875328
gen 3, mode 1, owner 52ebd042-43b191f0-0173-005056871792 mtime 250
num 0 gblnum 0 gblgen 0 gblbrk 0]
Addr <4, 447, 0>, gen 1, links 1, type reg, flags 0, uid 0, gid 0, mode 600
len 1714421760, nb 1635 tbz 0, cow 0, newSinceEpoch 1635, zla 3, bs 1048576
You can see the UUID from the ESXi host that has locked the file. (Side note: The last part of the UUID is determined by the MAC address of vmnic0. 005056871792 = 00:50:56:87:17:92). To quickly identify the host, you can use the following PowerCLI Script to list all ESXi hosts, with their UUID:
Get-View -ViewType HostSystem -Propert Name, hardware.systeminfo | select { $.name, $.hardware.systeminfo.uuid }
To remove the coredump file, connect to the ESXi host with SSH and use the esxli system coredump file remove command. This will remove the configured active coredump file:
~ # esxcli system coredump file remove --force
If you have many hosts, you can also use this little PowerCLI script to quickly remove all coredump files. You have to be connected to the vCenter:
Get-VMHost | % {
$esxcli = get-esxcli -vmhost $_
$esxcli.system.coredump.file.remove($null, $true)
}
If the coredump file was not the reason for the lock, use the following checklist to ensure that the datastore can be removed properly:
LUN removal checklist
No virtual machine, template, snapshot or CD/DVD image resides on the datastore
The datastore is not part of a Datastore Cluster
Storage I/O Control is disabled for the datastore
The datastore is not used for vSphere HA heartbeat
The LUN is not used as a RDM
The Datastore is not used as a scratch location
The Datastore is not used as VMkernel Dump file location (/vmkdump/)
The Datastore is not used as active vsantraced location (/vsantrace/)
VMware KB2004605 also assists on removing datastores in ESXi 5.x