Understanding RDM allocation to Virtual Machine (VM)

In this post I am going to show you the usage of RDM (Raw disk mapping).

We have option of types of RDM mapping to VM.
1) Physical RDM generally referred as pRDM.
2) Virtual RDM generally referred as vRDM

Case 1 : We will start by assigning pRDM of 512MB to VM.
When we are assigning pRDM to VM we have disk mode options disabled only depended option is enabled by default which can’t be changed.

When pRDM is allocated to VM snapshots, we can’t take the snapshot. 

Step 1 : Below are the files which are associated with VM named as Redhat-1. I have not assigned the RDM currently to VM.

/vmfs/volumes/5402dbfb-890c9058-8caa-000c29903392/Redhat-1 # ls -lsh
total 11668496
0 -rw-r–r– 1 root root 82 Aug 31 08:31 Redhat-1-34d5cced.hlog
1048576 -rw——- 1 root root 1.0G Aug 31 08:28 Redhat-1-34d5cced.vswp
10485760 -rw——- 1 root root 10.0G Aug 31 08:33 Redhat-1-flat.vmdk
1024 -rw——- 1 root root 8.5K Aug 31 08:31 Redhat-1.nvram
0 -rw——- 1 root root 493 Aug 31 08:31 Redhat-1.vmdk
0 -rw-r–r– 1 root root 0 Aug 31 08:28 Redhat-1.vmsd
8 -rwxr-xr-x 1 root root 2.7K Aug 31 08:31 Redhat-1.vmx
0 -rw——- 1 root root 0 Aug 31 08:28 Redhat-1.vmx.lck
0 -rw-r–r– 1 root root 263 Aug 31 08:28 Redhat-1.vmxf
8 -rwxr-xr-x 1 root root 2.7K Aug 31 08:31 Redhat-1.vmx~
1024 -rw-r–r– 1 root root 145.4K Aug 31 08:31 vmware-0.log
1024 -rw——- 1 root root 312.7K Aug 31 08:28 vmware-1.log
1024 -rw-r–r– 1 root root 91.5K Aug 31 08:33 vmware.log
130048 -rw——- 1 root root 127.0M Aug 31 08:28 vmx-Redhat-1-886426861-1.vswp

Step 2 : After adding pRDM we can see the new files are coming into picture with extension rdmp.vmdk its an mapping file to RDM.

/vmfs/volumes/5402dbfb-890c9058-8caa-000c29903392/Redhat-1 # ls -lsh
total 11668496
0 -rw-r–r– 1 root root 82 Aug 31 08:31 Redhat-1-34d5cced.hlog
1048576 -rw——- 1 root root 1.0G Aug 31 08:28 Redhat-1-34d5cced.vswp
10485760 -rw——- 1 root root 10.0G Aug 31 08:34 Redhat-1-flat.vmdk
1024 -rw——- 1 root root 8.5K Aug 31 08:31 Redhat-1.nvram
0 -rw——- 1 root root 493 Aug 31 08:31 Redhat-1.vmdk
0 -rw-r–r– 1 root root 0 Aug 31 08:28 Redhat-1.vmsd
8 -rwxr-xr-x 1 root root 3.0K Aug 31 08:34 Redhat-1.vmx
0 -rw——- 1 root root 0 Aug 31 08:28 Redhat-1.vmx.lck
0 -rw-r–r– 1 root root 263 Aug 31 08:28 Redhat-1.vmxf
8 -rwxr-xr-x 1 root root 2.7K Aug 31 08:34 Redhat-1.vmx~
0 -rw——- 1 root root 512.0M Aug 31 08:34 Redhat-1_1-rdmp.vmdk
0 -rw——- 1 root root 495 Aug 31 08:34 Redhat-1_1.vmdk
1024 -rw-r–r– 1 root root 145.4K Aug 31 08:31 vmware-0.log
1024 -rw——- 1 root root 312.7K Aug 31 08:28 vmware-1.log
1024 -rw-r–r– 1 root root 93.6K Aug 31 08:34 vmware.log
130048 -rw——- 1 root root 127.0M Aug 31 08:28 vmx-Redhat-1-886426861-1.vswp

Step 3 : Now I have created one file system on top of pRDM assigned to VM and created 100MB file on it. You will not see any sort of change in consumption of RDM because it sort of thick type.

