Wednesday, August 19, 2020

VMware vSphere 6.x: Unable to Share Virtual Disk between VMs for Clustering, Shows Error: Failed to lock the file

Problem:

VMware vSphere 6.x: virtual disk sharing issues. 

Scsi bus sharing gives error. 

Failed to lock the file

Cannot open the disk 

'/vmfs/volumes/5f2faf68-94237ef8-05dd-0025b501a022/MYVM001/MYVM001.vmdk' or one of the snapshot disks it depends on.

Failed to power on scsi2:4. 

Failed to add disk scsi2:4.

Solution :

Steps to share virtual disk between VMs with scsi bus sharing with physical compatibility and multi writer flag. 

In my example, I have 2 VMs each have 100 GB virtual disk which have operating system. I have to add another 200GB virtual disk which is shared between two virtual machines for Clustering. 

VM1 Configuration :

1. Shutdown the VM1, Go to VM settings, add new disk. 

2. Choose new virtual disk. 

3. Choose Thick provisioned Eager Zeroid (Any other format will not support for virtual disk sharing for Clustering).  

4. Choose scsci port 1:0 (in my example, first disk is used 0:0. Means it is connected on the first virtual scsi adapter. Since we choosed 1:0, second virtual scsi adapter will get create automatically. We should use separate scsi adapter for disk sharing)

5. Complete the disk add wizard.

6. Select virtual scsi adapter 1 which got created now, select "physical" in compatibility mode.

7. Check apply, OK, on VM settings window.

8.  Note down the 200GB new virtual disk location from VM1 settings. In my example, the location is "Datastore1/VM01/VM01_1.vmdk"

9. Shutdown the second machine, VM2

10. Go to vm settings, Add disk 

11. Choose option "Add existing disk" 

12. Browse the datastore and choose the path of the disk which we added on first node. "Datastore1/VM01/VM01_1.vmdk" 

13. Select the scsi port 1:0 as we did for VM1. 

14. Finish disk add wizard. Then choose the newly got created scsi adapter and set it as physical compatibility mode from right side menu. 

Now same 200GB is got added on both VMs using scsi bus sharing feature. 

Now we have to enable multi writer flag on both VMs to initialize the disk as cluster disk, otherwise we will not be able to power on both VMs simultaneously. 

Steps to Enable Multi Writer Flag 

1. Browse the datastore and download the vmx files of both VMs in local computer. In my example, file names are VM1.vmx and VM2.vmx

2. Open the both files in WordPad, add below entry at end. 

scsi1:0.sharing = "multi-writer"

3. Save both files using WordPad , and upload back to the datastore. (rename the original vmx file in datastore before uploading) 

4. Now power on both VMs. 


Now VMs are ready with shared storage of 200GB which we can use for Clustering purposes, example : Oracle RAC or SQL failover cluster 



1 comment:

  1. Some tv best .iptv networks additionally offer accessibility to sectors from their very own line-up, making it feasible for you to see programs at the time that functions for you. Language markets are no longer limited to a location; the Net gives an entrance for participants of an area to remain in touch and also share their society as well as heritage.

    ReplyDelete

Enter Comments...