In most cases you will add VMFS volumes (LUNs) to your vSphere environment, because most of the time your environment will grow. Adding a LUN is very simple: Just configure the masking correctly on your SAN, carry out a rescan on your ESXi server (or the entire cluster) and you have your LUN/volume available.

But what about removing a LUN from your environment. This is a bit more tricky, you have to think about:

  • No virtual machines are using the LUN you want to remove. The LUN should not be used as a RDM;
  • The LUN should not be a part of a datastorecluster and storage DRS should not be active on the LUN;
  • Storage IO Control should be disabled for the LUN;
  • The LUNs should not be used as a HA heartbeat datastore;
  • And the LUN should not be used as persistent scratch partition.

On top of that, you cannot just remove the LUN, even when it’s not used anymore by virtual machines. It’s very important to first unmount the LUN and then detach the LUN from your ESXi server.

VMware described a clear procedure in the following two KB articles:

  • Removing a LUN containing a datastore from VMware ESXi/ESX 4.x – KB 1029786
  • Unpresenting a LUN in ESXi 5: KB 2004605