Search the VMware Knowledge Base (KB)
View by Article ID

Using Red Hat Clustering Suite on a vSphere 6.x vSAN Datastore (2151774)

  • 0 Ratings

Purpose

As occurs with VMFS and NFS datastores, VMware vSAN prevents multiple virtual machines from opening the same virtual disk (VMDK) in read-write mode. This is to protect the data stored on the virtual disk from corruption caused by multiple writers on the non-cluster-aware filesystems used by most guest OSes.

To enable in-guest systems that leverage cluster-aware filesystems that have distributed write (multi-writer) capability, we must explicitly enable multi-writer support for all applicable virtual machines and VMDKs.

This article outlines the process to create shareable VMDKs that reside on VMware vSAN and to enable multi-writer mode. This will permit multiple VMs to access the same VMDKs in read-write mode to enable the use of in-guest shared-storage clustering solutions such as Red Hat Clustering Suite.
 
Warning: Do not enable multi-writer mode for any VM/VMDK combination unless the guests are capable of safely arbitrating and coordinating multiple systems accessing the same storage. Enabling multi-writer mode for disks that do not use in-guest cluster-aware filesystems will result in data corruption.

Note: Enabling multi-writer mode removes support for some virtual machine operations and vSphere features. Please refer to this matrix for operation/feature supportability when multi-writer mode is enabled:

Supported and unsupported actions or features
 

Actions or Features

Supported

Unsupported

Notes

Power on, off, restart virtual machine

Suspend VM

×

Hot add virtual disks

Only to existing adapters

Hot remove devices

Hot extend virtual disk

×

Connect and disconnect devices

Snapshots

×

Virtual backup solutions leverage snapshots through the vStorage APIs; for example, VMware Data Recovery, vSphere Data Protection. These are also not supported.

Snapshots of VMs with independent-persistent disks

Only the shared disks need to be in independent-persistent mode. While Independent-Persistent disk mode is not a hard requirement to enable Multi-writer option, the default Dependent disk mode would cause the “cannot snapshot shared disk” error when a VM snapshot is taken. Use of Independent-Persistent disk mode would allow taking a snapshot of the OS disk while the shared disk would need to be backed up separately by a third-party vendor software.

Cloning

×

Storage vMotion

×

Changed Block Tracking (CBT)

×

vSphere Flash Read Cache (vFRC)

×

Stale writes can lead to data loss and/or corruption

vMotion



Supported for Red Hat Clustering and limited to 8 ESX/ESXi hosts

 

Virtual Use case:

  • Red Hat Clustering Suite, in which the application ensures that writes originating from two or more different virtual machines do not cause data loss.
  • This configuration was tested and supported on vSphere 6.x only.

Limitations and Requirements:

Note:

8 hosts limit applies to multi-writer mode shared virtual disks only. Otherwise, vSphere cluster size can be up to the maximum size supported by the license in use.

Resolution

Overview

The process of configuring a Red Hat cluster on a vSAN datastore needs to be done once per cluster at creation time. This requires these steps:

  • Creating a VM Storage Policy that will be applied to the virtual disks that will be used as the cluster’s shared storage.
  • Creating the shared virtual disks in eager-zeroed mode.
  • Attaching the shared disks to one or more virtual machines.
  • Enabling multi-writer mode for the VMs and disks.
  • Applying the virtual machine Storage Policy to the shared disks.

Depending on your Virtual Machine design specifications, you will need to define the VM Storage Policy that will be applied to the Red Hat cluster shared disks. Create a storage policy similar to this figure:
 
 

Notes:

In this example we named the VM Storage Policy RHCS

  • Object Space Reservation: 100% which pre-allocates all object’s components on disk.
  • Number of failures to tolerate: 1 is the default which will provide a mirror replica on another vSAN node. This provides RAID 1 protection against one host/hardware component failure. As the dialog shows, this will consume double the storage space on the vSAN datastore.
  • Number of disk stripes per object: The default vSAN policy is 1. For this policy select the desired stripe width. This is similar to RAID 0. In this example we are using the value of 2.

For more information about storage policy configuration options, please see theVMware vSAN documentation.

