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.
Requirements
- Getting Started with SSH
- General Knowledge of Terminal
Topics
Booting in Rescue Mode
Log in to the OVHcloud Control Panel 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.
When you are finished working in Rescue Mode, return to the OVHcloud Control Panel 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
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 its 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
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
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.
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.