Automate VMFS6 Upgrade – Update-VMfsdatastore cmdlet

By now you must be switching onto vSphere 6.5. During this time you would have also figured it out that there is no online upgrade for VMFS5 to VMFS6, which means that there is a little bit of planning would require to upgrade your VMFS datastores to VMFS6 version.

As of now, the most common approach (and I believe the only approach) is to-

  • Create a temporary VMFS5 datastore
  • Migrate VM, files, and folder from source datastore to temporary datastore
  • Unmount source datastore and delete the source datastore
  • Re-create a new VMFS6 datastore with the same LUN
  • Move back all the VMs and its folder to new VMFS6 datastore

A lot of manual pieces of work right! if its a matter of 5-10 datastore then there should not be any problem in upgrading datastores manually. However, almost all enterprise infrastructures work with hundreds or even thousands of datastores and you certainly need an automated way to do the upgrade.

Update-VMfsdatastore 

PowerCLI has introduced this cmdlet with PowerCLI 6.5, and all the steps which I explained to you earlier are done by this cmdlet.

The “Script”

$dslist = Get-Content J:\PSScripts\VMFS6\ds.txt
$credential= Get-Credential
$vc= Read-Host "Enter vCenter Name"
$tempDs= Read-Host "Specify Temp Datastore Name"

Connect-VIServer -Server $vc -Credential $credential

Foreach ($ds in $dslist)
{
  $datastore=Get-Datastore-Name $ds
  $tempdatastore=Get-Datastore-Name $tempds
  Update-VmfsDatastore-server $Global:defaultVIserver-Datastore $datastore-TemporaryDatastore $tempdatastore-Confirm:$false-Verbose
}

Disconnect-VIServer

The above script is just a snippet from my actual production script, You can modify this to suit your environment and need.

Key Take Aways

    • There should be an update required from VMware to allow users to define max number of VMs to storage vMotion at a time. This will eventually speed up the upgrade process. As of now update-vmfsdatastore migrates one VM at a time.
  • During my tests in POC, It was observed that upgrade was failing on datastores which had vmkdump files stored on it, skip any datastore which has vmkdump files, You can skip those datastores by doing something like this-
if((Get-ChildItem $datastore.DatastoreBrowserPath).Name -contains 'vmkdump')
{
  Write-Host"skipping this $ds"
}
else
{
  Update-VmfsDatastore-server $Global:defaultVIserver-Datastore $datastore-TemporaryDatastore $tempdatastore-Confirm:$false-Verbose
}
  • After migrating all active or registered VMs from the source datastore, if swap files or delta.vmdk (snapshots of a virtual disk) files are found, the datastore will not be upgraded.

Visit PowerCLI reference to know more about this cmdlet and its usage.

Hope you have enjoyed this post. Would love to hear back your feedback, challenges and use case regarding VMFS6 upgrade.

Thanks,

Leave a Reply