Add a storage controller to the Red Hat Enterprise Linux virtual machines

Note: Create controllers of the same type and in the same position (SCSI address) on each Red Hat Enterprise Linux virtual machine.

  1. Right-click the VM in the vSphere Web Client and select Edit Settings.
  2. At the bottom of the subsequent window, select SCSI Controller from the New device: drop-down menu and then click Add.
  3. Expand the New SCSI Controller entry.
  4. Leave the Bus Sharing mode as None, and choose the desired type (LSI ParallelorLSI SASorParavirtual).

    Note: The Paravirtual controller type is generally recommended for Red Hat cluster shared disks.



  5. Click OK
  6. Repeat this process on the remaining Red Hat Enterprise Linux virtual machines.

For vSphere 6.5 or newer

Creating shared disks on the first virtual machine

Starting with vSphere version 6.5, the vSphere Web Client has the option to create eager-zeroed disks on the vSAN datastore.

Note: The virtual disks should be added to the same SCSI positions on each virtual machine. If a disk is in position 1:0 on one virtual machine, it should be in position 1:0 on all virtual machines in the Red Hat cluster.

Using the vSphere Web Client

To create shared disks on the first virtual machine using the vSphere Web Client:

  1. Right-click the appropriate virtual machine and select Edit Settings.
  2. Select New Hard Disk from the New Device drop-down menu and then click Add.
  3. Expand the New Hard Disk entry and select Thick provision eager zeroed option in the Disk Provisioning drop down menu.
  4. In the Sharing drop down menu, select the Multi-writer option.
  5. Change the Disk Mode to Independent-Persistent.

    Note: While Independent-Persistent disk mode is not a hard requirement to enable Multi-writer option, the default Dependent disk mode would cause the cannot snapshot shared disk error when a virtual machine snapshot is taken. Use of Independent-Persistent disk mode would allow taking a snapshot of the OS disk while the shared disk would need to be backed up separately by a third-party vendor software.

  6. Modify theVirtual Device Node, as appropriate.
  7. Click OK to save the changes.
  8. Repeat this process for the remaining shared disks.

Adding shared disks to one or more virtual machines

To add shared disks to one or more virtual machines using the vSphere Web Client:

  1. Right-click the appropriate VM and select Edit Settings.
  2. Select Existing Hard Disk from the New Device drop-down menu and then click Add.
  3. Navigate to the applicable directory and select the disk.
  4. Click OK.
  5. Expand the New Hard Disk entry and modify the Virtual Device Node, as appropriate.
  6. In the Sharing dropdown menu, select the Multi-writer option.
  7. Change the Disk Mode to Independent-Persistent.

    Note: While Independent-Persistent disk mode is not a hard requirement to enable Multi-writer option, the default Dependent disk mode would cause the cannot snapshot shared disk error when a VM snapshot is taken. Use of Independent-Persistent disk mode would allow taking a snapshot of the OS disk while the shared disk would need to be backed up separately by a third-party vendor software.

  8. Click OK to save the changes.
  9. Repeat this process for the remaining virtual machines and shared disks.

For vSphere 6.0 Update 1 or newer, but below version 6.5

Creating Eager-Zeroed Disks (PowerCLI)

In vSphere version 6.0 Update 1 or newer, but below version 6.5 (Example: 6.0 Update 3), the vSphere Web Client cannot create eager-zeroed disks on the vSAN datastore. While the vSAN Datastore supports eager-zeroed disks, this functionality is not exposed in the vSphere Web Client. To accommodate this limitation in the current release, we must use either PowerCLI or the ESXi command line to create the eager-zeroed disks. This section outlines the PowerCLI method to create disks, and is the preferred method.

  1. Launch PowerCLI and connect to vCenter with Connect-VIServer.

    For more guidance with PowerCLI conventions, login, etc., see the VMware vSphere PowerCLI Documentation.

  2. Create the new hard disk with the New-HardDiskcmdlet in the form of:

    New-HardDisk -VM VM_name -CapacityGBsize-DatastorevSAN_datastore_name-StorageFormat EagerZeroedThick -Controllercontroller_name -Persistence IndependentPersistent

    For Example, to create a 16 GB disk on the RHCS_0VM, attached to SCSI Controller 1on the datastore vsanDatastore, run command:

    New-HardDisk -VM “RHCS_0” -CapacityGB 16 -Datastore “vsanDatastore” -StorageFormat EagerZeroedThick -Controller “SCSI Controller 1” -Persistence IndependentPersistent

    The name of the storage controller will match the name of the device we added to the virtual machines in the previous section.

    Note: While Independent-Persistent disk mode is not a hard requirement to enable Multi-writer option, the default Dependent disk mode would cause the cannot snapshot shared disk error when a virtual machine snapshot is taken. Use of Independent-Persistent disk mode would allow taking a snapshot of the OS disk while the shared disk would need to be backed up separately by a third-party vendor software.

  3. Repeat this process for any remaining shared disks you wish to create.

