You can create Storage DRS anti-affinity rules to control which virtual disks should not be placed on the same datastore within a datastore cluster. By default, a virtual machine's virtual disks are kept together on the same datastore.
When you create an anti-affinity rule, it applies to the relevant virtual disks in the datastore cluster. Anti-affinity rules are enforced during initial placement and Storage DRS-recommendation migrations, but are not enforced when a migration is initiated by a user.
Note: Anti-affinity rules do not apply to CD-ROM ISO image files that are stored on a datastore in a datastore cluster, nor do they apply to swapfiles that are stored in user-defined locations.
- VM Anti-Affinity Rules
- Specify which virtual machines should never be kept on the same datastore. See Create VM Anti-Affinity Rules.
- VMDK Anti-Affinity Rules
- Specify which virtual disks associated with a particular virtual machine must be kept on different datastores. See Create VMDK Anti-Affinity Rules.
If you move a virtual disk out of the datastore cluster, the affinity or anti-affinity rule no longer applies to that disk.
When you move virtual disk files into a datastore cluster that has existing affinity and anti-affinity rules, the following behavior applies:
- Datastore Cluster B has an intra-VM affinity rule. When you move a virtual disk out of Datastore Cluster A and into Datastore Cluster B, any rule that applied to the virtual disk for a given virtual machine in Datastore Cluster A no longer applies. The virtual disk is now subject to the intra-VM affinity rule in Datastore Cluster B.
- Datastore Cluster B has an VM anti-affinity rule. When you move a virtual disk out of Datastore Cluster A and into Datastore Cluster B, any rule that applied to the virtual disk for a given virtual machine in Datastore Cluster A no longer applies. The virtual disk is now subject to the VM anti-affinity rule in Datastore Cluster B.
- Datastore Cluster B has an VMDK anti-affinity rule. When you move a virtual disk out of Datastore Cluster A and into Datastore Cluster B, the VMDK anti-affinity rule does not apply to the virtual disk for a given virtual machine because the rule is limited to only specified virtual disks in Datastore Cluster B.
Note: Storage DRS rules might prevent a datastore from entering maintenance mode. You can choose to ignore Storage DRS rules for maintenance mode by enabling the Ignore Affinity Rules for Maintenance option.