Safely Removing and Adding a Physical RDM

Scenario: I have a Physical RDM directly attached to a Virtual Machine (Windows 2008 R2) over a storage network. This was formatted as NTFS on my E: drive. I wanted to physically re-locate the box from one rack to another which would involve shutting down and moving the storage deivce (OpenFiler). The cabling was ready. Here are the steps:

1) Take the drive offline in the VM. Go to Start –> Administrative Tools -> Computer Management. Right click the E:/ drive and choose Oflline

2) in vCenter right click the VM and select Edit Settings. On hthe Hardware tab select the relevant Mapped Raw LUN and click Remove . Ensure Remove from virtual machine is selected.  (Before you do this you may also want to take note the location of the vmdk file. RDMs use VMDKs as pointer files so we'll need to re-attach that when the storage device is switched back on)

3) The next stage is to detach the iSCSI target. This is straight forward in ESXi 5.0 +. On each ESXi host go to Configuration -> Storage -> Devices . Right click the desired target then select Detach . 

VMware will go through a checklist to ensure it is safe to detach. As we get the green ticks we can then press OK

4) Once the storage device has been turned back on we do the reverse of above. Right click the detached iSCSI target and then select Attach. When all the hosts have been re-attached the the target then we can re-add the VMDK file to the virtual machine

5) In vCenter right click the VM and select Edit Settings. On the Hardware tab select Add .  From the device type choose Hard Disk -> Use an existing configured virtual disk -> Browse to the vmdk file that was previously removed then click Next . Press OK when back on the first tab and the Mapped Raw LUN should be re-added succesfully.

6) Finally, go back into the VM and turn the disk back on (via Computer Management)