Creating Eager-Zeroed Disks (ESXi command line)

In vSphere version 6.0 Update 1 or newer, but below version 6.5 (Example: 6.0 Update 3), the vSphere Web Client cannot create eager-zeroed disks on the vSAN datastore. While the vSAN Datastore supports eager-zeroed disks, this functionality is not currently exposed in the vSphere Web Client. To accommodate this limitation in the current release, we must use either PowerCLI or the ESXi command line to create the eager-zeroed disks. This section outlines the ESXi command line method to create disks.

Note: You must enable the local ESXi shell or SSH access to the host and log in as privileged (root) user to complete the below procedure.

  1. Navigate to the directory of the first virtual machine in the Red Hat cluster:

    cd /vmfs/volumes/vsan_datastore/VM_Name

    Example:

    cd /vmfs/volumes/vsanDatastore/RHCS_0

  2. Create an Eager Zeroed Thick virtual disk to be shared using vmkfstools:

    vmkfstools -csize-W vsan -d eagerzeroedthick `pwd`/vmdk_file_name

    Example:

    vmkfstools -c 16G –W vsan –d eagerzeroedthick `pwd`/RHCS_0_1.vmdk

  3. Repeat step 2 for as many shared disks as need to be created.

Adding shared disks to one or more virtual machines

After the eager-zeroed disks are created, you must add them to the remaining Red Hat Enterprise Linux virtual machines using either the vSphere Web Client or PowerCLI.

Note: The virtual disks should be added to the same SCSI positions on each virtual machine. If a disk is in position 1:0 on one virtual machine, it should be in position 1:0 on all virtual machines in the Red Hat cluster.

Using the vSphere Web Client

To add shared disks to one or more virtual machines using the vSphere Web Client:

  1. Right-click the appropriate virtual machine and select Edit Settings.
  2. Select Existing Hard Disk from the New Device drop-down menu and then click Add.
  3. Navigate to the applicable directory and select the disk.
  4. Click OK.
  5. Expand the New Hard Disk entry and modify the Virtual Device Node, as appropriate.
  6. In the Sharing drop down menu, select the Multi-writer option.
  7. Change the Disk Mode to Independent-Persistent.

    Note: While Independent-Persistent disk mode is not a hard requirement to enable Multi-writer option, the default Dependent disk mode would cause the cannot snapshot shared disk error when a virtual machine snapshot is taken. Use of Independent-Persistent disk mode would allow taking a snapshot of the OS disk while the shared disk would need to be backed up separately by a third-party vendor software.

  8. Click OK to save the changes.



  9. Repeat this process for the remaining virtual machines and shared disks.

Using PowerCLI

  1. Launch PowerCLI and connect to vCenter Server with Connect-VIServer.
  2. Add the existing disk with the New-HardDisk cmdlet in the form of:

    New-HardDisk -VMVM_Name-DiskPath “[datastore_name]folder/disk_file” -Controllercontroller_name-Persistence IndependentPersistent

    For example, to add the disk RHCS_0_1.vmdk on the datastore vsanDatastore in the folder RHCS_0 to the VMRHCS_1 and attach it to SCSI Controller 1, run command:

    New-HardDisk -VM RHCS_1 -DiskPath “[vsanDatastore]RHCS_0/RHCS_0_1.vmdk” -Controller “SCSI Controller 1” -Persistence IndependentPersistent

    Note: While Independent-Persistent disk mode is not a hard requirement to enable Multi-writer option, the default Dependent disk mode would cause the cannot snapshot shared disk error when a virtual machine snapshot is taken. Use of Independent-Persistent disk mode would allow taking a snapshot of the OS disk while the shared disk would need to be backed up separately by a third-party vendor software.

  3. Repeat this process for the remaining VMs and shared disks.

