I got asked a couple of days about why an esxi server was taking roughly 45 mins to come back up after a reboot. Looking at the node when it eventually came back up showed that it had a number of RDM’s that were associated to virtual machines. Those virtual machines were mostly Windows RDM’s  used for MSCS. What was happening is that when esxi was booting it could see all theses luns and was trying to read the header, it was that delay in its attempts to read the header that was causing the 5 min boot time.

What was needed was to reserve those luns so that they were ignored on the boot scan. Using the powercli below we can define the target cluster, scan through the virtual machines within an identify all the raw devices and mark then as reserved.  It will then do this on each nodes in the cluster which reduced your boot time from say 45mins to a few minutes (depending on your hardware)

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$TargetCluster = "Cluster Name"

$VMhosts = Get-Cluster $TargetCluster| Get-VMHost

$RDMDisks = Get-VM -Location $TargetCluster | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select ScsiCanonicalName

foreach($VMhost in $VMhosts) {
Write-Host "Connected To Server : " $VMhost
$esxcli = Get-ESXCLI -VMHost $VMhost
foreach($RDMDisk in $RDMDisks) {
Write-Host "Setting Perennially Reserved On : " $RDMDisk
$esxcli.storage.core.device.setconfig($false, ($RDMDisk.ScsiCanonicalName), $true)
}
}