Thick provisioned disks on vSAN

Thick provisioned disks on vSAN

We migrated a bunch of thick provisioned VMs from a SAN to a new vSAN. But after migration I saw the the disks weren’t thin provisoned as stated in the storage policy.

To get these disks “thin provisioned” we needed to assign a temporarily policy with thin provisioned enabled. After switching to the temp profile we can switch back to the storage profile we want, and everything is working as expected.

We needed to adjust nearly a 100 VMs, so time for a script 🙂

connect-viserver vcenter.tarantino.local

#Put the VMs that needs adjusting in a variable
$veem = Get-cluster VMCL01 |Get-VM | where{Get-HardDisk -VM $_| where{$_.StorageFormat -eq 'Thick'}} |Select Name

#Get the storagepolicies 
$tempstoragepolicy = Get-SpbmStoragePolicy  "Temp Stretched cluster"

$newstoragepolicy = Get-SpbmStoragePolicy  "Stretched cluster PA"


#loop through al the VMs and adjust the storagepolicy. I added a start-sleep for 15sec to give vSAN some time to adjust to the new storage policy
foreach ($VM in $veem)
{
$vm = Get-VM -Name $VM.Name
$harddisk = $vm | get-harddisk

$vmconfig = $vm, $harddisk |Get-SpbmEntityConfiguration
$vmconfig | Set-SpbmEntityConfiguration -StoragePolicy $tempstoragepolicy

Start-Sleep -Seconds 15
$vmconfig | Set-SpbmEntityConfiguration -StoragePolicy $newstoragepolicy
}

Comments are closed.