• 8 September 2024

Cloud servers may be out of reach due to all the advantages they have over older, physical systems for a variety of reasons, including file system failure, boot loader malfunction or setup, forgetting password, and more.

A rescue disk can be used to solve these problems. In this method, the instance is run by a Liveboot software and you will have access to its files. This way, you can easily mount your instance drive and transfer data to another instance or reset your password.

Use the Finnix rescue disk

In this method, there is a need to use a rescue disk to access the data of the original instance disk. For this purpose, you must enter go to IaaS section and then the instances in ArvanCloud user panel, and select the Rescue mode option in operations of the desired instance.

Then you will be asked to confirm the change of instance mode to Rescue mode. After confirmation, wait for your instance to be in Rescue mode.

Finnix is ​​a Debian-based rescue disk that offers a variety of features such as mounting and modifying drives, partitioning, restoring boot records, and a rescue system.

 After booting, you will see the following screen. Select Live (amd64) option to continue.

At this point, the rescue disk is successfully loaded by displaying a page similar to the one below.

Reset password for Root or user

Reseting the Root password or a specific user with Finnix is ​​very easy and fast. To do this, first mount your main disk using the following command. Note that you must consider the main operating system partition for these commands.

To identify the main partition of instance, use the command lsblk or fdisk -l and depending on their size, select the partition with the largest volume as the main partition. In this example, the main partition is vda2.

mount / dev / vda2 / mnt

Then change the password using the following command.

 chroot /mnt passwd

The system will then ask you for a new password. After the change, you can exit the rescue disk and return to your operating system environment.

File system repair

If your file system is corrupted, you can easily repair and restore it using the following commands:

 fsck -y / dev / vda2

Back up files and databases

 If you want to back up your data, you can easily do this with the following commands:

First mount the file system.

mount / dev / vda2 / mnt
cd / mnt

You can now transfer your files to another cloud by going to the desired directory, using the rsync or scp tools.

For example, the file path for the mysql database would be like this:

/ mnt / var / lib / mysql

SSH Access

 If you want to use Rescue Disk by SSH Remote, you can use it by setting a password and activating the SSH service. Of course, Rescue mode should be used temporarily and only activated to fix the issues. Using this mode for service is not recommended at all.

Set a password for the root user with the passwd command, and the next command will enable the SSH service.

passwd
service ssh start