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

The original article was posted on: www.ruudharreman.nl

Related articles

  • Cloud Native
  • Application Navigator
  • Kubernetes Platform
  • Digital Workspace
  • Cloud Infrastructure
  • ITTS (IT Transformation Services)
  • Managed Security Operations
  • Multi-Cloud Platform
  • Backup & Disaster Recovery
Visit our knowledge hub
Visit our knowledge hub
Ruud Harreman Virtualization Consultant

Let's talk!

Knowledge is key for our existence. This knowledge we use for disruptive innovation and changing organizations. Are you ready for change?

"*" indicates required fields

First name*
Last name*