--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools



Would you like to sponsor this site?
Or buy me a beer?:

Recently Changed Pages:

View All Pages
View All Q Pages

View All Tags

Sign up for Q to post comments.

WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.

Terms And Conditions for Q users

Pages with comments

2019/06/22 10:36 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 3 Comments
2017/04/20 15:28 1 Comment
2017/04/20 15:23 1 Comment
2017/04/19 14:44 1 Comment
2017/04/17 20:10 1 Comment
2017/04/17 20:07 1 Comment
2017/04/17 19:58 1 Comment
2017/04/17 19:52 1 Comment

View All Comments


Configure RDMs On ESXi Hosts

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 ""
$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 "") "$message" `n}
Function loggeralert ($message) {Write-Host -ForegroundColor Red (Get-Date -format "") "$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:
   $$false, "$rdmdisk", $true)


You could leave a comment if you were logged in.
rdmsettings.txt · Last modified: 2013/07/01 21:54 by sjoerd