In my previous article I shown Adding and sharing RDM disk to multiple VMs in VMware step by step, I received one related task to convert virtual machine RDM (Raw device mapping) hard disk to VMDK disk. Basically I require it to convert because, I was not going to use microsoft clustering anymore, also I was planning to change backend storage due to end of life. To complete this task, you have to just vMotion the rdm disk to another datastore changing disk type. Before doing it make ensure RDM disk compatibility mode must be Virtual mode, (Physical RDM disk cannot be changed VMDK). Here I have one with Physical RDM, To convert it to Virtual, go to VM edit settings, and expand the hard disk information. Click remove cross button on the same.
Once hard disk remove is pressed, Check the box Delete files from datastore, Note, this device will be removed. but it is safe to remove, as you are just removing RDM pointer file, actual data is still on remote storage device. Click OK button to proceed.
Now add same lun as new RDM hard disk, which still has data and change it's compatibility mode to Virtual. Click Ok.
For more on adding new RDM check Adding and sharing RDM disk to multiple VMs in VMware step by step.
Next right click virtual machine and from VMs actions context menu click Migrate, in the wizard select the migration type to change storage only. (Migrate the virtual machines's storage to a compatible datastore or datastore cluster)
In the next select storage here I can move entire VM to different datastore, but I am migrating only RDM disk, for this click Advanced button. From here select the new storage location for RDM and next change disk format to any of the one from 3 type - Thick provision lazy Zeroed, Thick provision eagar zeroed and Thin provision. I am selecting thin. Make sure compatibility checks succeeded and it is green. On the next ready to complete review the changes and click finish to start migration.
This will take time based on disk size. Here you can see the Recent Tasks has Relocate virtual machine is completed.
Now, again going to Edit settings of virtual machine, I see disk is VMDK now with type Thin provision. To reclaim raw disk back, Rescan datastores on esxi hosts.
Useful articles
POWERCLI: VMWARE ESXI CONFIGURE (VSWITCH) VMKERNEL NETWORK PORT FOR ISCSI STORAGE
POWERCLI VMWARE: CONFIGURE SOFTWARE ISCSI STORAGE ADAPTER AND ADD VMFS DATASTORE
POWERCLI: VIRTUAL MACHINE STORAGE MIGRATE/SVMOTION AND DATASTORE PORT BINDING MULTIPATHING
Emulate HDD as SSD flash disk on Esxi and VMware workstation