Server recovery
    • PDF

    Server recovery

    • PDF

    Article Summary

    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.

    You can enter Single mode and recover the server as follows:

    1. Select a server to boot from the server list, and then click the [Force stop] button.
      server-ts-repair-vpc-01_en
    2. Click [Start] to boot the stopped server, and click the [Server connection console] button.
      server-ts-repair-vpc-02_en
    3. 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:

    1. Enter e in the Select Kernel version page to enter the Edit booting parameter page.
      server-ts-repair-vpc-03
    2. Edit the parameter as follows, press [Ctrl] + [x], and start the OS with the edited booting parameter.
      • Edit ro into rw init=/sysroot/bin/bash.
      • Delete rhgb quiet.
        server-ts-repair-vpc-04
    3. Enter single mode.
      server-ts-repair-vpc-05
    4. 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:

    1. Enter e in the Select Kernel version page to enter the Edit booting parameter page.
      server-ts-repair-vpc-06
    2. Edit the parameter as follows, press [Ctrl] + [x], and start the OS with the edited booting parameter.
      • Edit ro into rw single init=/bin/bash.
        server-ts-repair-vpc-07
    3. Enter single mode.
      server-ts-repair-vpc-08

    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).

    1. 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)
      
    2. 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)
      
    3. 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)
      
    4. 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.

    1. Run the following commands to check the current kernel settings.
      root@ubuntu:~# cat /etc/default/grub | grep GRUB_DEFAULT
      GRUB_DEFAULT=0
      
    2. 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)
      
    3. 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
      
    4. 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.

    1. Create a snapshot.

    2. 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.
    3. Connect to the path to mount the storage and recover the data.


    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.