[root@Node1 ~]# mount -t ext4 /dev/rdm_vg/rdm_lv1 /mnt
[root@Node1 ~]# df -h /mnt/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rdm_vg-rdm_lv1
485M 11M 449M 3% /mnt
[root@Node1 ~]# cd /mnt/
[root@Node1 mnt]# dd if=/dev/zero of=/dev/rdmfile bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.178301 s, 588 MB/s

Step 4 : Currently VM is powered on I am migraitng the VM using Storage VMotion to different datastore mapping files are getting moved to different Datastore.
In this case I have done the migration from ISCSIDatastore1 to ISCSIDatastore2

/vmfs/volumes/53d6a375-e1484298-3faa-000c29e52a9d/Redhat-1 # pwd
/vmfs/volumes/ISCSIDatastore2/Redhat-1
/vmfs/volumes/53d6a375-e1484298-3faa-000c29e52a9d/Redhat-1 # ls -lsh
total 11669520
0 -rw-r–r– 1 root root 82 Aug 31 08:53 Redhat-1-1a79c343.hlog
1048576 -rw——- 1 root root 1.0G Aug 31 08:51 Redhat-1-1a79c343.vswp
10485760 -rw——- 1 root root 10.0G Aug 31 08:53 Redhat-1-flat.vmdk
1024 -rw——- 1 root root 8.5K Aug 31 08:53 Redhat-1.nvram
0 -rw——- 1 root root 493 Aug 31 08:54 Redhat-1.vmdk
0 -rw-r–r– 1 root root 0 Aug 31 08:51 Redhat-1.vmsd
8 -rwxr-xr-x 1 root root 2.9K Aug 31 08:53 Redhat-1.vmx
0 -rw——- 1 root root 0 Aug 31 08:51 Redhat-1.vmx.lck
0 -rw-r–r– 1 root root 263 Aug 31 08:51 Redhat-1.vmxf
8 -rwxr-xr-x 1 root root 2.9K Aug 31 08:53 Redhat-1.vmx~
0 -rw——- 1 root root 512.0M Aug 31 08:53 Redhat-1_1-rdmp.vmdk
0 -rw——- 1 root root 495 Aug 31 08:53 Redhat-1_1.vmdk
1024 -rw-r–r– 1 root root 134.7K Aug 31 08:53 vmware-0.log
1024 -rw——- 1 root root 312.7K Aug 31 08:51 vmware-1.log
1024 -rw——- 1 root root 119.2K Aug 31 08:51 vmware-2.log
1024 -rw-r–r– 1 root root 93.5K Aug 31 08:52 vmware.log
130048 -rw——- 1 root root 127.0M Aug 31 08:51 vmx-Redhat-1-444187459-1.vswp

Step 5 : Now I have Powered off the VM and trying to perform the Storage vmotion by changing the pDisk to thick provision lazy zeroed using advanced options.
Now lets see what happened to VM pRDM disk. It has changed to new extension flat.vmdk
In this case migrating from ISCSIDatastore2 to ISCSIDatastore1.

/vmfs/volumes/5402dbfb-890c9058-8caa-000c29903392/Redhat-1 # pwd
/vmfs/volumes/ISCSIDatastore1/Redhat-1
/vmfs/volumes/5402dbfb-890c9058-8caa-000c29903392/Redhat-1 # ls -lsh
total 11015176
10485760 -rw——- 1 root root 10.0G Aug 31 08:57 Redhat-1-flat.vmdk
1024 -rw——- 1 root root 8.5K Aug 31 08:59 Redhat-1.nvram
0 -rw——- 1 root root 493 Aug 31 08:59 Redhat-1.vmdk
0 -rw-r–r– 1 root root 0 Aug 31 09:00 Redhat-1.vmsd
8 -rwxr-xr-x 1 root root 2.6K Aug 31 09:00 Redhat-1.vmx
0 -rw-r–r– 1 root root 263 Aug 31 09:00 Redhat-1.vmxf
524288 -rw——- 1 root root 512.0M Aug 31 08:59 Redhat-1_1-flat.vmdk
0 -rw——- 1 root root 492 Aug 31 08:59 Redhat-1_1.vmdk
1024 -rw——- 1 root root 134.7K Aug 31 09:00 vmware-0.log
1024 -rw——- 1 root root 312.7K Aug 31 09:00 vmware-1.log
1024 -rw——- 1 root root 119.2K Aug 31 09:00 vmware-2.log
1024 -rw——- 1 root root 114.3K Aug 31 09:00 vmware.log

