Rescue mode is a special boot environment that lets you access your VPS when it will not start normally. Instead of booting from your server's disk, rescue mode boots a minimal operating system from a separate image, giving you access to your server's file system for repair and data recovery.
This guide explains when to use rescue mode, how to activate it, and common tasks you can perform while in rescue mode.
What Is Rescue Mode?
Rescue mode boots your VPS into a lightweight, temporary operating system — typically a minimal Linux distribution. Your server's regular disk is not used as the boot drive but is still accessible as a mounted (or mountable) volume. This allows you to:
- Access and edit files on your server's disk when the server will not boot.
- Fix corrupted configuration files that prevent normal startup.
- Repair broken boot loaders or file system issues.
- Recover data from a non-booting server.
- Reset a root password that you have forgotten.
- Diagnose disk and file system errors.
When to Use Rescue Mode
Consider using rescue mode when:
- Your server will not boot — The server is stuck during startup due to a misconfiguration, corrupted file, or broken update.
- You are locked out — You changed the SSH configuration, firewall rules, or root password and can no longer log in.
- File system errors — The disk has corruption that prevents normal operation.
- Boot loader issues — The boot loader (GRUB) is misconfigured or corrupted.
- Data recovery — You need to retrieve files from a server that cannot start normally.
- Pre-reinstallation data salvage — You want to copy data off the disk before reinstalling the OS.
Step 1 — Activate Rescue Mode
Your server will reboot into the rescue environment. The dashboard will display:
- Temporary root password for the rescue system (note this down).
- Instructions for connecting.
Step 2 — Connect to the Rescue System
Once rescue mode is active, connect via SSH using the temporary credentials:
ssh [email protected]Enter the temporary root password provided by the dashboard. You are now logged into the rescue environment, not your regular server OS.
Alternatively, use the web console in your Data Mammoth dashboard.
Step 3 — Access Your Server's Disk
In rescue mode, your server's regular disk is not mounted automatically. You need to mount it to access your files.
Identify the Disk
List available disks and partitions:
lsblkYour server's primary disk is typically /dev/sda or /dev/vda. The main partition is usually /dev/sda1 or /dev/vda1.
Mount the Disk
Create a mount point and mount the partition:
mkdir /mnt/server
mount /dev/sda1 /mnt/serverYour server's files are now accessible under /mnt/server. The root directory of your regular OS is at /mnt/server/, so for example:
- Your server's
/etcdirectory is at/mnt/server/etc/ - Your server's
/homedirectory is at/mnt/server/home/ - Your server's
/var/wwwdirectory is at/mnt/server/var/www/
Common Rescue Mode Tasks
Fix SSH Configuration
If you accidentally broke your SSH configuration and cannot log in:
nano /mnt/server/etc/ssh/sshd_configReset Root Password
If you forgot the root password:
chroot /mnt/serverpasswd rootexitFix Firewall Rules
If firewall rules locked you out:
/mnt/server/etc/iptables/rules.v4
- For nftables: /mnt/server/etc/nftables.conf
- For ufw: /mnt/server/etc/ufw/user.rules
Recover Data
If you need to copy files off a non-booting server:
scp -r /mnt/server/var/www/ user@your-local-machine:/backup/tar -czf /tmp/backup.tar.gz -C /mnt/server home var/www etc/tmp/backup.tar.gz via SCP.Check and Repair File Systems
If you suspect disk corruption:
fsck /dev/sda1Step 4 — Exit Rescue Mode
After completing your repairs or data recovery:
umount /mnt/serverYour server will reboot from its regular disk with the changes you made. If everything was fixed correctly, the server should start normally.
Troubleshooting Rescue Mode
Cannot Mount the Disk
- Double-check the device name with
lsblk. It might be/dev/vda1instead of/dev/sda1. - If the disk uses LVM, you may need to activate the volume group first:
vgchange -ay- If the file system is corrupted, run
fsckbefore mounting.
Changes Do Not Take Effect After Rebooting
- Ensure you edited files on the mounted disk (
/mnt/server/...), not on the rescue system's own file system. - Verify the disk was properly unmounted before rebooting.
- Make sure rescue mode is disabled before rebooting, otherwise the server boots into rescue mode again.
Server Still Will Not Boot After Repairs
If the server remains unbootable after your repair attempts:
- Consider restoring from a snapshot. See How to Create and Restore VPS Snapshots.
- If no snapshot is available, use rescue mode to recover data, then reinstall the OS. See How to Reinstall Your VPS Operating System.
- Contact Data Mammoth support for assistance.
What to Do Next
- How to Create and Restore VPS Snapshots — Always have a snapshot before things go wrong.
- How to Reinstall Your VPS Operating System — Start fresh if repairs are not possible.
- Troubleshooting — Server Not Responding — Diagnose other common server issues.
- Troubleshooting — Cannot Connect via SSH — Fix SSH connection problems without rescue mode.