There will be a situation on a Datacenter Migration project where we need to plan about Migrating RDM Luns between Arrays. As the Raw LUN’s themselves cannot be moved, as they are raw disks presented from the SAN.
First, we need to change the compatibility mode from physical to virtual
- Power off both virtual machines.
- Right-click the Node B virtual machine and click Edit Settings.
- Note the SCSI device that the RDM is using. For example, SCSI 0:5.
- Remove the RDM hard disk from the virtual machine, ensure that the Delete from Disk option is not selected, and click OK.
- Right-click the Node A virtual machine and click Edit Settings.
- Note the SCSI device that the RDM is using. For example, SCSI 0:5.
- Remove the RDM hard disk from the virtual machine, ensuring that the Delete from Disk option is selected, and click OK.Note: Unlike VMDK files, the Delete from Disk option removes only the RDM pointer files. Data on the RDM remains intact.
- Right-click the Node A virtual machine and click Edit Settings.
- Add the RDM to the virtual machine as a new disk and select virtual compatibility mode. Ensure that you use the SCSI device that you need in step 6.
- Right-click the Node B virtual machine and click Edit Settings.
- Add the RDM back to the virtual machine as an existing disk (use the RDM pointer file created in step 9) and select virtual compatibility mode. Ensure that you use the SCSI device that you need in step 3.
- Power on the Node A virtual machine.
- Power on the Node B virtual machine.
Get into the disk management, and make sure that the disk is online. If it is not, then bring the disk online.
Once the Compatibility mode is changed we need to use Storage vMotion feature in VMware to convert the RDM to VMDK
- Select the Virtual Machine, right click and select Migrate, on the next screen, select Change Datastore.
- Click on the Advanced tab, so that you specify the details for one disk at a time.
- Select the RDM disk, change the datastore and also make sure that you change the Disk Format to one of the three options available. (Thick Lazy Zeroed, Thick Eager Zeroed, Thin Provision)
- Once the disk migration completed, we have successfully converted an RDM disk to a VMDK file.
Now the last part to convert the VMDK back to RDM in the destination array
- Run the command:
# esxcfg-mpath -L
The output appears similar to:
(Lun presented from destination array for RDM)
vmhba1:C0:T4:L3 state:active naa.600144f0a43a060000005a0f75e30004 vmhba1 0 4 3 NMP active san fc.2000001b328b4af5:2100001b328b4af5 fc.2001001b3233bbf9:2101001b3233bbf9
- Run the appropriate command for either the virtual or physical compatibility mode:
- For virtual compatibility mode, run the command:
# vmkfstools –i srcfile -d rdm:/vmfs/devices/disks/identifier/vmfs/volumes/datastore/vmdir/vmname.vmdk
Note: Theidentifier
value represents the value recorded in step 3.For example:
# vmkfstools -i olddisk.vmdk -d rdm:/vmfs/devices/disks/
naa.600144f0a43a060000005a0f75e30004/vmfs/volumes/TestDatastore/TestVM/rdmdisk.vmdk
- For physical compatibility mode, run the command:
# vmkfstools –i srcfile -d rdmp:/vmfs/devices/disks/identifier/vmfs/volumes/datastore/vmdir/vmname.vmdk
Note: Theidentifier
value represents the value recorded in step 3.For example:
# vmkfstools -i olddisk.vmdk -d rdmp:/vmfs/devices/disks/
naa.600144f0a43a060000005a0f75e30004/vmfs/volumes/TestDatastore/TestVM/rdmdisk.vmdk
- For virtual compatibility mode, run the command:
This will get the RDM on the VM moved over to another array with data being intact
Reference Links:
- Switching between physical to virtual compatibility mode : https://kb.vmware.com/s/article/1006599
- Converting VMDK to RDM : https://kb.vmware.com/s/article/3443266
- Migrating virtual machines : https://kb.vmware.com/s/article/1005241
- Difference between physical and virtual compatibility mode : https://kb.vmware.com/s/article/2009226
–Venkatesh Sekar