---
title: "How to configure All-Flash vSAN from command line"
date: "2017-10-05T07:00:45Z"
tags: ["All-Flash", "Flash", "vSAN"]
categories: ["Storage & Backup", "VMware"]
---

![How to configure All-Flash vSAN from command line - logo][1]

In my previous post <a href="https://www.wojcieh.net/my-new-home-lab/" target="_blank" rel="noopener">https://www.wojcieh.net/my-new-home-lab/ </a>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.<!--more-->
<!--adsense-->
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.
  ```bash
  [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",
    },
  ]
  ```
* In my case I've got two disks - 256GB NVME which will be used as flash tier and 2TB SSD as a capacity tier.
* Once we identified our disks we must tag the 2TB disk as a capacity disk
  ```bash
  esxcli vsan storage tag add -t capacityFlash -d t10.ATA_____Crucial_CT2050MX300SSD1_________________________1651150F2144
  ```
* 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
  ```
* In the next step, we will create vSAN Cluster.
  ```
  esxcli vsan cluster new
  ```
* 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))"
  ```
* Now we can deploy virtual machines.</ol> 

## References:
* <a href="http://www.virten.net/2015/11/building-a-single-node-vsan/" target="_blank" rel="noopener">http://www.virten.net/2015/11/building-a-single-node-vsan/</a>
* <a href="http://www.virtuallyghetto.com/2013/09/how-to-bootstrap-vcenter-server-onto_9.html" target="_blank" rel="noopener">http://www.virtuallyghetto.com/2013/09/how-to-bootstrap-vcenter-server-onto_9.html</a>
* <a href="https://docs.vmware.com/en/VMware-vSphere/6.0/com.vmware.vsphere.virtualsan.doc/GUID-42E65085-1DA5-4C0B-A397-3497CBBC600E.html" target="_blank" rel="noopener">https://docs.vmware.com/en/VMware-vSphere/6.0/com.vmware.vsphere.virtualsan.doc/GUID-42E65085-1DA5-4C0B-A397-3497CBBC600E.html</a>

[1]: /images/uploads/2017/10/how-to-configure-all-flash-vsan-from-command-line-logo.webp
