Tuesday, March 13, 2018

VMware vSAN bootstrap with dedupe and compression

Many of you know about vSAN bootstrap configuration which allows you to configure vSAN on a single ESXi host without vCenter Server.

There are a lot of posts which contains detailed information about bootstrap vSAN configuration, but today I would like to provide you additional steps to enable vSAN deduplication and compression on a single host without vCenter Server.

First of all, you need a host with ESXi 6.0 U2 or newer (because we need vSAN 6.2 or higher to support dedupe and compression). Secondary, your host must have at least two flash devices/SSD drives (one - for caching, others - for capacity). It's better to use SSD drives from the VMware HCL, but due to light loads in the homelab you could use any cheap SSD drive with sufficient performance. Also you should remember that there are no data redundancy in such configuration, so any SSD failure will lead to the complete data loss.

Enable SSH and connect to the host.

Enable support for vSAN traffic on one of the VMKernle interface (even if you are planning to have only one host, you have to enable this setting):
esxcli vsan network ipv4 add -i vmk0
You could check the settings with command:
esxcli vsan network list
Using vdq -q command check that all SSD drives are detected by ESXi host and are available for claiming.
vdq -q
[
   {
      "Name"     : "naa.6000c29f63422c9b752b4e16b0853303",
      "VSANUUID" : "",
      "State"    : "Ineligible for use by VSAN",
      "Reason"   : "Has partitions",
      "IsSSD"    : "0",
"IsCapacityFlash": "0",
      "IsPDL"    : "0",
   },
   {
      "Name"     : "naa.6000c2914ef142687a2ea87a31a4c207",
      "VSANUUID" : "522af0ce-c313-dbfb-21b7-ba8e0b509778",
      "State"    : "In-use for VSAN",
      "Reason"   : "None",
      "IsSSD"    : "1",
"IsCapacityFlash": "0",
      "IsPDL"    : "0",
   },
   {
      "Name"     : "naa.6000c29dc7b03388ce238783d25a085c",
      "VSANUUID" : "52964ee8-1ad3-51ee-8850-8315e0ebceb6",
      "State"    : "In-use for VSAN",
      "Reason"   : "None",
      "IsSSD"    : "1",
"IsCapacityFlash": "1",
      "IsPDL"    : "0",
   },
]
If drive is not detected as SSD, you could mark it manually. Get the NAA and SATP values via the command:
esxcli storage nmp device list
Run the commands and replace --device and --satp parameters with the correct ones.
esxcli storage nmp satp rule add --satp=VMW_SATP_LOCAL --device naa.600508b1001cdb71c7edb8e80eb6abf3 --option "enable_ssd"
esxcli storage core claiming unclaim --type=device --device naa.600508b1001cdb71c7edb8e80eb6abf3
esxcli storage core claimrule load
esxcli storage core claimrule run
esxcli storage core claiming reclaim --device naa.600508b1001cdb71c7edb8e80eb6abf3
If drive is not marked as CapacityFlash you could use the command:
esxcli vsan storage tag add -d naa.6000c29dc7b03388ce238783d25a085c -t capacityFlash
Before configuring vSAN cluster you need to set the correct licensed features to enable vSAN deduplication and compression.
vsish -e set /config/VSAN/strOpts/LicensedFeatures vit,allflash,stretchedcluster,erasurecoding,storageefficiency,encryption
Create the new vSAN cluster.
esxcli vsan cluster new
Check that the host is added to the cluster:
esxcli vsan cluster get
Cluster Information
   Enabled: true
   Current Local Time: 2017-08-11T22:01:45Z
   Local Node UUID: 598e2050-a425-2c28-5426-005056aacefb
   Local Node Type: NORMAL
   Local Node State: MASTER
   Local Node Health State: HEALTHY
   Sub-Cluster Master UUID: 598e2050-a425-2c28-5426-005056aacefb
   Sub-Cluster Backup UUID:
   Sub-Cluster UUID: 598e2050-a425-2c28-5426-005056aacefb
   Sub-Cluster Membership Entry Revision: 0
   Sub-Cluster Member Count: 1
   Sub-Cluster Member UUIDs: 598e2050-a425-2c28-5426-005056aacefb
   Sub-Cluster Membership UUID: 05298e59-0555-5bb1-c414-005056aacefb
   Unicast Mode Enabled: true
   Maintenance Mode State: OFF
