Friday 13 August 2021

Windows VM Stuck after Restart

Hello all, 

for this time round, i would like to share some fix i have done due to windows VM is not accessible after applying July update . So when the restart was performed, the VM is not responding to RDP and CPU usage is 0.02% from the Azure Portal for few hours. Turn out some error happen on booting up  the vm and you can see if VM screen like screenshot below if the boot diagnostic is enable


The method of solving this kind of behavior is either restoring from backup of continue work on the affected VM . I will explain more on the solution provided by microsoft support. 

As usual, the solution will need a temporary VM as fixer and the step as follow 

1. Create a Disk Snapshot of affected VM ; name it VM01-snapshot or ss

2. Create a manage disk using VM01-snapshot ; name it VM01-OSdisk-01

3. Create a temporary VM with Hyper V enable ; i name it as HyperV

4. Attach VM01-OSdisk-01 as a data disk to HyperV VM 

5. Do a RDP to HyperV vm and open Command Prompt 

6. Run "dism /image:G:\ /cleanup-image /revertpendingactions" ; change letter G according to  os disk of VM01

7. Once the process completed, go to disk management and "offline" the VM01 Os disk 

8. Create a VM in Hyper V; name TestVM, choose Gen1 because most azure vm is Gen1 and during the disk selection, choose attach the disk later.

9. After the TestVM created, right click and go to setting, On IDE click add hard disk and choose physical drive. This will work as Hyper V support pass through disk in normal hyper v deployment which means it will use physical disk instead of virtual hard disk

    


10. Set a good number for cpu and memory and try to boot the VM. 

11. As the vm is boot successfully and the TestVm can be power off, remove from TestVM setting and remove from HyperV vm data disk in azure portal.

12. Perform  "Swap OS disk" operation with source vm in Azure portal. 

Hope this will help somebody out there , leave a feedback in the comment and  stay safe


No comments:

Kubecost on AKS Part 02