- Print
- PDF
Server recovery
- Print
- PDF
Available in VPC
This document describes how to recover a server that does not boot properly.
Enter Single Mode
For any of the following situations, enter Single mode and recover the server.
- Lost admin password
- Problem occurred in Using fstab
You can enter Single mode and recover the server as follows:
- Select a server to boot from the server list, and then click the [Force stop] button.
- Click [Start] to boot the stopped server, and click the [Server connection console] button.
- Check how to enter Single mode for each OS to perform the server recovery procedures.
Enter CentOS Single Mode
You can enter single mode in CentOS and recover the server as follows:
- Enter
e
in the Select Kernel version page to enter the Edit booting parameter page.
- Edit the parameter as follows, press [Ctrl] + [x], and start the OS with the edited booting parameter.
- Edit
ro
intorw init=/sysroot/bin/bash
. - Delete
rhgb quiet
.
- Edit
- Enter single mode.
- Run the following commands and mount the partition region of the server.
:/# chroot /sysroot
Enter Ubuntu Single Mode
You can enter single mode in Ubuntu and recover the server as follows:
- Enter
e
in the Select Kernel version page to enter the Edit booting parameter page.
- Edit the parameter as follows, press [Ctrl] + [x], and start the OS with the edited booting parameter.
- Edit
ro
intorw single init=/bin/bash
.
- Edit
- Enter single mode.
Change the boot kernel
You can change the boot kernel for each OS and recover the server as follows:
Change the CentOS boot kernel
The following describes how to change the boot kernel in CentOS. In this section, it is described with the example of changing the boot kernel into CentOS Linux (3.10.0-1127.19.1.el7.x86_64) 7 (Core)
.
- Run the following commands to check the current kernel settings.
[root@centos ~]# grub2-editenv list saved_entry=CentOS Linux (3.10.0-1127.el7.x86_64) 7 (Core)
- Run the following command to check the kernel list.
[root@centos ~]# grep ^menuentry /boot/grub2/grub.cfg | cut -d "'" -f2 CentOS Linux (3.10.0-1127.19.1.el7.x86_64) 7 (Core) CentOS Linux (3.10.0-1127.el7.x86_64) 7 (Core) CentOS Linux (0-rescue-4bfdd392cea14cb58d22427c1c69c5df) 7 (Core)
- Change the default boot kernel settings, run the following command, and check the changed kernel settings.
[root@centos ~]# grub2-set-default "CentOS Linux (3.10.0-1127.19.1.el7.x86_64) 7 (Core)" [root@centos ~]# grub2-editenv list saved_entry=CentOS Linux (3.10.0-1127.19.1.el7.x86_64) 7 (Core)
- Reboot the server, run the following command, and check the kernel.
[root@centos ~]# reboot [root@centos ~]# uname -r 3.10.0-1127.19.1.el7.x86_64
Change the Ubuntu boot kernel
The following describes how to change the boot kernel in Ubuntu. In this section, it is described with the example of changing the boot kernel into 4.15.0-118-generic
.
- Run the following commands to check the current kernel settings.
root@ubuntu:~# cat /etc/default/grub | grep GRUB_DEFAULT GRUB_DEFAULT=0
- Run the following command to check the kernel list.
root@ubuntu:~# awk -F"--class" '/menuentry/ && /with Linux/ {print $1}' /boot/grub/grub.cfg | awk '{print i++ " : " $5,$6,$7,$8}' | sed -e "s/'/ /g" 0 : 4.15.0-118-generic 1 : 4.15.0-118-generic (recovery mode) 2 : 4.15.0-76-generic 3 : 4.15.0-76-generic (recovery mode)
- Change the default boot kernel settings, run the following command, and check the changed kernel settings.
root@ubuntu:~# vi /etc/default/grub root@ubuntu:~# grub-set-default 0 Searching for GRUB installation directory ... found: /boot/grub root@ubuntu:~# grub-editenv list saved_entry=0 root@ubuntu:~# update-grub Sourcing file `/etc/default/grub' Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.15.0-118-generic Found initrd image: /boot/initrd.img-4.15.0-118-generic Found linux image: /boot/vmlinuz-4.15.0-76-generic Found initrd image: /boot/initrd.img-4.15.0-76-generic Found linux image: /boot/vmlinuz-4.15.0-22-generic Found initrd image: /boot/initrd.img-4.15.0-22-generic done
- Reboot the server, run the following command, and check the kernel.
root@ubuntu:~# reboot root@ubuntu:~# uname -r 4.15.0-118-generic
How to recover data through snapshot when the server cannot be recovered
If the server cannot be recovered by entering Single mode or changing boot kernel, you can recover stored data by creating a new storage in the server you want using a created snapshot.
The following describes how to recover the data using the snapshot.
Create a snapshot.
- See Create snapshot
Create a storage using snapshot and mount it in the server.
Note- Since the storage data is read and recovered from the snapshot, skip the disk partition and storage format tasks.
- If a snapshot was created from another server's default storage for booting or from one of the existing storages of a server with added storage, the identifiers of the original server's storage and the created storage will overlap, making mounting impossible.
- See Change storage identifier and change the created storage's identifier.
Connect to the path to mount the storage and recover the data.