Share and Share Alike – Sharing VMDK’s Between Virtual Machines

by bunchc on December 16, 2008

This can be used to enable ‘MSCS’ in a box, in a lab scenario, or any other sort of setup, where more than one VM will require access to the same disk. Careful here though, your file system will need to support this as well. Read on for more.

First we need to make the disk:

Log into the service console and execute the following:
[root]# vmkfstools -c 249G -d thick /vmfs/volumes/250/shared.vmdk -a lsilogic

Reading that, it tells vmkfstools to create a 249 GB disk file, in a thick file with an adaptor type of Lsi Logic. The Thick formatting is critical, as it is what enables parts of this process. *Note, under normal circumstances Thick disk files are a security risk.

Next we add it to the VM’s

1

Use the existing disk:
2

Select the disk:
3

Use a new, unused SCSI Adaptor:
4

Last step:
5

There are our devices, make sure the adaptor is in Physical mode:
6

Hope this was helpful. Please leave any questions or thoughts in the comments.

  • Pingback: storage area network

  • http://www.beenverified.com Background Check

    Really helpful… I was searching all over town for this info.

  • http://professionalvmware.com professionalvmware

    Tis why we're here!

  • Pingback: VMware disk types, sharing vmdk disks | jarno’s / trul’s page

  • Pingback: Professional VMware » Blog Archive » Sharing and Snapshots – Another Look at Sharing VMDK Files

  • http://www.dealhotels.net/ Hotel Travel Deals

    really helpful dude.. no doubt about it.. thanks for sharing this info!!!

  • Duncan

    Was very helpful. A good insight. Tnx!

  • john191

    I would just say one thing to you and that is, “FANTASTIC”!! Keep it up and wish to get more details from your blog.
    regards
    sears parts

  • http://professionalvmware.com professionalvmware

    Cool. Thanks for reading.

  • http://professionalvmware.com professionalvmware

    Cool. Thanks for reading.

  • tiffany1111
  • DigitalBlacksmith

    I noticed this does not seem to work for vSphere, when I add the disk I get an error on the second machine saying “Failed to power on scsi0:1. Failed to add disk scsi0:1. Any ideas?

  • http://professionalvmware.com professionalvmware

    I'll give this a revisit shortly then. Thanks for hanging in there.

  • Vinod

    Thanks for your inputs. I have tried this and could add the VMDK to both the VMs. But only one VM is powering up. Other one halts throughing error that the file is locked. Any work around to come out of this.
    I am not configuring any MSCS in these VMs. Is there any way can achieve the disk sharing without MSCS. I tried with the RDM, it works but the data is not getting synchronised. Means if the VM1 is creating any files to the shared drive it is not visiable to the VM2 unless the VM is rebooted.

  • http://professionalvmware.com professionalvmware

    For 'file sharing' or so, you will need to ensure you are using a cluster
    aware filesystem. NTFS is not generally, and requires MSCS to make this
    happen. As far as the file being locked or so, go back and double check the
    settings on both VMs are identical (scsi controller, port mode, etc).

    -C

  • http://twitter.com/jlupoltsql James Lupolt

    Here are my notes on doing this in 4.1 (from vague memory):

    1. You can do it all in vSphere with no CLI. Make sure to tick the options for thick provisioning and supporting fault tolerance when creating the disk.
    2. For Windows 2008 Failover Clustering, the disk needs to be on a LSI Logic SAS controller. You won’t see this controller type unless the VM’s hardware version is 7 (or at least, hardware version 5 doesn’t have it).
    3. The procedure for adding a SCSI controller to a VM in vSphere can be somewhat unintuitive and AFAIK can’t be done directly. If you need to add a controller, when you add the disk, simply give it a SCSI ID on a different bus, and ESX will add a controller for you. For example, if the VM’s one existing disk is on an LSI Logic Parallel controller and has an ID of 0:1, and you want to add another disk that supports Failover Clustering, give it an ID of x:y, where x is 1, 2, or 3.
    4. You might need to manually change the controller type of the controller that ESX added for you. I think it defaulted to something other than SAS when I did this.
    5. Some of this seems to be order-dependent. For example, I created a disk with a different controller type and was getting errors about persistent reservations failing during cluster validation. I upgraded the VM’s hardware version and converted the controller to SAS and rebooted the VMs, but the errors persisted. Then I destroyed the disk and recreated it with the controller type set to SAS, and cluster validation passed.

Previous post:

Next post: