Add Local Storage (e.g. a SATA disk) as a Raw Disk Mapping (RDM) or Mapped RAW LUN to a virtual machine hosted on ESXi using vmkfstools

Using the vmkfstools command to create the Raw Disk Mapping(RDM)

Syntax:
vmkfstools -r <source> (space) <destination>
vmkfstools  -r  /vmfs/devices/disks/<physical disk path> (space) /vmfs/volumes/[b]<vmfs datastore name>[/b]/<folder name>/<virtual disk name>.vmdk

List all physical disk path of the storage device
#esxcfg-mpath -l
or 
#ls  /vmfs/devices/disks/
we need at lease 2 hdd( one for store data or iso and other hdd use for map LUN)
-First: we need to add storage via remote vsphere-client: go to select on ip-host =>configuration=>storage =>add storage=>select <disk/lun> =>next and set datastore-name=>finish.
-Second: ssh to vsphere and use command create folder /vmfs/volumes/esxdev004_local1_vmfs3/SATA500G then use this command to create RDM
At the console prompt type
#vmkfstools -r  /vmfs/devices/disks/t10.ATA_____ST3500320AS_______________________________XXXXXXX  /vmfs/volumes/esxdev004_local1_vmfs3/SATA500G/SATA500G.vmdk
esxdev004_local1_vmfs3 is datastore name of other hard disk that we add storage with vsphere-client
SATA500G is a folder created on the VMFS datastore to store the proxy mapping (vmdk) file.
SATA500G.vmdk is the name of the proxy mapping file (false virtual disk - vmdk.)
XXXXXXXX  is a serial number of hard disk

Now we can check RDM after create with path above:
#ls /vmfs/volumes/esxdev004_local1_vmfs3/SATA500G/

After entering the above command, vmkfstools does not respond with any output this is normal. If you check the datastore, you will see that a virtual machine disk named SATA500G.vmdk has been created.


Adding the RDM to a Virtual Machine
Using the VMware vSphere Client, Login and Connect to the ESXi server

Select an existing virtual machine, you want to add the RDM to, and select Edit Settings. The new hard disk can be added whilst the virtual machine is powered on or off. Hotplug is supported on some Windows OS.


Select Use an existing Virtual Disk
(please do not select Raw Device Mapping)


Browse the datastore and select the VMDK file and click OK, followed by Next


click default until finish.
The virtual machine will report a Mapped Raw LUN has been added.


enjoy!!

List all vms
#vim-cmd vmsvc/getallvms