Extending tiered storage spaces - Windows Server 2022

 As part of the work I have done in my homelab with tiered storage on Server 2022 storage spaces, here is a script I created that allows you to easily extend a tiered storage space, so you can expand your storage pool size when you add more disks or even replace your current disks with higher capacity ones

Drop this in a .ps1 file and watch it go:

write-output "
Welcome to the EASYExtendTieredVD script.

By Luke Varley  - www.Phishandchips.dev

This script will allow you to easily extend a Tiered Storage Spaces
Virtual Disk when you add new a SSD or HDD

Read the comments in the script for instructions

#Created with knowlegde obtained from
#Credit: https://nils.schimmelmann.us/post/153541254987/intel-smart-response-technology-vs-windows-10
Joe Freeman
#Credit: https://github.com/freemansoft/win10-storage-spaces
# https://nils.schimmelmann.us/post/153541254987/intel-smart-response-technology-vs-windows-10
#check if elevation is required
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
    if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
     write-output "
#Number of columns in your VD is the number of disks you need to add before you can utilise the extra capacity of those disks
    #so if you have 3 columns, you wont be able to exend capacity of your VD until you add an extra 3 disks
        #OR you replace all disks in your storage tier with disks of a higher capacity e.g. 8TB - 4 x 2TB disks, replace each disk 1 by 1 to 4 x 4tb disks for 16TB capacity
#Tiers in the storage pool
#Find these by running get-StorageTier
$SSDTierName = "VMStoreHDDCacheVD-SSDTier-VMStoreHDD"
$HDDTierName = "VMStoreHDDCacheVD-HDDTier-VMStoreHDD"

#Override the default sizing here - useful if have two different size SSDs or HDDs - set to smallest of pair
#These must be Equal or smaller than the disk size available in that tier SSD and HDD
#SSD:cache  -    HDD:data
#set to $null to calculate the max size, not always working... better to manually specify a size
#set to $null the tier you dont want to extend, to extend both populate both with the apropriate value
$SSDTierSize = 508GB
$HDDTierSize = 7.22TB
#Drives cannot always be fully allocated - probably broken for drives < 10GB
#Dont change this
$UsableSpace = 0.99
#Set tier Resilency setting
$SSDTierResiliency = "Simple"
$HDDTierResiliency = "Simple"

#Calculate tier sizes within this storage pool
#Can override by setting sizes at top
if ($SSDTierSize -eq $null){
    $SSDTierSize = (Get-StorageTierSupportedSize -FriendlyName $SSDTierName -ResiliencySettingName $SSDTierResiliency).TierSizeMax
    $SSDTierSize = [int64]($SSDTierSize * $UsableSpace)
if ($HDDTierSize -eq $null){
    $HDDTierSize = (Get-StorageTierSupportedSize -FriendlyName $HDDTierName -ResiliencySettingName $HDDTierResiliency).TierSizeMax
    $HDDTierSize = [int64]($HDDTierSize * $UsableSpace)
Write-Output "TierSizes: ( $SSDTierSize , $HDDTierSize )"

$HDDTierSizeBytes = $HDDTierSize / 1GB
$HDDTierSizeGB = "$HDDTierSizeBytes" + "GB"
$SSDTierSizeBytes = $SSDTierSize / 1GB
$SSDTierSizeGB = "$SSDTierSizeBytes" + "GB"

#Extend two tiers in the Storage Pool created. One for SSD disks and one for HDD disks
Write-Output "Extend $SSDTierName by:"
Resize-StorageTier -FriendlyName $SSDTierName -size $SSDTierSize
Write-Output "Extend $HDDTierName by:"
Resize-StorageTier -FriendlyName $HDDTierName -size $HDDTierSize
Write-Output "Operation complete"

No comments:

Post a Comment

Removing tiered storage spaces - Windows Server 2022

As part of the work I have done in my homelab with tiered storage on Server 2022 storage spaces , here is a script I created that allows you...