Recently we had issues with NFS storage. NFS storage was disconnecting intermediately from ESXi host and until we fix Storage issue on NetApp, many VMs status become “inaccessible” or “invalid”
Also some VMs were running fine but VMs disk size changed to 0 MB. We could access these VMs using Remote desktop and see the correct disk size in Guest OS. But vCenter was showing disk size as 0 MB for all Disk of affected VM.
How to reconnect invalid or inaccessible VMs?
Manual way -
But in my case due to storage issues many more VMs were affected.
How to fix it using PowerCLI -
#Connect vCenter server
Connect-viserver vlab-vc01.vprhlabs.com
#Find all invalid and inaccessible VMs in vCenter and reload it.
(Get-View -ViewType VirtualMachine) |?{$_.Runtime.ConnectionState -eq "invalid" -or $_.Runtime.ConnectionState -eq "inaccessible"} |%{$_.reload()}
Above script will also fix VMs 0 MB disk issue.
To fix 0MB disk size VMs manually, you can migrate VMs from one Host to another and during upgrade process VM will reregister on new node and update disk details.
for single VM, you can do this also.
>Get-VM vlabVM2k8 | Get-View | %{$_.reload()}
Thanks,
vPRH
Also some VMs were running fine but VMs disk size changed to 0 MB. We could access these VMs using Remote desktop and see the correct disk size in Guest OS. But vCenter was showing disk size as 0 MB for all Disk of affected VM.
How to reconnect invalid or inaccessible VMs?
Manual way -
- Remove invalid or inaccessible VM from vcenter inventory.
- Browse datastore where VM was stored and go to VM folder.
- Find the VMs .vmx file and add it to inventory.
But in my case due to storage issues many more VMs were affected.
How to fix it using PowerCLI -
#Connect vCenter server
Connect-viserver vlab-vc01.vprhlabs.com
#Find all invalid and inaccessible VMs in vCenter and reload it.
(Get-View -ViewType VirtualMachine) |?{$_.Runtime.ConnectionState -eq "invalid" -or $_.Runtime.ConnectionState -eq "inaccessible"} |%{$_.reload()}
Above script will also fix VMs 0 MB disk issue.
To fix 0MB disk size VMs manually, you can migrate VMs from one Host to another and during upgrade process VM will reregister on new node and update disk details.
for single VM, you can do this also.
>Get-VM vlabVM2k8 | Get-View | %{$_.reload()}
Thanks,
vPRH
No comments:
Post a Comment