Remove shared VMFS from cluster

Sometime might happen you have to share VMFS across two different clusters for any reason. As it is not recommended to have it shared permanently sooner or later you should remove VMFS from one of the clusters.

In vSphere 4.X is bit complicated because first you have to mask LUN and then you can remove LUN from cluster zoning otherwise if you remove LUN from cluster zoning without masking it ESX server first. ESX will try to reconnect disconnected (unzoned)  LUN which will eventuality cause server completely unresponsive. The only way to bring server back to life would be hard reset.

shared VMFS

shared VMFS

In below example I will mask and remove datastore DATA02

vSphere 4.X
  • Enter host in Maintenance mode – just to be safe here 🙂
  • Map LUN identifier to logical name on ESXi server – esxcfg-scsidevs –vmfs

  • get more details about LUN by executing command: esxcfg-mpath –L | grep naa.<LUN-number>
    • HBA adapter is zoned to
    • LUNID
    • Target number

    As you can see LUN is visible on both adapters, vmhab1 and vmhba2 on L3 (LUNID). We have to mask LUN on both adapters with LunID 3

  • list all claim rules loaded on host: esxcli corestorage claimrule list

  • add claim rules for both adapters: I give rules numbers 192 and 193,  and I mask all LUNs on both adapters with LUNID 3
    • esxcli corestorage claimrule add –rule 192 -t location -A vmhba1 -L 3 -P MASK_PATH
    • esxcli corestorage claimrule add –rule 193 -t location -A vmhba2 -L 3 -P MASK_PATH

    [box type=”warning”] NOTE: In this example, run this command for rules 192 and 193. Your environment may differ based on the number that you provided in above step where you identified LUN details .[/box]

  • load storage rules into system : esxcli corestorage claimrule load
  • list rules on the system: esxcli corestorage claimrule list

  • Run this command on all hosts to unclaim the volume in question:
    • esxcli corestorage claiming reclaim –d naa.<LUN-identyfier>
  • rescan both adapters
  • verify if LUN is visible on the system

Now, you can remove LUN from ZONING on storage system for particular cluster. When  LUN was removed from ZONING deleter MASK rules from ESX hosts

  • Next step is to remove both claim rules from host:
    • esxcli corestorage claimrule delete –rule 192
    • esxcli corestorage claimrule delete –rule 193
  • Load rules again and list to verify if mask rules are gone all rules again by execute:
    • esxcli corestorage claimrule load
    • esxcli corestorage claimrule list

vSphere 5.X

On vSphere 5.X is much more easier, you don’t have to play with command line and claim rules, what you have to do it go to ESXi node and in storage settings right click on datastore and UNMOUNT. Remove LUN from zoning and that’s it.

Unmount VMFS from ESXi 5.X

Unmount VMFS from ESXi 5.X

Artur Krzywdzinski

Artur is Consulting Architect at Nutanix. He has been using, designing and deploying VMware based solutions since 2005 and Microsoft since 2012. He specialize in designing and implementing private and hybrid cloud solution based on VMware and Microsoft software stacks, datacenter migrations and transformation, disaster avoidance. Artur holds VMware Certified Design Expert certification (VCDX #077).