How to convert a VMDK to a RDM
Sometimes you have a nice colleague who is moving a Virtual Machine from one datacenter to another, however if this Virtual Machine have a RDM connected to it, and the storage is not linked to each other you would end up with an extra VMDK, that once was a RDM
.
Okay so far my frustration
(just kidding here) but It would be nice if VMware would have shown a big information message, that indicate that the RDM will be converted to a VMDK when an Admin is doing something like mentioned here above, because not every administrator is aware what he is doing.
S
Now lets take a look at how we can fix this, because we end up with quite a large VMDK file of around 450 GB, and because we only have a few VMFS datastores of approximately 500 GB each, this is not a great situation.
Step one: compatibility mode
The first step would be to determine what kind of compatibility mode (physical or virtual) you’re using or want to use, you need this information because each compatibility mode have it’s own command line option. Below I have written down a summary of these two compatibility modes.
The default is physical compatibility mode. This allows the Guest OS to access the hardware directly, and this can be useful for: Situations where SAN snapshot capabilities require this Physical-to-virtual clustering, or you want to use software/tools from the array vendor.
Virtual compatibility allows the VM to use VMware snapshots and other advanced functionality while still providing direct LUN access. This is the preferred mode to use if possible since you get the benefits of VM snapshots.
Unfortunately you can’t convert the VMDK file back to a RDM while it’s being used by the Virtual Machine, so to be able to convert it, you need to remove the VMDK from the Virtual Machine or shutdown the guest OS.
But remember if this VMDK/RDM is used by for example a database server it is better to shutdown the guest OS and secondly to remove (note: just remove it from the VM and not from the datastore!!!) the VMDK from the Virtual Machine itself.
Below you will find the command lines for each compatibility mode, make note that there’s actually one small difference between these two, the difference is where you point to the RDM itself, for virtual compatibility you use the RDM option and for Physical compatibility mode you need to use RDMP as shown here below.
- The command line itself is very straightforward, first you need to point to the VMDK file you want to convert, in my example below it’s located in /vmfs/volumes/DATASTORE-NAME/VM-NAME/VMDK-SOURCE.vmdk.
- In the next step you need to choose if you want to use Virtual or Physical Compatibility Mode, and you need to point to the RDM LUN itself.
- And in the last section you create a “pointer” VMDK file which can be used to connect the RDM to the Virtual Machine.
For Virtual Compatibility Mode enter: "vmkfstools -i /vmfs/volumes/DATASTORE/VM/VMDK-SOURCE.vmdk -d /vmfs/devices/disks/t10.F405E46494C45400373613631636D284B67665D28725C685 /vmfs/volumes/DATASTORE/VM/VMDK-TARGET.vmdk"
For Physical Compatibility Mode enter: "vmkfstools -i /vmfs/volumes/DATASTORE/VM/VMDK-SOURCE.vmdk -d /vmfs/devices/disks/t10.F405E46494C45400373613631636D284B67665D28725C685 /vmfs/volumes/DATASTORE/VM/VMDK-TARGET.vmdk"
Depending on the size of the VMDK file it could take some time to do the conversion, when it’s ready you only need to add the “pointer” file which you created in step 3, to be able to connect the RDM to the Virtual Machine.
Well that’s it, as you see it’s not that hard, it only could take up some (down) time.
Later I found out that VMware have written a nice KB article about this, so next time I first check out the KB list before I figure out how things are working
.
Why not make a video and demonstrate it!?
I know i’m lazy… but it’s 01:05 at night and I’m too tired to read
In the long term it will save you time as well…
@Dion
That’s a great idea, if I find some time I will create a little video.
Thanks for sharing. The page does not render properly in FF 4.0.1 and Chrome.
The command line does not show well.
Cheers!
e1
Hi,
The command should take the format of “vmkfstools -i -d ”
In the example above, you put it as “vmkfstools -i -d ” so it’s a little confusing.
Below is an actual command I just issued to convert my Exchange from VMDK to Physical RDM:
vmkfstools –clonevirtualdisk /vmfs/volumes/Demo-Desktop-01/Exchange1/Exchange1_1.vmdk
/vmfs/volumes/Demo-Desktop-01/Exchange1/Exchange1_1_RDM.vmdk
–diskformat rdmp:/vmfs/devices/disks/naa.60a9800057396d2f685a64346b664549
Also, do we have to remove the VMDK first from the VM inventory (in vCenter VM property dialog box)? Manuals & KB did not say. As a precaution I did remove it. Scared as this is live Exchange 2010
Many thanks for the note. It does help!
@iwan ‘e1′ Rahabok
Hi Iwan,
Thanks for your comment on my post, I tried to fix the render issue and it looks much better now
I’m not sure if it’s required to do a “remove” action, I will give it a try and post the results in the post.
Thanks again.
Cheers,
Remon
Yup, it looks good now on FF 4!
I’ve added a bit more steps at my blog here
http://virtual-red-dot.blogspot.com/2011/05/how-to-convert-vmdk-to-rdm.html
Hope it helps.
e1
Of course this Vmware KB is wrong (at least for ESX 3.x)
The red output for:
esxcfg-mpath -l
gives vmhba2:0:3 yet in the example command they use:
rdm:/vmfs/devices/disks/vmhba3:0:2
which apart from TYPO (2 & 3 reversed) is also wrong, as the actual disk is most likely vmhba3:0:2:0
That is easy to check by ls in /vmfs/devices/disks/
Might help somebody doing the conversion & re-reading the KB article over & over