vSphere 6.5: Additional considerations when migrating to VMFS-6 – Part 1

For those who use the Virtual Machine File System (VMFS) datastores, one of the steps when upgrading to vSphere 6.5 is to migrate them to VMFS-6.

VMFS6-01

VMware provides a detailed overview of VMFS-6 on the StorageHub, as well as an example of how the migration from VMFS-5 can be automated using PowerCLI.

However, there are three edge cases that require extra steps to continue with the migration. They are as follows:

All those objects, if they exist, prevent the ESXi host from unmounting the datastore, and they need to be moved to a new location before migration continues. The required steps to relocate them will be reviewed in the paragraphs below.

Relocating the system swap

The system swap location can be checked and set via vSphere Client in Configure > System > System Swap settings of the ESXi host.

VMFS6-02

Alternatively, the system swap settings can be retrieved via PowerCLI:

# File name: Get-VMHostSystemSwapLocation.ps1
# Description: This script provides information about the system swap location for ESXi hosts.
#
# 08/10/2018 - Version 1.0
# - Initial Release (based on https://code.vmware.com/forums/2530/vsphere-powercli#534332)
#
# Author: Roman Dronov (c)
# Get information about the system swap location for ESXi hosts
Write-Host "`nSystem swap location:`r" -ForegroundColor Green
ForEach ($vmhost in $(Get-VMHost | sort Name)) {
$esxcli2 = Get-EsxCli -VMHost $vmhost -V2
$esxcli2.sched.swap.system.get.Invoke() | Select `
@{N='Host Name';E={$vmhost.Name}}, `
@{N='Datastore Name';E={$_.DatastoreName}}, `
@{N='Datastore Active';E={(Get-Culture).TextInfo.ToTitleCase($_.DatastoreActive)}}, `
@{N='Datastore Enabled';E={(Get-Culture).TextInfo.ToTitleCase($_.DatastoreEnabled)}}
}
Clear-Variable vmhost,esxcli2 -Scope Global

The script above can be modified to create the system swap files on a new datastore:

# File name: New-VMHostSystemSwapLocation.ps1
# Description: This script creates a system swap file for the ESXi host on a desired datastore.
#
# 08/10/2018 - Version 1.0
# - Initial Release (based on https://code.vmware.com/forums/2530/vsphere-powercli#534332)
#
# Author: Roman Dronov (c)
# Get the host name and check it is valid
$vmhosts = Get-VMHost | ? {$_.ConnectionState -eq "Connected" -or $_.ConnectionState -eq "Maintenance"} | ForEach-Object {$_.Name.Split('.')[0]}
$vmhost = Read-Host -Prompt "`n Please type in the ESXi host name"
while ($vmhosts.Contains($vmhost) -ne "True") {
Write-Host "`n Checking the host exists..." -NoNewline
Write-Host " The host is not reachable." -ForegroundColor Yellow
$vmhost = Read-Host -Prompt "`n Please type in the host name correctly"
}
# Get the datastore name and check it is valid
$datastores = $(Get-Datastore | ? {$_.State -eq "Available"}).Name
$datastore = Read-Host -Prompt "`nPlease type in the datastore name"
while ($datastores.Contains($datastore) -ne "True") {
Write-Host "`n Checking the datastore exists..." -NoNewline
Write-Host " The datastore is not reachable." -ForegroundColor Yellow
$datastore = Read-Host -Prompt "`nPlease type in the datastore name correctly"
}
# Check the host has access to the datastore
$vmhost = $vmhost + "*"
$vmhost = $(Get-VMHost | ? {$_.Name -like "$vmhost"}).Name
$lookup = $(Get-VMHost | ? {$_.Name -like $vmhost} | Get-Datastore).Name
if ($lookup.Contains($datastore) -ne "True") {
Write-Host "`n The datastore is not reachable by the host." -ForegroundColor Yellow
}
else {
# Create the system swap file on the provided datastore
$esxcli2 = Get-EsxCli -VMHost $vmhost -V2
$arguments = $esxcli2.sched.swap.system.set.CreateArgs()
$arguments.datastorename = $datastore
$arguments.datastoreenabled = "true"
$esxcli2.sched.swap.system.set.Invoke($arguments) | Out-Null
# Print out the results
Write-Host "`nSystem swap location:`r" -ForegroundColor Green
$esxcli2.sched.swap.system.get.Invoke() | Select `
@{N='Host Name';E={$vmhost}}, `
@{N='Datastore Name';E={$_.DatastoreName}}, `
@{N='Active';E={(Get-Culture).TextInfo.ToTitleCase($_.DatastoreActive)}}, `
@{N='Enabled';E={(Get-Culture).TextInfo.ToTitleCase($_.DatastoreEnabled)}}
}
Clear-Variable vmhost,vmhosts,datastore,datastores,esxcli2,arguments -Scope Global | Out-Null

Note: The host reboot is not required to apply this change.

Moving the persistent scratch location

A persistent scratch location helps when investigating the host failures. It preserves the host log files on a shared datastore. So they can be reachable for troubleshooting, even if the host experienced the Purple Screen of Death (PSOD) or went down.

To identify the persistent scratch location, filter the key column by the ‘scratch’ word in Settings > System > Advanced System Settings of the ESXi host in vSphere Client.

VMFS6-03

You only need to point the ScratchConfig.ConfiguredScratchLocation setting to a new location and reboot the host for this change to take effect.

Note: Before doing any changes, make sure that the .locker folder (should be unique for each configured host to avoid data mixing or overwrites) has been created on the desired datastore. Otherwise, the persistent scratch location remains the same.

To review and modify advanced host parameters including the persistent scratch location via PowerCLI, look for two cmdlets named Get-AdvancedSetting and Set-AdvancedSetting. This procedure is well-documented in KB 1033696.

An information about how to automate the diagnostic coredump file relocation will be covered in Part 2 or this series later on. Keep you posted!

2 thoughts on “vSphere 6.5: Additional considerations when migrating to VMFS-6 – Part 1

  1. Thanks for sharing this post.

    Are you facing any difficulty in “update-vmfsdatastore” cmdlet???

    It is throwing memory exception error “failed to allocate managed memory buffer ” I will share few screenshots very soon.

    Like

    • Hi Jatin,

      Thank you for your fedback.

      I’ve decided to not use Update-VMFSDatastore cmdlet during the migration. Mostly due to the requirement to have a spare VMFS-6 datastore to perform Storage vMotion.

      Cheers

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s