Data remains intact this is the biggest advantage of RDM.

[root@Node1 ~]# mount -t ext4 /dev/rdm_vg/rdm_lv1 /mnt
[root@Node1 ~]# cd /mnt
[root@Node1 mnt]# ls
lost+found rdmfile rdmfile1

Snapshot operation is not possible in case of physical RDM biggest drawback I can say.

Case 2 : Assigning vRDM to VM. I have removed the pRDM which we added in case 1 and adding it as vRDM to VM.

Step 1 : After adding the RDM new file with name ending with rdm.vmdk will come into picture instead of rdmp.vmdk which is coming with physical RDM.

/vmfs/volumes/5402dbfb-890c9058-8caa-000c29903392/Redhat-1 # ls -lsh
total 11671568
1048576 -rw——- 1 root root 1.0G Aug 31 09:05 Redhat-1-34d5cced.vswp
10485760 -rw——- 1 root root 10.0G Aug 31 09:03 Redhat-1-flat.vmdk
1024 -rw——- 1 root root 8.5K Aug 31 09:03 Redhat-1.nvram
0 -rw——- 1 root root 493 Aug 31 09:05 Redhat-1.vmdk
0 -rw-r–r– 1 root root 0 Aug 31 09:00 Redhat-1.vmsd
8 -rwxr-xr-x 1 root root 2.8K Aug 31 09:05 Redhat-1.vmx
0 -rw——- 1 root root 0 Aug 31 09:05 Redhat-1.vmx.lck
0 -rw-r–r– 1 root root 263 Aug 31 09:00 Redhat-1.vmxf
8 -rwxr-xr-x 1 root root 2.8K Aug 31 09:05 Redhat-1.vmx~
0 -rw——- 1 root root 512.0M Aug 31 09:05 Redhat-1_1-rdm.vmdk
0 -rw——- 1 root root 483 Aug 31 09:05 Redhat-1_1.vmdk
1024 -rw——- 1 root root 134.7K Aug 31 09:00 vmware-0.log
1024 -rw——- 1 root root 312.7K Aug 31 09:00 vmware-1.log
1024 -rw——- 1 root root 119.2K Aug 31 09:00 vmware-2.log
1024 -rw——- 1 root root 114.3K Aug 31 09:00 vmware-3.log
1024 -rw-r–r– 1 root root 136.4K Aug 31 09:03 vmware-4.log
1024 -rw-r–r– 1 root root 115.2K Aug 31 09:05 vmware.log
130048 -rw——- 1 root root 127.0M Aug 31 09:05 vmx-Redhat-1-886426861-1.vswp

Step 2 : As snapshot operation is possible with vRDM hence created snapshot with name snap-1.
After creating snapshot just to check which disk is created for rdm even though its clear from name as well.

/vmfs/volumes/5402dbfb-890c9058-8caa-000c29903392/Redhat-1 # ls -lsh
total 12838928
17408 -rw——- 1 root root 16.0M Aug 31 09:11 Redhat-1-000001-delta.vmdk
0 -rw——- 1 root root 319 Aug 31 09:06 Redhat-1-000001.vmdk
1048576 -rw——- 1 root root 1.0G Aug 31 09:05 Redhat-1-34d5cced.vswp
1050624 -rw——- 1 root root 1.0G Aug 31 09:09 Redhat-1-Snapshot1.vmsn
10485760 -rw——- 1 root root 10.0G Aug 31 09:06 Redhat-1-flat.vmdk
1024 -rw——- 1 root root 8.5K Aug 31 09:07 Redhat-1.nvram
0 -rw——- 1 root root 493 Aug 31 09:05 Redhat-1.vmdk
0 -rw-r–r– 1 root root 468 Aug 31 09:06 Redhat-1.vmsd
8 -rwxr-xr-x 1 root root 2.8K Aug 31 09:06 Redhat-1.vmx
0 -rw——- 1 root root 0 Aug 31 09:05 Redhat-1.vmx.lck
0 -rw-r–r– 1 root root 263 Aug 31 09:00 Redhat-1.vmxf
8 -rwxr-xr-x 1 root root 2.8K Aug 31 09:06 Redhat-1.vmx~
99328 -rw——- 1 root root 96.0M Aug 31 09:11 Redhat-1_1-000001-delta.vmdk
0 -rw——- 1 root root 322 Aug 31 09:11 Redhat-1_1-000001.vmdk
0 -rw——- 1 root root 512.0M Aug 31 09:05 Redhat-1_1-rdm.vmdk
0 -rw——- 1 root root 483 Aug 31 09:05 Redhat-1_1.vmdk
1024 -rw——- 1 root root 134.7K Aug 31 09:00 vmware-0.log
1024 -rw——- 1 root root 312.7K Aug 31 09:00 vmware-1.log
1024 -rw——- 1 root root 119.2K Aug 31 09:00 vmware-2.log
1024 -rw——- 1 root root 114.3K Aug 31 09:00 vmware-3.log
1024 -rw-r–r– 1 root root 136.4K Aug 31 09:03 vmware-4.log
1024 -rw-r–r– 1 root root 128.3K Aug 31 09:09 vmware.log
130048 -rw——- 1 root root 127.0M Aug 31 09:05 vmx-Redhat-1-886426861-1.vswp

