In most configurations, a VM needs a disk just for itself. In some situations, it makes sense to create a shared...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
virtual disk, for example, in an environment that requires using high-availability clusters.
In a high-availability cluster, multiple nodes take care of making sure a vital resource is available at all times. Don't confuse this with VMware HA, where vSphere offers high availability for the virtual machines (VMs) themselves. We're talking about a high-availability stack that is running in the VMs to make sure resources running on top of the VM operating system will be highly available.
In this high-availability setting, shared storage is involved in many cases. As an example, imagine that a Web service is configured for high availability. That may mean that, by default, it runs on VM1, and when something bad happens to that VM, it will be migrated to VM2. After its migration in the cluster, the Web service still needs access to the same configuration files and data. That is where a shared disk device comes in. By sharing a disk device between multiple cluster nodes -- which means between multiple VMs that are in the cluster -- you can put the data on that shared disk and, after a failure, the remaining nodes in the cluster can just access its data.
Setting up a shared disk in vSphere isn't hard to do; you just have to create a shared VMDK. However, there are some caveats.
Setting up a shared virtual disk
To set up a shared VMDK, first create the VMDK and put it in a data store. I like doing this from the vCLI interface by using this command:
vmdktools.pl -server 192.168.100.10 -c 20G -d eagerzeroedthick /vmfs/volumes/shared-disk.vmdk -a lsilogic
In this command, different options are used. First, there is the -server parameter that specifies on which ESXi host the shared disk will be created. You can use a vCenter Server as well by using the -i option, followed by the address of the vCenter Server. The -c 20G option creates the shared disk with a size of 20 GB.
The most important part of the command is -d eagerzeroedthick. This sets up the disk as a thick provisioned disk, which is essential for the disk to be shared in the cluster. For thin provisioning to work, one VM needs complete control and an overview of what is happening on the disk, which is why this default way of setting up disks doesn't work.
Finally, specify where the disk has to be stored and which type of (SCSI) disk is going to be created. Just make sure to use lsilogic, because it will work on virtually all shared disks.
After adding the disk to the data store, you'll need to connect the disk to the VMs that are going to use it. Open the add hardware wizard, add a new disk and select "Use an existing virtual disk." Browse to the data store that contains the disk you've just created and select it.
Next, you need to connect the new disk to an adapter that is not being used. This is important because a shared disk cannot be on the same adapter as a logical disk.
Next, back under the edit settings for the new VM, change the new disks controller's SCSI bus sharing setting to "Physical." Repeat this procedure on the other VM and you'll be ready to start using the shared disk with your cluster software.