Mount local harddisk as RAW in VMWare ESXi 4 / ESXi 5

Source: http://www.vm-help.com/esx40i/SATA_RDMs.php

(21-Nov-2011: The below method has been tested on VMWare ESXi 5)

Scenario: I have a physical drive installed with OS.  I would like to move the processing under ESX, but I would like to keep my old drive and avoid data migration.   The best way to do this is to create a virtual machine, where the disks pointing to my physical disk.  How to I create a fake .vmdk file pointing to my old SATA disk installed inside the same server box?

RDM and RAW(passthrough) is a simple solution.  I cannot find relevant command under vSphere client.  We may need to do the below command under the console of ESX.  (TODO: how to enable console)

1. use fdisk -l to show the physical disk
2. use ls /vmfs/devices/disks/ -l to determine the VML identifier for the disk
    (You may use with grep command to further filter the result:
       ls /vmfs/devices/disks/vml.* -l | grep ST3640323AS)

3. use vmkfstools to create a vmdk file as a pointer to the physical disk

Create RDM
vmkfstools -r /vmfs/devices/disks/vml.01000000002020202020202020202020203951473358423630535433353030 Seagate-640.vmdk -a lsilogic


Create RAW (passthrough)
vmkfstools -z /vmfs/devices/disks/vml.010000000020202020202020202020202039564b30375a4653535433363430 Seagate-640-P.vmdk -a lsilogic


For easy reference, I have extract part of the manual of vmkfstools related to RDM.  You may refer to here for full man page

Extract of man page of vmkfstools

VMKFSTOOLS                 VMware ESX Server Manual                 VMKFSTOOLS

NAME
     vmkfstools - VMware ESX Server file system management tool

SYNOPSIS
     vmkfstools OPTIONS
     vmkfstools OPTIONS PARTITION
     vmkfstools OPTIONS DEVICE
     vmkfstools OPTIONS PATH

VIRTUAL DISK OPTIONS
Create RDM
     -r, --createrdm /vmfs/devices/disks/...
         Map a raw disk to a file on a VMFS file system. Once the mapping
         is established, it can be used to access the raw disk like a
         normal VMFS virtual disk. The ´file length´ of the mapping is
         the same as the size of the raw disk that it points to.


     -z, --createrdmpassthru /vmfs/devices/disks/...
         Map a passthrough raw disk to a file on a VMFS file system. This
         allows a virtual machine to bypass the VMKernel SCSI command
         filtering layer done for VMFS virtual disks. Once the mapping is
         established, it can be used to access the passthrough raw disk
         like a normal VMFS virtual disk.
 
Query RDM
     -q, --queryrdm
         List the attributes of a raw disk mapping. When used with a
         ´rdm:´ or ´raw:´ specification, it prints out the
         vmhba name of the raw disk corresponding to the mapping
         referenced by the . It also prints out identification
         information for the raw disk (if any). 

SUPPORTED DISK FORMATS
     `rdm`
         Virtual compatibility mode raw disk mapping.

     `rdmp`
         Physical compatibility mode (pass-through) raw disk mapping.

Comments

Popular Posts