VMware Cloud Community
ccy1219
Contributor
Contributor
Jump to solution

How to know a iscsi datastore ever mounted/unmounted on a host?

Hi there,

I am wondering how to know if a iscsi datastore ever mounted/unmounted on a host?

Here is the steps and problems I got.

1. Add iscsi static target to host.

2. Rescan Hba

3. If the datastore is newly connected then vSphere will mount this datastore. If not, and the datastore was dismounted to the host in last connection then I would like to manually mount (mountVmfsVolume) this datastore.

If I manually mount a datastore that suppose to auto-mount by vSphere then it will occurs "InvalidState Exception" on MOB instruction "mountVmfsVolume". The exception message is "The operation is not allowed in the current state"

How do I know if the datastore will be auto-mounted and avoid this exception from MOB? Is any information I can use before manually mount this datastore?

Wood

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
kastlr
Expert
Expert
Jump to solution

Hi Wood,

check the following article.

Unmounting a LUN or detaching a datastore/storage device from multiple VMware ESXi 5.x/6.0 hosts (20...

When the device is detached, it stays in an unmounted state even if the device is re-presented (that is, the detached state is persistent).

To bring the device back online, the device must be attached.

If you want the device to permanently decommission from an ESXi host, manually remove the NAA entries from the host configuration:

So you could use command esxcli storage core device detached list to check if the host did mount that device earlier or not.

When the device is initially presented (or was manually permanently decommissioned before), it won't appear in that list.

When the device with a VMFS was unmounted earlier and not permanently decommissioned, the naa.ID will appear in that list.

Regards,

Ralf


Hope this helps a bit.
Greetings from Germany. (CEST)

View solution in original post

Reply
0 Kudos
5 Replies
laurentsd
VMware Employee
VMware Employee
Jump to solution

Since this is a storage question and not related to the Web Client SDK  I will move it to the vSphere Storage forum.

Reply
0 Kudos
Virtual_EZ
Enthusiast
Enthusiast
Jump to solution

The host's Events log should log an event whenever a datastore is added or removed. This is accessible via the vSphere client by clicking on the host, then clicking the Tasks & Events tab, and clicking on the Events button. You could dig deeper into the host's log files as well. Check /var/log/storagerm.log.

Reply
0 Kudos
ccy1219
Contributor
Contributor
Jump to solution

Thanks EZ, I just check the event viewer but I could not identify the difference whether the datastore will be auto-mounted or not.

Here is the event from auto-mount datastore and non-auto-mount datastore, they are same before mounting it.


1. Task: Add Internet SCSI static targets

2. Task: Rescan HBA

3. Discovered datastore k1

Is there any way to know if the datastore will be auto-mount after rescan hba?

I'm currently keep checking if datstore is mounted on the host from MOB.

If finding the the datastore is not mounted on the host for a long time (ex. 30 seconds) then I will manually mount this datastore.

But this way wastes too much time on waiting, is is possible to know if I need to manually mount this datastore earlier?

I just checke the /var/log/storagerm.log and notices there is a entry if the datastore is not auto-mount.

2015-08-18T09:31:32.577Z: stat file /vmfs/volumes//k1/.iormstats.sf already exists.

I'm not too sure is it related to my problem. But in my develop environment I only allow to access MOB but not logs in exsi log.

Thanks.

Wood

Reply
0 Kudos
kastlr
Expert
Expert
Jump to solution

Hi Wood,

check the following article.

Unmounting a LUN or detaching a datastore/storage device from multiple VMware ESXi 5.x/6.0 hosts (20...

When the device is detached, it stays in an unmounted state even if the device is re-presented (that is, the detached state is persistent).

To bring the device back online, the device must be attached.

If you want the device to permanently decommission from an ESXi host, manually remove the NAA entries from the host configuration:

So you could use command esxcli storage core device detached list to check if the host did mount that device earlier or not.

When the device is initially presented (or was manually permanently decommissioned before), it won't appear in that list.

When the device with a VMFS was unmounted earlier and not permanently decommissioned, the naa.ID will appear in that list.

Regards,

Ralf


Hope this helps a bit.
Greetings from Germany. (CEST)
Reply
0 Kudos
ccy1219
Contributor
Contributor
Jump to solution

Great thanks Ralf~


I just follow your steps and this way do help me to obtain my goal :smileygrin:


Unfortunately in my case I only allow to access information from MOB but not esxcli command.

I have no idea how to map esxcli to MOB.

But I will keep looking for the result  in MOB same as I executed command esxcli storage core device detached list

Anyone know how to find it in MOB?


Thanks for your help~


Best regard,
Wood

Reply
0 Kudos