Home » IT - Microsoft » Configure RDMs On ESXi Hosts

Configure RDMs On ESXi Hosts

Escribe tu dirección de correo electrónico para suscribirte a este blog, y recibir notificaciones de nuevos mensajes por correo.

Join 5 other followers

May 2016
« Mar   Jun »



All messages posted to this blog are provided "AS IS" with no warranties, and confer no rights. The content of this site are personal opinions and might not represent the Microsoft Corporation view. Regarding any sample code that we provide: This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. This blog serves 2 purposes. Firstly, I want to share information with other IT pros about the technologies we work with and how to solve problems we often face. Secondly, I use my blog as a notebook. There's so much to learn and remember in our jobs that it's impossible to keep up. By blogging, I have a notebook that I can access from anywhere. Anything you do to your IT infrastructure, applications, services, computer or anything else is 100% down to your own responsibility and liability. Mcselles bears no responsibility or liability for anything you do. Please independently confirm anything you read on this blog before doing whatever you decide to do.

Due to a locking problem, booting ESXi hosts takes a lot of time when MSCS are running on LUNs. Since ESXi 5 this can be solved by setting an extra option on the LUNs called perennially reserved. This setting is local to each ESXi host and should be set on each host accessing the RDM. Now if you have a lot of RDMs, or a lot of hosts in your cluster that might take some work, so… powershell!

Note that this has been rewritten here, which was especially done for Site Recovery Manager.

# This script performs the following steps
# 1. Get all RDM information from your environment, listing VM, Cluster and diskinfo
# 2. Export this information to a csv file
# 3. Filters out RDMs that are not part of MSCS 
# 4. Set the IsPerenniallyReserved for each RDM on each host in the cluster to true
# Note: This scrip can be run each time a RDM or a host is added.
  # Script variables
$timestamp = Get-Date -format "yyyyMMdd-HH.mm"
$startdir = "D:\sjoerd"
$csvfile = "$startdir\rdmsettings-$timestamp.csv"
  # Scipt functions
# Note that you can suppress output from commands using | Out-Null
Function logger ($message) {Write-Host -ForegroundColor Green (Get-Date -format "yyyyMMdd-HH.mm.ss") "$message" `n}
Function loggeralert ($message) {Write-Host -ForegroundColor Red (Get-Date -format "yyyyMMdd-HH.mm.ss") "$message" `n}
  # Define csv table
$myTable = @()
  logger "Starting to create a csv file. This might take a while."
  foreach ($vm in (Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual")){
  $RDMInfo = "" |select-Object VMName,VMClusterName,DiskType,ScsiCanonicalName   $RDMInfo.VMName = $vm.Parent
   $RDMInfo.VMClusterName = Get-VM $vm.Parent | Get-Cluster
   $RDMInfo.DiskType = $vm.DiskType
   $RDMInfo.ScsiCanonicalName = $vm.ScsiCanonicalName   $myTable += $RDMInfo
  $myTable |Export-csv -NoTypeInformation $csvfile
  logger "Finished creating csv file. Now filtering out RDMs that are not part of MSCS."
  $allrdms = Import-Csv $csvfile
#Only get duplicates RDMs, these are part of MSCS 
$duprdms = Import-Csv $csvfile | Group-Object ScsiCanonicalName -noElement | where {$_.count -gt 1}   logger "Starting to set the Perennially Reserved option on:"
  ForEach ($rdm in $duprdms){
   $cluster = ($allrdms | where {$_.ScsiCanonicalName -eq $rdm.Name} | select VMClusterName | Select -First 1).VMClusterName
   $rdmdisk = $rdm.Name
   ForEach ($esxihost in (Get-Cluster $cluster | Get-VMHost)){
   Write-Host "ESXihost = $esxihost `t RDM = $rdmdisk"
  #To set the esxcli instance, run this command:
   $myesxcli = get-esxcli -VMHost $esxihost
   #To verify the parameter updates, run this command:
   #To set the device as perennially reserved, run this command:
   $myesxcli.storage.core.device.setconfig($false, "$rdmdisk", $true)


Source: http://www.getshifting.com/wiki/rdmsettings


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

Microsoft on the Issues

News and perspectives on legal, public policy and citizenship topics

Mike Crowley's Whiteboard

“There are no limits to what you can accomplish when you are supposed to be doing something else."


There Be Dragons

Ken Cenerelli

My life in software development

VMware, Windows, Virtualization (Servers & Desktops)

VMware, Windows, Virtualization (Servers & Desktops)

Just a random "Microsoft Server / Client Tech" info..

"Feeding Your Training and Technology Obsessions"


WordPress.com is the best place for your personal blog or business site.


Documentación técnica, notas y apuntes sobre Administración de Sistemas, Servidores, Redes y más

Microsoft Taste

Mary's Blog

%d bloggers like this: