Changing a virtual machines RDM Logical Unit Number (LUN) to Read-Write mode fails and remains in a Read-only/Write Protected state
search cancel

Changing a virtual machines RDM Logical Unit Number (LUN) to Read-Write mode fails and remains in a Read-only/Write Protected state

book

Article ID: 341534

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

Symptoms:
After changing the Logical Unit Number (LUN) state from Read-Only to Read-Write, you experience these symptoms:
  • Performing a rescan of the storage array fails to update the LUN
  • In the /var/log/vmkernel.log file, you see these sense codes:

    0x7 0x0 0x0

  • The virtual machine is unable to write to the attached RDM.


Environment

VMware vSphere ESXi 5.0
VMware vSphere ESXi 5.5
VMware vSphere ESXi 6.0
VMware vSphere ESXi 5.1

Cause

This issue occurs when cached INQUIRY data is not updated with the new LUN state and is passed to the guest OS.

Resolution

To resolve this issue reset the LUN to the actual LUN ID in which the state was changed:

  1. Connect to the host using the SSH and log in with root credentials Using ESXi Shell in ESXi 5.x and 6.0 (2004746).
  2. Run this command to reset the LUN:

    vmkfstools -L lunreset /vmfs/devices/disks/
    LUN_ID

    You should see these messages in the /var/log/vmkernel.log file:

    <YYYY-MM-DD>T<time>Z cpuXX:XXXXX)WARNING: NMP: nmpDeviceTaskMgmt:XXXX: Attempt to issue lun reset on device LUN_ID . This will clear any SCSI-2 reservations on the device.

    <YYYY-MM-DD>T<time>Z cpuXX:XXXXX)Resv: 631: Executed out-of-band lun reset on LUN_ID
    <YYYY-MM-DD>T<time>Z cpuXX:XXXXX)ScsiCore: 1486: Power-on Reset occurred on vmhbaX:CX:TX:LXXX</time></time></time>


  3. Run this command to reclaim the LUN:

    esxcli storage core claiming reclaim -d LUN_ID

    Note: This command will fail if there is I/O currently being sent to the device.

  4. If the virtual machine is still unable to write to the LUN, try each of these options individually:



Additional Information

If you need to change the state of the LUN from RO to RW, or vice versa, do it before you present the LUN to the ESXi host - or unmount the datastore/RDM before making the state change on the storage side.How to unmount a LUN or detach a datastore device from ESXi hosts
Using ESXi Shell in ESXi 5.x and 6.x
仮想マシンの RDM Logical Unit Number (LUN) を読み取り/書き込みモードに変更すると失敗して、読み取り専用/書き込み保護状態のままになる
将逻辑单元号状态从只读更改为读写模式后,虚拟机 RDM 仍处于只读/写保护模式

Impact/Risks:
* Changing the LUN write state from Read Write to Read Only "on the fly" while it is still being in use might cause data corruption on the device filesystem so this kind of change should never be done on a live datastore/Raw Device Map.