Posted by: Denny Cherry
Raw Device Mapping, SQL Server, VMware
The biggest performance issue when virtualizing your SQL Server is storage. One way to fix this is to present storage directly to the virtual machine instead of placing the virtual machines storage within a virtual disk. In VMware this is done by using a Raw Device Mapping.
In a nut shell what we are doing with a Raw Device Mapping we take a LUN, which is presented to the VMware host. Instead of formatting this LUN with a file system and making it a datastore within VMware you detect it as normal, but leave it unformated. You can then attach the now mounted device to the virtual machine as a SCSI device.
This can be done either when the virtual machine is being created, or it can be done after the fact. In the case of these screenshots the RAW device is being added to an existing virtual machine.
Edit the virtual machine’s properties and click the Add button at the top to add a new hardware device to the virtual machine. Select Hard Disk and click Next.
On the next screen select Raw Device Mappings instead of creating a new virtual disk, or using an existing one.
On the next screen select the raw unformatted device which you wish to present to the guest. (Yes I realize that this LUN which is showing up shows as 0 bytes, but this is just a demo, you’ll want to select a LUN which has a LUN ID which isn’t 0 and has a size over 0 bytes.)
The next screen asks what data store you want to store the LUN mapping. Typically you’ll store this with the Virtual Machine, but you can select any datastore to store this mapping on. (In my case I’m selecting to store with the Virtual Machine.)
On the next screen you’ll need to make a decision as to weather you want the ability for VMware to take a snapshot of the raw device or not. Personally when it comes to SQL Server I don’t see this as a function that is all that useful. SQL has full and transaction log backups to handle the point in time recovery, so I would say that most of the time you’ll want to select Physical. If you need the ability to take snapshots of the raw device then select virtual.
On the next screen you need to select the SCSI address that you want to mount the disk to within the virtual machine. If you selected Virtual on the prior screen then you’ll also have the option to make the disk Independent as well as persistent or nonpersistant (this isn’t shown, but are the same options which are available when creating a virtual disk).
The last screen will present you wish a basic summary of what is being added to the virtual machine.
After Clicking Finish, click OK on the Virtual Machine properties. Log into the VM and rescan the SCSI bus as you would to detect any new disk being adding to the virtual machine. Create a partition (with the offset set correctly) and format the partition normally. You can now access the drive, and the virtual machine will have direct access to the SAN over the fiber channel network.