VMware Cloud Community
nicholas1982
Hot Shot
Hot Shot

Automating VSAN Diskgroup Creation

Hi All,

I have a question to ask regarding the creation of diskgroups. My hosts contain 2 cache ssd's and 6 capacity ssd's to create 2 diskgroups. When doing the one button claim disks in the GUI is there any standard selection of disks calculated or is it random?

 

The reason I ask is I’ve scripted the creation of 2 disk groups just using basic math of getting all disks filtering out the 2 cache and 6 capacity disks by vendor (will filter on CapacityGB as well later), then sorting the objects by CanonicalName, selecting the first cache disk and first 3 capacity disks for the first diskgroup and then selecting last cache disk and last 3 capacity disks for the second diskgroup. My thinking was because it was one controller and VSAN being a distributed file system this would be ok. I also checked canonical and runtime names of existing nodes built via the GUI and there doesn’t seem to be a pattern of disks selected on a per diskgroup basis, I have tested it and seems to work with no errors but I just want to clarify?

foreach ($vmhost in $vmhosts){

if((Get-VsanDiskGroup -VMHost $vmhost) -eq $null) {

$luns = $vmhost | Get-ScsiLun | select CanonicalName, CapacityGB, Vendor

       

        $Cache = $luns | ? {$_.vendor -eq "HGST"}

        $Capacity = $luns | ? {$_.vendor -eq "SAMSUNG"}

       

        $vsanCacheDisk = $Cache | Sort-Object CanonicalName | Select-Object -first 1 | select CanonicalName

$vsanCapacityDisk = $Capacity | Sort-Object CanonicalName | Select-Object -first ($Capacity.Count /2) | select CanonicalName

        New-VsanDiskGroup -VMHost $vmhost -SsdCanonicalName $vsanCacheDisk.CanonicalName -DataDiskCanonicalName $vsanCapacityDisk.CanonicalName -RunAsync

        $vsanCacheDisk = $Cache | Sort-Object CanonicalName | Select-Object -last 1 | select CanonicalName

$vsanCapacityDisk = $Capacity | Sort-Object CanonicalName | Select-Object -last ($Capacity.Count /2) | select CanonicalName

        New-VsanDiskGroup -VMHost $vmhost -SsdCanonicalName $vsanCacheDisk.CanonicalName -DataDiskCanonicalName $vsanCapacityDisk.CanonicalName -RunAsync

}

}

lamwVMware PowerCLI

Nicholas
Tags (3)
0 Kudos
1 Reply
srodenburg
Expert
Expert

If you claim all cache and capacity disks in a node and click ok in the Wizard, it will auto-divide the capacity-disks amongst the cache-disks in an even manner. You have no control as to which capacity disks get assigned to which cache-disk.

If you want any form of control, you must clickety-click each individual disk and assign (claim) it yourself and build disk-group by disk-group. Or in a script, pre-populate the naa. ID's etc. etc.

But why bother? It's not important which capacity disks end up where as long as they are evenly distributed in a node and the wizard does that.

I just installed a whole bunch of 9-disk nodes (each with 3x cache and 6x capacity) and vSAN nicely made 3 disk-groups with 1 cache and 2 capacity disks each, all by itself. Select a node, claim all disks to the appropriate tier and get a coffee. It's quicker than developing and testing a script unless you have a huge amount of nodes to add to a vSAN cluster.

0 Kudos