Rescue Mode allows you to check the health of your Dedicated Server's hardware and connect to it via SSH to perform different troubleshooting tasks; a few of which are as follows:
- Launch an
fsck/e2fsck
- Access the file system
- Fix misconfigurations
- Backup data
- Check hardware devices
This article will walk you through the basics of using Rescue Mode.
Prerequisites
- Getting Started with SSH
- General Knowledge of Terminal
Topics
- Booting in Rescue Mode
- Mounting the Partition
- chroot and Changing Your Password
- Performing a Hardware Check
Booting in Rescue Mode
Log in to the OVHcloud Manager and select Bare Metal Cloud on the left-hand sidebar. Click Dedicated and virtual servers and choose the Dedicated servers option. Select your server on the ensuing page.
On the "Server status" page, click ... next to "Boot" and select Edit from the drop-down menu. On the ensuing screen, select the Boot in rescue mode option and then select rescue64-pro from the "Rescue available" drop-down menu.
After changing the boot setting, navigate to the "Service status" box and click the ... button next to "Status". Select Restart from the drop-down menu.
The server is now in Rescue Mode. Next, you will receive an email that contains new credentials to access the server via SSH. The email will also contain a link to a web interface from which you can perform various hardware tests. For more information about this, please check out the Performing a Hardware Check section of this article.
Note: If you do not see the email within five minutes of rebooting your server, please check your Spam folder.
When you are finished working in Rescue Mode, return to the OVHcloud Manager in your browser, change the "Boot" option back to "Boot from the hard disk" and then restart your server.
Mounting the Partition
To SSH into your server use the login credentials that were received via email. For more information regarding SSH, please check out our Getting Started with SSH article.
Once connected, locate the storage device for your Dedicated server, then mount it to the Rescue Mode environment.
Examples of the standard naming convention for different storage are:
/dev/sdX
for SCSI and SATA devices/dev/nvmeXnX
for NVMe devices/dev/mdX
for RAID devices
Note: Please keep in mind that by default the storage for the Dedicated server is configured to use RAID 1 (mirroring), so the device address will be: /dev/mdX.
Additionally, if during the installation of the operating system you opted out of using RAID, then the device address (e.g. /dev/sdX) and the partition will need to be mounted.
To view the storage devices that your server has, use the parted
utility. Below is an example of the command and it's output:
$ parted -l
Sample Output:
Model: ATA HGST HUS724020AL (scsi) Disk /dev/sda: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 537MB 536MB fat32 primary boot, esp 2 537MB 1073MB 536MB ext4 primary raid 3 1073MB 2000GB 1999GB ext4 primary raid 4 2000GB 2000GB 536MB linux-swap(v1) primary Model: ATA HGST HUS724020AL (scsi) Disk /dev/sdb: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 537MB 536MB fat32 primary boot, esp 2 537MB 1073MB 536MB ext4 primary raid 3 1073MB 2000GB 1999GB ext4 primary raid 4 2000GB 2000GB 536MB linux-swap(v1) primary Model: Linux Software RAID Array (md) Disk /dev/md2: 536MB Sector size (logical/physical): 512B/512B Partition Table: loop Disk Flags: Number Start End Size File system Flags 1 0.00B 536MB 536MB ext4 Model: Linux Software RAID Array (md) Disk /dev/md3: 1999GB Sector size (logical/physical): 512B/512B Partition Table: loop Disk Flags: Number Start End Size File system Flags 1 0.00B 1999GB 1999GB ext4
Example: As per the output, the server is equipped with two SCSI disks (/dev/sda & /dev/sdb) in a software RAID configuration (/dev/md3). All are highlighted in red in the sample output above.
After identifying the storage device, create a root directory within the /mnt
directory, then use the mount
command to add it to the Rescue Mode environment:
# mkdir /mnt/root
# mount /dev/mdX /mnt/root
Lastly, navigate to the newly mounted device:
# cd /mnt/root
You now have access to the entire file system.
chroot and Changing Your Password
Although you can edit the files in the /mnt/root
directory, certain commands require root privileges on the system that is installed on the disk. Thus, change the apparent root directory to the directory in which we stored our files using the following command:
# chroot /mnt/root
You can now run commands on your mounted filesystem.
Now, we are able to change the root password using the following command:
# passwd root
Note: In this example, we are changing the password for the user root. If you wish to change a password for a different user, replace "root" in the command above with the username whose password you wish to change.
If you wish to change the password for a different user just append the username to the end of the above command and it will change the password for that user. If you don't specify a user, as we did above, you are changing the root password by default.
Performing a Hardware Check
Once the server goes into Rescue Mode you will receive an email with a link to the hardware web interface and login credentials. Here is an overview of this interface:
- Hard Drives: Checking the disks installed on your server
- Processors: CPU verification. It is possible that the server restarts or stops responding. If this occurs, contact us as soon as possible.
- Partitions State: Verifying partition integrity
- File System Partitions: Checking the file system. Often inconsistencies indicate a corrupt file system. Note that reinstall the operating system usually corrects the problem.
- Explore Partitions: Exploring files. This tool does not allow the modification of the files. The main utility is to consult the logs without having to go through SSH.
- Memory: Checking the RAM. Please note that this test will monopolize the CPU. If this test freezes or reboots the server it is possible that your CPU is defective. If the RAM is defective, the report at the end of the test will contain errors.
Warning: If you have to replace the motherboard on your server, your NIC(s) will also be replaced. In order to use the new NICs, you will need to add their MAC addresses into the configuration files in your OS.
This interface can't specifically detect the cause of the problem. However, it can give you an indication of whether or not there is a problem. If one or more hardware tests fail or show errors, contact support right away. For more information on opening a support ticket, please check out our How to Contact OVH US Support article.
Warning: Do not interact with the server through the web interface (detailed below) and SSH at the same time. For example, never check the disks on the web interface while mounting the partitions via SSH. This may result in the loss of data.
Conclusion
Rescue Mode is an important tool that can be used to perform maintenance on your own schedule or to reverse critical errors made during normal server administration. Having read this article, you should have a basic familiarity with how to get started using Rescue Mode with a Dedicated server.