Identify if a datastore is force mounted on an ESXi host.
search cancel

Identify if a datastore is force mounted on an ESXi host.

book

Article ID: 323084

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This articles details how to identify if a datastore has been force mounted on an ESXi host (where LUN was detected as snapshot).



Environment

VMware vSphere ESXi 7.0.x
VMware vSphere ESXi 8.0.x

Resolution

To identify if a datastore is force mounted on an ESXi host, run:
vim-cmd hostsvc/datastore/info <datastore name> | grep -A2 forceMountedInfo| grep -E "force|persist|mounted|}'"
If the datastore is not force mounted, this command will return:
forceMountedInfo = (vim.host.ForceMountedInfo) null,
If the datastore is force mounted, this command will return output similar to:
 forceMountedInfo = (vim.host.ForceMountedInfo) {
         persist = true,
         mounted = true
},
(For a force mount which does not persist after host reboot, persist will equal false.)

To check all datastores on a host for force mount, run:
esxcfg-scsidevs -m | grep -v OSDATA | awk '{print $NF}' | while read i; do echo $i; vim-cmd hostsvc/datastore/info $i| grep -A2 forceMountedInfo| grep -E "force|persist|mounted|}'"; done
Alternatively, whether a datastore is force mounted can be confirmed as follow:
 
esxcfg-info -a | grep "Is Force Mounted" -B13 

Output will be similar to:

            |----Head Extent........................................naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:1
            |----Console Path......................................./vmfs/volumes/xxxxxxxx-xxxxxxxx-xxxx-xxxxxxxxxxxx
            |----Block Size.........................................1048576
            |----Total Blocks.......................................122624
            |----Logical Disk Block Size............................512
            |----Physical Disk Block Size...........................512
            |----isSw512e...........................................false
            |----Blocks Used........................................3500
            |----Size...............................................128580583424
            |----Usage..............................................3670016000
            |----Lock Mode..........................................Public Vmfs5
            |----Major Version......................................6
            |----Minor Version......................................82
            |----Is Force Mounted...................................true

Additional Information

For more information on force mount of datastores, see Troubleshooting LUNs detected as snapshot LUNs in vSphere.