Edit storage policies and add forceProvisioning option. This option allows vSAN to ignore the requirements for hostFailuresToTolerate=1 which cannot be accomplished in a single node vSAN cluster:
esxcli vsan policy setdefault -c cluster -p "((\"hostFailuresToTolerate\" i1) (\"forceProvisioning\" i1))"
esxcli vsan policy setdefault -c vdisk -p "((\"hostFailuresToTolerate\" i1) (\"forceProvisioning\" i1))"
esxcli vsan policy setdefault -c vmnamespace -p "((\"hostFailuresToTolerate\" i1) (\"forceProvisioning\" i1))"
Check policies with the command:
esxcli vsan policy getdefault
Policy Class  Policy Value
------------  --------------------------------------------------------
cluster       (("hostFailuresToTolerate" i1) ("forceProvisioning" i1))
vdisk         (("hostFailuresToTolerate" i1) ("forceProvisioning" i1))
vmnamespace   (("hostFailuresToTolerate" i1) ("forceProvisioning" i1))
vmswap        (("hostFailuresToTolerate" i1) ("forceProvisioning" i1))
vmem          (("hostFailuresToTolerate" i1) ("forceProvisioning" i1))
Enable deduplication and compression before adding SSD drives to the vSAN disk group:
esxcli system settings advanced set -o "/VSAN/DedupScope" -i 2
Check settings:
esxcli system settings advanced list -o "/VSAN/DedupScope"
Add SSD drives to the disk group:
esxcli vsan storage add -d naa.6000c29dc7b03388ce238783d25a085c -s naa.6000c2914ef142687a2ea87a31a4c207
Verify that all drives are added and enabled for deduplication and compression:
esxcli vsan storage list
naa.6000c2914ef142687a2ea87a31a4c207
   Device: naa.6000c2914ef142687a2ea87a31a4c207
   Display Name: naa.6000c2914ef142687a2ea87a31a4c207
   Is SSD: true
   VSAN UUID: 522af0ce-c313-dbfb-21b7-ba8e0b509778
   VSAN Disk Group UUID: 522af0ce-c313-dbfb-21b7-ba8e0b509778
   VSAN Disk Group Name: naa.6000c2914ef142687a2ea87a31a4c207
   Used by this host: true
   In CMMDS: true
   On-disk format version: 5
   Deduplication: true
   Compression: true

   Checksum: 6910810568216580648
   Checksum OK: true
   Is Capacity Tier: false
   Encryption: false
   DiskKeyLoaded: false
naa.6000c29dc7b03388ce238783d25a085c
   Device: naa.6000c29dc7b03388ce238783d25a085c
   Display Name: naa.6000c29dc7b03388ce238783d25a085c
   Is SSD: true
   VSAN UUID: 52964ee8-1ad3-51ee-8850-8315e0ebceb6
   VSAN Disk Group UUID: 522af0ce-c313-dbfb-21b7-ba8e0b509778
   VSAN Disk Group Name: naa.6000c2914ef142687a2ea87a31a4c207
   Used by this host: true
   In CMMDS: true
   On-disk format version: 5
   Deduplication: true
   Compression: true

   Checksum: 4407850188756192377
   Checksum OK: true
   Is Capacity Tier: true
   Encryption: false
   DiskKeyLoaded: false
If you are using unsupported drives disable the alarm which displays warnings in the Host Client interface:
esxcli system settings advanced set -o /LSOM/VSANDeviceMonitoring -i 0 
During working via Host Client I got a minor bug. In the Host Client the default name for the datastore is "vSAN Datastore" (with space) and in vCenter and from the CLI the name is "vSANDatastore" (without space) which leads to the errors during VM or virtual disk creation via Host Client. To fix this issue simply rename the datastore to the "vSANDatastore".

Unfortunately, Host Client does not provides information about storage efficiency, so the only way to evaluate this value is to compare VMs Used space and datastore used space values.

As for the numbers, on my homelab server I have more than 30 different VMs (mostly with Windows OS and some Linux appliances) and vSAN provides about 2,4 dedupe and compression ratio. So it's quite cost efficient solution.
Share:

1 comment: