Create and Administer ESXi Host and Datastore Clusters

Before going into the processes for creating ESXi datastore clusters, it’s worth covering the pre-requisites that need to be in place. In order to create a ESXi, DRS-enabled, cluster you should have the following:

  • Multiple ESXi hosts (a minimum of two, and a maximum of 32)
  • Consistent vSwitch configuration across all the hosts in the cluster. Either using Standard or Distributed vSwitches
  • Following on from the last point, there should also be consistent port group configuration across all hosts participating in the cluster
  • CPUs should be from the same vendor for all hosts in the cluster – AMD or Intel. CPUs should also be from the same CPU family so that they share common features. EVC can be used to help here.
  • The hosts should have access to a common network for vMotion.
  • Access to shared storage (FC, FCoE, iSCSI and NFS are all supported).

Creating a HA / DRS Cluster

Once the pre-requisites have been met, a cluster can be created using the vSphere client using the following steps:

  1. Right click on the ‘Datacenter’ object, then click ‘New Cluster’
  2. Enter a name for the cluster, and select to enable HA and DRS (if required).
  3. Select the required HA and DRS settings
  4. If required, configure the appropriate EVC settings
  5. Configure the virtual machine swap file location settings as required
  6. Verify the chosen settings on the summary screen:

Once finished, the ‘Create Cluster’ task will run.

It’s also possible to create a new cluster using PowerCLI. For example:

PowerCLI C:\> new-cluster -name TestCluster -DrsEnabled -HAEnabled  -Location VMLAB

Name                           HAEnabled  HAFailover DrsEnabled DrsAutomationLevel
                                          Level
----                           ---------  ---------- ---------- ------------------
TestCluster                    True       1          True       FullyAutomated

After creating a cluster, the next step is to add hosts to it. Using the vSphere client you can do this using the following steps:

  1. Right click the cluster, then click ‘Add Host’
  2. Enter the hostname and the root credentials for the host to add
  3. The next screen will display a summary of the host, including any existing virtual machines
  4. Assign a license to the host
  5. Enable Lockdown Mode if required
  6. Choose a Resource Pool for the host’s virtual machines
  7. Review the settings, then click ‘Finish’ to add the host to the cluster:

You can add a host to a cluster using PowerCLI by running:

PowerCLI C:\> add-vmhost esxi2.vmlab.loc -Location CLUSTER01 -Force

Or of your host is already joined to vCenter, you can move your host into the new cluster using the ‘move-vmhost’ cmdlet:

PowerCLI C:\> move-vmhost esxi2.vmlab.loc -Location CLUSTER01

Name                 ConnectionState PowerState NumCpu CpuUsageMhz CpuTotalMhz   MemoryUsageGB   MemoryTotalGB Version
----                 --------------- ---------- ------ ----------- -----------   -------------   ------------- -------
esxi2.vmlab.loc      Connected       PoweredOn       2         106        6184           0.977           4.000   5.1.0

Creating and Administering Datastore Clusters

I have written previously on creating datastore clusters, so won’t cover that ground again here. Instead, I’ll cover a few bits on working with datastore clusters using PowerCLI. Bear in mind that you will need PowerCLI 5.1 for these cmdlets.

To list datastore clusters you can run:

PowerCLI C:\> get-datastorecluster

Name                      CapacityGB      FreeSpaceGB     SdrsAutomationLevel
----                      ----------      -----------     -------------------
DS-CLUSTER                16.250          6.142           Manual

To change the automation level for the cluster you could run:

PowerCLI C:\Temp> Set-DatastoreCluster -DatastoreCluster DS-CLUSTER -SdrsAutomationLevel FullyAutomated

Name                      CapacityGB      FreeSpaceGB     SdrsAutomationLevel
----                      ----------      -----------     -------------------
DS-CLUSTER                16.250          6.142           FullyAutomated

To move a datastore into/out of a datastore cluster, you can use the ‘move-datastore’ cmdlet:

PowerCLI C:\Temp> move-datastore -Datastore SAN-VMFS-01 -Destination VMLAB

Name                               FreeSpaceGB      CapacityGB
----                               -----------      ----------
SAN-VMFS-01                              1.502           3.750
PowerCLI C:\Temp> move-datastore -Datastore SAN-VMFS-01 -Destination DS-CLUSTER

Name                               FreeSpaceGB      CapacityGB
----                               -----------      ----------
SAN-VMFS-01                              1.502           3.750

Finally, you can put a datastore (in a datastore cluster) into maintenance mode, using:

PowerCLI C:\Temp> set-datastore -Datastore SAN-VMFS-01 -MaintenanceMode $true

Name                               FreeSpaceGB      CapacityGB
----                               -----------      ----------
SAN-VMFS-01                              1.502           3.750

Related posts

VMware vSphere Virtual Machine Snapshots Explained

How to Enable SSH on All ESXi Hosts using PowerCLI

How to Install VMware Tools on Debian 11

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More