For vSphere version prior to 6.0 Update 1)

Enabling multi-writer mode for the VMs and Disks using the ESXi shell

The addition of the multi-writer flag is not possible via the vSphere Web Client version prior to 6.0 Update 1. If vSphere 6.0 Update 1 or newer is not installed, use the ESXi shell to enable multi-writer mode on the applicable virtual machines and disks.

Note: As this involves modifying and loading virtual machine configurations, it is recommended that all Red Hat Enterprise Linux virtual machines be registered to the same ESXi host for the purposes of making these changes so we don’t have to log in to multiple hosts. The VMs can be distributed throughout the vSphere cluster after making these changes.

  1. To enable SCSI bus sharing for a particular disks, run:

    echo ‘scsi<N>:<D>.sharing = “multi-writer”’ >>path_to_VMX_file

    For example, to enable multi-writer for SCSI device 1:0 for the VMRHCS_0 on the datastore vsanDatastore, run this command:

    echo ‘scsi1:0.sharing = “multi-writer”’ >> /vmfs/volumes/vsanDatastore/RHCS_0/RHCS_0.vmx

  2. Complete step 2 for all applicable disks and virtual machines, modifying the SCSI position as appropriate. For example, to share four disks, add all of these entries to the applicable VMX files:

    scsi1:0.sharing = "multi-writer"
    scsi1:1.sharing = "multi-writer"
    scsi1:2.sharing = "multi-writer"
    scsi1:3.sharing = "multi-writer"

  3. Refresh the virtual machine configuration to apply the changes.
    1. Identify the virtual machine to refresh using this command:

      vim-cmd vmsvc/getallvms |grep -iVM_name

      For example, to list all virtual machine with RAC in the name registered to the host, run command:

      vim-cmd vmsvc/getallvms |grep -i RHCS

      You see output with the virtual machine registration that includes the VMID in the left-most column. The VMID is a simple integer number.

    2. Refresh the configuration:

      vim-cmd vmsvc/reloadVMID

      For example, if the VMID of one of the Red Hat Enterprise Linux virtual machines is 24, run command:

      vim-cmd vmsvc/reload 24

  4. Reload all applicable virtual machines.

Applying the VM Storage Policies to the shared disks

After the shared disks are created and added to all virtual machines using one of the three methods above, you must apply the storage policy created for the Red Hat cluster shared disks. The policy must be applied to all applicable disks on all Red Hat Enterprise Linux virtual machines.

  1. In vSphere Web Client, right-click the virtual machine and click Edit Settings.
  2. Expand the appropriate hard disk entry.
  3. Choose the desired VM storage policy from the dropdown list.
  4. Verify that the disk mode is Independent – Persistent.

    Note: While Independent-Persistent disk mode is not a hard requirement to enable Multi-writer option, the default Dependent disk mode would cause the cannot snapshot shared disk error when a VM snapshot is taken. Use of Independent-Persistent disk mode would allow taking a snapshot of the OS disk while the shared disk would need to be backed up separately by a third-party vendor software.

  5. Click OK.



  6. Repeat this process for all applicable virtual machines and disks.

    Note
    : If you want to apply a different storage policy to the Red Hat cluster shared disks at a later date, the policy change must be executed against all shared disks and on all virtual machines sharing that disk.

Additional Information

For more information on configuring and managing Red Hat cluster, see Red Hat Enterprise Linux 7 High Availability Add-on Administration.

Tags

Red Hat Clustering Suite, vSphere 6.x, vSAN Datastore

See Also

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 0 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.

What can we do to improve this information? (4000 or fewer characters)




Please enter the Captcha code before clicking Submit.
  • 0 Ratings
Actions
KB: