Archive for the ‘VMWare things’ Category

PostHeaderIcon Rescanning your storage in an ESX cluster

Nothing is more annoying then having to rescan your VMFS filesystems or HBA’s in ESX3. Going from node to node and click all the time. If you have one or two nodes this is do-able, but i’m maintaining multiple clusters with a grand total of 30 nodes..

However VMWare created PowerCLI, perhaps the most powerfull piece of management software VMWare has released to date. With PowerCLI you can automate the most annoying of jobs with ease.

Here is a little script to let all your nodes scan their HBA’s and VMFS filesystems.
You can add an host as argument to the script (FQDN), to let it run the commands at the host only.

connect-viserver your.virtualcenter.box

if ($args -eq $null)
{
get-vmhost | foreach-object
{
get-vmhoststorage -VMHost $_.name -RescanAllHba -RescanVmfs
}
}
else
{
get-vmhoststorage -VMHost $args -RescanAllHba -RescanVmfs
}

*UPDATE* changed the script, see comments for more info.

Search