How to configure All-Flash vSAN from command line

How to configure All-Flash vSAN from command line - logo

In my previous post https://www.wojcieh.net/my-new-home-lab/ I showed you my new homelab. It was configured having in mind single node vSAN to leverage caching for I/O. Today I will show you how to configure all-flash vSAN from command line.

  1. To configure single node all-flash vSAN we first must identify the disks we will use.
  2. Login to ESXi via SSH and execute command vdq -q. This command will list all available disks to be used.

    [root@ESXi:~] vdq -q
    [
    {
        "Name"     : "t10.NVMe____WDC_WDS256G1X0C2D00ENX0__________________B10A464                                                                                                                                                             44A441B00",
        "VSANUUID" : "522288b0-d99b-a8f8-6dd5-44b7ef7354e4",
        "State"    : "In-use for VSAN",
        "Reason"   : "None",
        "IsSSD"    : "1",
    "IsCapacityFlash": "0",
        "IsPDL"    : "0",
    },
    
    {
        "Name"     : "t10.ATA_____DeLOCK_54659_32GB_______________________20170502                                                                                                                                                             AA9241826001",
        "VSANUUID" : "",
        "State"    : "Ineligible for use by VSAN",
        "Reason"   : "Has partitions",
        "IsSSD"    : "1",
    "IsCapacityFlash": "0",
        "IsPDL"    : "0",
    },
    
    {
        "Name"     : "t10.ATA_____Crucial_CT2050MX300SSD1_________________________                                                                                                                                                             1651150F2144",
        "VSANUUID" : "52c93db2-c879-ce09-ea2a-664a0ae10485",
        "State"    : "In-use for VSAN",
        "Reason"   : "None",
        "IsSSD"    : "1",
    "IsCapacityFlash": "1",
        "IsPDL"    : "0",
    },
    ]
    
  3. In my case I’ve got two disks - 256GB NVME which will be used as flash tier and 2TB SSD as a capacity tier.

  4. Once we identified our disks we must tag the 2TB disk as a capacity disk

    esxcli vsan storage tag add -t capacityFlash -d t10.ATA_____Crucial_CT2050MX300SSD1_________________________1651150F2144
    
  5. In the next step we will add 256GB NVME disk as a flash device.

    esxcli vsan storage add -s t10.NVMe____WDC_WDS256G1X0C2D00ENX0__________________B10A46444A441B00 -d t10.ATA_____Crucial_CT2050MX300SSD1_________________________1651150F2144
    
  6. In the next step, we will create vSAN Cluster.

    esxcli vsan cluster new
    
  7. Once vSAN Cluster is enabled we must change default vSAN policies to allow us to deploy virtual machines.

    esxcli vsan policy setdefault -c cluster -p "((\"hostFailuresToTolerate\" i0) (\"forceProvisioning\" i1))"
    esxcli vsan policy setdefault -c vdisk -p "((\"hostFailuresToTolerate\" i0) (\"forceProvisioning\" i1))"
    esxcli vsan policy setdefault -c vmnamespace -p "((\"hostFailuresToTolerate\" i0) (\"forceProvisioning\" i1))"
    esxcli vsan policy setdefault -c vmswap -p "((\"hostFailuresToTolerate\" i0) (\"forceProvisioning\" i1))"
    esxcli vsan policy setdefault -c vmem -p "((\"hostFailuresToTolerate\" i0) (\"forceProvisioning\" i1))"
    
  8. Now we can deploy virtual machines.

References: