How to Recover Your iRexta Server Using Rescue Mode (Advanced CLI Guide)

Perform surgical system repairs, reinstall GRUB, and recover access using pure SSH commands.

Why Use Rescue Mode?

When standard access methods fail due to OS configuration errors or boot issues, Rescue Mode is your bridge back to control. It boots your server into a temporary operating system running purely on RAM. This allows you to bypass the installed OS and perform critical repairs from the "outside." In this guide, we will cover the advanced CLI workflow: identifying hidden partitions, performing "Bind Mounts" for full system access, and using Chroot to repair even the most complex boot failures.

Prerequisites: Before You Start

Ensure you have prepared the environment via your iRexta Panel:

  • Activate Rescue/Netboot: Select a Linux Rescue image (e.g., Debian/Ubuntu 64-bit).
  • Reboot the Server: Wait for the email or screen notification containing your temporary root password.
  • Login via SSH: Connect using ssh root@your-server-ip.

Step 1: Identify Your Disk (The "lsblk" Method)

In Rescue Mode, your data disk is unmounted and "sleeping." We need to identify its name exactly.

lsblk

Analyze the output:
Ignore the small RAM loop partitions. Look for the largest partition that matches your server's storage capacity.

Example: If you have a 1TB drive, look for a partition near ~900GB. Common names are /dev/sda2, /dev/vda2, or /dev/md2 (for Software RAID).

Step 2: Mount Your Partitions

Create a directory and mount your main system partition.

mkdir -p /mnt/system
mount /dev/md2 /mnt/system
# Replace /dev/md2 with your actual disk name found in Step 1

Step 3: The "Bind Mounts" (Critical for Updates/GRUB) ⚠️

This is the step most tutorials miss. If you only mount the disk, advanced commands like `grub-install` or `apt update` will fail because they cannot see the system hardware.

You must link the Rescue System's device nodes to your mounted disk:

mount --bind /dev /mnt/system/dev
mount --bind /proc /mnt/system/proc
mount --bind /sys /mnt/system/sys

Step 4: Enter the System (Chroot)

Now that the environment is fully prepared, enter your server's OS.

chroot /mnt/system

Success! Your terminal prompt should change. You are now "inside" your original server as the root user.

Step 5: Perform Repairs

With full system access, you can fix almost any issue:

  • Reset Root Password:
    passwd
  • Fix Bootloader (GRUB):
    Important: Replace /dev/sda with the actual disk name you identified in Step 1 (e.g., /dev/vda or /dev/nvme0n1). Do not install to a partition number (like sda1).

    # Install GRUB to the main disk (Not partition!)
    grub-install /dev/sda
    update-grub
  • Fix SSH Config:
    nano /etc/ssh/sshd_config
  • Check Firewall:
    ufw disable

Step 6: The Clean Exit

Do not just reboot! You must safely unmount the file systems to prevent data corruption.

# 1. Exit the Chroot environment
exit
# 2. Unmount everything safely (Recursive unmount)
umount -R /mnt/system
# 3. Reboot the server
reboot

Finally, return to your iRexta Dashboard and switch the Netboot setting back to "Hard Disk" to boot into your repaired OS.

Conclusion

Rescue Mode is a powerful tool for the Bare Metal administrator. By understanding how to properly mount partitions and bind system directories, you can resolve complex issues that would otherwise require a server reinstall.

At iRexta, we provide the infrastructure, but this knowledge gives you the ultimate control over your environment.