The Storage DRS rules that you define at the virtual machine level function in the same way as the affinity and anti-affinity rules that you define at the datastore cluster level. Virtual machine Storage DRS rules define whether virtual machine hard disks are placed and kept on the same datastore or on different datastores within a datastore cluster.

In the vSphere Client, you can create, edit, and delete Storage DRS rules. You can also create Storage DRS rules that place and keep all virtual disks of certain virtual machines on different datastores within a datastore cluster.

VMDK Affinity Rules

By default, all virtual machine hard disks are kept together on the same datastore within a datastore cluster that has Storage DRS enabled. That is, VMDK affinity rules are enabled by default for all virtual machines that are in a datastore cluster. You can override that rule for the datastore cluster or for individual virtual machines.

Storage DRS Anti-Affinity Rules

You can also create anti-affinity rules to place certain virtual hard disks or virtual machines on different datastores and keep them separated.
  • VMDK anti-affinity rules ensure that two or more virtual hard disks of a single virtual machine are placed and kept on different datastores within the datastore cluster.
  • VM anti-affinity rules ensure that all the virtual hard disks of two or more virtual machines are placed and kept on different datastores within the datastore cluster.

For more information about Storage DRS, see the vSphere Resource Management documentaion.

Add a VMDK Affinity Rule

Create a VMDK affinity rule to place and keep all virtual disks of a virtual machine on the same datastore within a datastore cluster.

Prerequisites

Procedure

  1. Navigate to a virtual machine in the inventory.
  2. On the Configure tab, expand Settings and click VM SDRS Rules.
  3. Click the Add button.
    The Add SDRS rule dialog box opens.
  4. From the Type drop-down menu, select VMDK affinity.
  5. From the Datastore cluster drop-down menu, select the datastore cluster where you want to keep the virtual machine disks.
    A datastore cluster is visible in the list only if the virtual machine configuration file or at least one of the virtual hard disks is placed on a datastore within the datastore cluster.
  6. (Optional) Deselect the Keep VMDKs together to create a rule that places and keeps the virtual hard disks on different datastores.
    If you leave the check box selected, the rule that you create is the same as the default Storage DRS rule that operates at the datastore cluster level.
    Deselecting the check box creates a Storage DRS rule that overrides the default VMDK affinity rule for the datastore cluster.
  7. Click OK.

Results

An Intra-VM Affinity rule is created that keeps VMDKs together. That is, all virtual hard disks of the selected virtual machine are placed and kept together on the same datastore within the datastore cluster.

Add a VMDK Anti-Affinity Rule

Create a VMDK anti-affinity rule to place and keep certain virtual hard disks of a virtual machine on different datastores within the datastore cluster.

When you create an anti-affinity rule, it applies to those of the virtual machine's hard disks that are on datastores within the selected datastore cluster. Anti-affinity Storage DRS rules operate during migrations that Storage DRS initiates or recommends, but they do not operate when the user initiates a migration.

Prerequisites

Procedure

  1. Navigate to a virtual machine in the inventory.
  2. On the Configure tab, expand Settings and click VM SDRS Rules.
  3. Click the Add button.
    The Add SDRS rule dialog box opens.
  4. From the Type drop-down menu, select VMDK anti-affinity.
  5. In the Rule name text box, enter a name for the rule.
  6. From the Datastore cluster drop-down menu, select the datastore cluster where the anti-affinity rule will operate.
    All virtual hard disks that are placed on datastores within the selected datastore cluster appear at the bottom of the dialog box.
  7. Select the virtual hard disks to which the anti-affinity rule applies.
  8. (Optional) Deselect the Enable the rule check box.
    Deselecting the Enable the rule check box deactivates the rule. You can still create the rule, but after creation the rule is not applied to the selected virtual hard disks.
  9. Click OK.

Results

A VMDK anti-affinity rule is created. If the rule is enabled, all selected virtual hard disks are placed and kept on different datastores within the datastore cluster.

Add a VM Anti-Affinity Rule

Create a VM anti-affinity rule to place and keep all virtual hard disks of selected virtual machines on different datastores within the datastore cluster.

Prerequisites

Procedure

  1. Navigate to a virtual machine in the inventory.
  2. On the Configure tab, expand Settings and click VM SDRS Rules.
  3. Click the Add button.
    The Add SDRS rule dialog box opens.
  4. From the Type drop-down menu, select VM anti-affinity.
  5. In the Rule name text box, enter a name for the rule.
  6. From the Datastore cluster drop-down menu, select the datastore cluster where the anti-affinity rule will operate.
  7. From the list of virtual machines at the bottom of the dialog box, select the virtual machines to which the anti-affinity rule applies.
    You can add or remove virtual machines to the list.
  8. (Optional) Deselect the Enable the rule check box.
    The rule is enabled by default.
    Deselecting the Enable the rule check box deactivates the rule. If an existing rule is deactivated, it is not applied to the virtual machine.
  9. Click OK.

Results

A VM anti-affinity rule is created. If the rule is enabled, all virtual hard disks of the selected virtual machines are placed and kept on different datastores within the datastore cluster.