RAID Groups Calculator (RAID-DP)

A little fling ... a simple calculator that answers the question “How many RAID groups should I have, and what size should the RAID groups be?” depending on various inputs.

Firstly, a screenshot to illustrate how the tool works, and how to use it:

Image: Using RaidGroupsCalculator.ps1

The Script

#######################################
## RaidGroupCalculator.ps1 (RAID-DP) ##
#######################################
Param(
  [Parameter(Mandatory=$True,HelpMessage="Number of shelves on the node/HA-pair.")]
  [Int]$ShelfCount,
  [Parameter(Mandatory=$True,HelpMessage="If you have root disks on these shelves, then 3 for a node, 6 for a HA-pair, otherwise 0.")]
  [Int]$RootDisks,
  [Parameter(Mandatory=$True,HelpMessage="Number of spares on the node/HA-pair.")]
  [Int]$SparesCount,
  [Parameter(Mandatory=$True,HelpMessage="Number of other disks (like you might have 4 SSDs in a SAS shelf).")]
  [Int]$OtherDisks,
  [Parameter(Mandatory=$True,HelpMessage="Number of disks in a shelf (usually 24, but might be 48).")]
  [Int]$DisksInShelf,
  [Parameter(Mandatory=$True,HelpMessage="Target RAID group size.`n TYPE # Default => Maximum`n SSD # 23 => 28`n SAS/FC # 16 => 28`n SATA # 14 => 20`n 6TB MSATA # 14 => 14")]
  [Int]$TargetRaidGroupSize
)
## ===== CALCULATION ===== ##
Function RoundUp{Param([Double]$N);[Int][Math]::Ceiling($N)}
[Int]$AvailableDisks = ($ShelfCount * $DisksInShelf) - $RootDisks - $SparesCount - $OtherDisks
[Int]$RaidGroups     = RoundUp($AvailableDisks/$TargetRaidGroupSize)
[Int]$AvrgRGsize     = RoundUp($AvailableDisks/$RaidGroups)
[Int]$LastRGsize     = $AvailableDisks - (($RaidGroups -1)*$AvrgRGsize)
[Int]$Balancer       = RoundUp(($AvrgRGsize - $LastRGsize) / $RaidGroups)
[System.Array]$Output = @()
For($i=1;$i -lt $RaidGroups;$i++){
  If(($LastRGsize + $Balancer) -lt $TargetRaidGroupSize){
    $Output     += ($AvrgRGsize - $Balancer)
    $LastRGsize += $Balancer
  }else{ $Output += $AvrgRGsize }
}
$Output += $LastRGsize;""
## ===== OUTPUT ===== ##
">>>>> RAID Groups Size Calculator (RAID-DP) <<<<<";""
"Shelf Count       = " + [String]$ShelfCount
"Root Disks Count  = " + [String]$RootDisks
"Spares Count      = " + [String]$SparesCount
"Other Disks Count = " + [String]$OtherDisks
"Disks In a Shelf  = " + [String]$DisksInShelf
"Target RG Size    = " + [String]$TargetRaidGroupSize;""
"Raid Group Count  = " + [String]$RaidGroups
"Data Disks Count  = " + [String]($AvailableDisks - ($RaidGroups * 2))
"Parity Disks      = " + [String]($RaidGroups * 2)
"Root/Spares/Other = " + [String]($RootDisks + $SparesCount + $OtherDisks)
"TOTAL DISKS       = " + [String]($ShelfCount * $DisksInShelf);""
"<<<<< RAID Group Sizes >>>>>";""
$Output = $Output | Sort -Descending
[String]$Output;""


Comments