Rescuing virtual machines
If a VM experiences boot problems, you can send it to the rescue mode to access its boot volume. When a VM in the “Active” state is sent to the rescue mode, it is shut down softly first. Once the VM is in the rescue mode, you can connect to it via SSH or via the console. Its previous boot disk is now attached as a secondary one. You can mount the disk and repair it.
Limitations
- The rescue mode can use ISO images for booting both Linux and Wndows virtual machines and QCOW2 images (templates) for booting Linux VMs. For instructions on making templates, refer to Preparing templates.
- You can send a VM to the rescue mode only if its current status is “Active” or “Shut down”.
- There are only three actions available for the VM in the rescue mode: Console, Exit rescue mode, and Delete.
- If a rescue image has cloud-init installed, then the VM booted from it can be accessed with the same SSH key that was used for its creation.
Prerequisites
- Virtual machines are created, as described in Creating virtual machines.
To put a virtual machine to the rescue mode
Admin panel
- On the Compute > Virtual machines > Virtual machines tab, click the required VM on the list.
- On the VM right pane, click the ellipsis button on the toolbar. Then, click Enter rescue mode.
-
In the Enter rescue mode window, select an image to rescue the VM with. By default, the initial image used for creating the VM is selected. Click Enter.
The machine status changes to “Rescue”.
To return a virtual machine to normal operation
Admin panel
- On the Compute > Virtual machines > Virtual machines tab, click the required VM on the list.
- On the VM right pane, click Exit rescue mode.
- In the Exit rescue mode window, click Exit. The VM will be automatically rebooted.
The VM status changes to “Active” and it boots from the original root disk.
If the VM status changes to “Error” when exiting the rescue mode, you can reset its status with the Reset state action. The VM should then return to the “Rescue” status again.
To exit the rescue mode for a Windows VM
There might be an issue of exiting the rescue mode for a Windows VM. If in the rescue mode you set the original system disk online, its ID becomes the same as that of the rescue disk. Then, when you try to exit the rescue mode, the boot loader cannot find the proper boot disk. To resolve the ID conflict, follow the steps:
-
With the VM in the rescue mode, open the Disk Management window and note the numbers of the original system disk (offline) and the rescue disk (online). Set the original system disk to Online.
-
To edit the boot configuration, enter the following command in the Command Prompt window:
> bcdedit /store <the original system disk name>:\boot\bcd
-
Review the output and check that the rescue disk is the target for objects in the output (
partition=<the rescue disk name>
).If the objects do not point to drive C, fix it with the following commands:
> bcdedit /store <the original system disk name>:\boot\bcd \ /set {default} osdevice partition=<the rescue disk name>: > bcdedit /store <the original system disk name>:\boot\bcd \ /set {default} device partition=<the rescue disk name>: > bcdedit /store <the original system disk name>:\boot\bcd \ /set {bootmgr} device partition=<the rescue disk name>: > bcdedit /store <the original system disk name>:\boot\bcd \ /set {memdiag} device partition=<the rescue disk name>:
-
To view the available disks, enter the following commands in the command line:
> DISKPART > LIST DISK
Match the disk number and name to those displayed in the Disk Management window.
-
To get the ID of the rescue disk, run the following commands:
> SELECT DISK <the rescue disk number> > UNIQUEID DISK
Record the disk ID, you will need it later.
-
Change this ID by using the following command:
> UNIQUEID DISK id=<any hex value of 8 characters>
Make sure that the value has changed with the
UNIQUEID DISK
command. -
Assign the ID that you recorded previusly to the original system disk:
> SELECT DISK <the original system disk number> > UNIQUEID DISK id=<the recorded disk ID>
Make sure that the value has changed with the
UNIQUEID DISK
command.
You should now be able to exit the rescue mode.