Step 3 : Now I merged and deleted the snapshot.

Step 4 : After storage vmotion from ISCSIDatastore1 to ISCSIDatastore2 and converting RDM lun to thin type.

/vmfs/volumes/53d6a375-e1484298-3faa-000c29e52a9d/Redhat-1 # ls -lsh
total 3311632
0 -rw-r–r– 1 root root 82 Aug 31 09:19 Redhat-1-1a79c343.hlog
1048576 -rw——- 1 root root 1.0G Aug 31 09:16 Redhat-1-1a79c343.vswp
2109440 -rw——- 1 root root 10.0G Aug 31 09:19 Redhat-1-flat.vmdk
1024 -rw——- 1 root root 8.5K Aug 31 09:19 Redhat-1.nvram
0 -rw——- 1 root root 519 Aug 31 09:19 Redhat-1.vmdk
0 -rw-r–r– 1 root root 0 Aug 31 09:16 Redhat-1.vmsd
8 -rwxr-xr-x 1 root root 2.9K Aug 31 09:19 Redhat-1.vmx
0 -rw——- 1 root root 0 Aug 31 09:16 Redhat-1.vmx.lck
0 -rw-r–r– 1 root root 263 Aug 31 09:16 Redhat-1.vmxf
8 -rwxr-xr-x 1 root root 2.9K Aug 31 09:19 Redhat-1.vmx~
15360 -rw——- 1 root root 512.0M Aug 31 09:19 Redhat-1_1-flat.vmdk
0 -rw——- 1 root root 518 Aug 31 09:19 Redhat-1_1.vmdk
1024 -rw-r–r– 1 root root 182.2K Aug 31 09:19 vmware-0.log
1024 -rw——- 1 root root 312.7K Aug 31 09:16 vmware-1.log
1024 -rw——- 1 root root 119.2K Aug 31 09:16 vmware-2.log
1024 -rw——- 1 root root 114.3K Aug 31 09:16 vmware-3.log
1024 -rw——- 1 root root 136.4K Aug 31 09:16 vmware-4.log
1024 -rw——- 1 root root 149.0K Aug 31 09:16 vmware-5.log
1024 -rw-r–r– 1 root root 93.2K Aug 31 09:17 vmware.log
130048 -rw——- 1 root root 127.0M Aug 31 09:16 vmx-Redhat-1-444187459-1.vswp

We can change the disk mode in vRDM.

Conclusion :

pRDM with VM Powered On :

We can’t take the snapshots of VM
We can migrate the VM from one datastore to datastore to another but only pRDM mapping file is moved. Data stays on original LUN.

pRDM with VM Powere off :

Still we can’t take the snapshot.
We can migrate the VM from one datastore to datastore to another by changing the RDM type to vmdk using advanced option.
If we are not chosing advanced option only mapping files are getting migrated as in case of pRDM with VM powered on

vRDM with Power On :
Able to take the snapshot in depedent disk mode even including memory.
Only mapping file is moved from one datastore to another.
In case on vRDM we can change the vRDM to vmdk using advanced option which was not possible in pRDM allocation when VM is powered on.

vRDM with Power off :
Snapshot obviously are possible.
In case of storage migration again only mapping files are moved.
In case on vRDM we can change the vRDM to vmdk using advanced option

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s