Symptoms:
cat
or less
command, You will see error similar to:root@hostname: less var/run/log/hostd.log
hostd.log: Device or resource busy
VMware vSphere ESXi
The error "Device or resource busy" is caused when the log file is locked by another ESXi host in the environment. This occurs when multiple ESXi hosts are writing logs to the same location
To resolve this issue identify the ESXi host holding the lock on the log file and correct the syslog configuration.
Note: If a common datastore is used by all the ESXi hosts to save logs, each ESXi host should be configured with a unique directory on the datastore for syslog configuration.
Identify the ESXi host that is holding the lock on the log file:
vmkfstools -D <path of the log file>
Example:
root@hostname:vmkfstools -D /vmfs/volumes/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/logs/hostd.log
Lock [type 10c00001 offset 451526656 v 66, hb offset 3473408
gen 263, mode 1, owner xxxxxxxx-xxxxxxxx-xxxx-xxxxxxxxxxxx mtime 8934920
vmkfstools
command, record the MAC address(highlighted section in the above example)To check the MAC address of the vmnics on the ESXi hosts:
esxcli network nic list
Note: If there are many ESXi hosts in the environment we can use vmfsfilelockinfo
command to identify the ESXi host having a lock.
Example:
vmfsfilelockinfo -p <Logfilepath> -v <vCenter ip or hostname> -u <vCenter admin username>
vmfsfilelockinfo -p /vmfs/volumes/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/logs/hostd.log -v XX:XX:XX:XX -u [email protected]
Correcting the syslog configuration on the ESXi host:
After identifying the ESXi host holding the lock, review the syslog configuration of the host and change it to a unique directory
Note: The unique log directory must exist before changing the global logging directory parameter.
For additional information related to vmfsfilelockinfo
command, refer Investigating virtual machine file locks on ESXi hosts