OVH Rescue Mode Backup Data & MySql Database

This is a tutorial of how to use OVH rescue mode to recover the files and MySql data.

If you get accidentally locked out of your VPS and cannot access Port 80 (HTTP) or Port 22 (SSH), OVH rescue mode helps you recover the files and mysql data

OVH is one of my favourite VPS providers. For a paltry sum of $3.49 per month, OVH offers a VPS which has the following specifications:

• OpenStack KVM
• 1 vCore
• 2.4 GHz
• 2 GB RAM
• 10 GB SSD
• Local RAID 10

(See also Cheap VPS | 5 Best Budget Hosts To Trust)

The VPS is fast and responsive.

The price is also cheap. A VPS from Linode with 2 GB RAM costs $10 per month though it offers 30 GB of storage as against the paltry 10 GB of storage offered by OVH.

OVH’s SSD 2 VPS offers 20GB SSD with 4GB RAM for $6.99 per month which is still less than that charged by Linode.

Problem: Port 80 blocked

I had the unpleasant experience when during an upgrade process, the ports 22 and 80 and all the other ports of my OVH VPS were blocked.

The result was that my VPS was not accessible at all. The web pages were not opening nor was I able to access the VPS through SSH using putty.

The VPS was, however, responding to pings which showed that it was powered on.

A check at yougetsignal revealed that all the ports were closed.

I tried rebooting the VPS multiple types but it did not help.

OVH Rescue Mode

The OVH control panel offers the option to boot the VPS in rescue mode.

ovh vps rescue mode mysql

ovh vps rescue mode

The VPS vps354… will reboot in rescue mode (estimated time 3 minutes).

Rescue mode

Some actions are not available in rescue mode. To restore functions, you must restore the local boot by clicking “Restart your VPS”

After a few minutes, you will receive an email containing the following information:

1801 ave. McGill College | Suite 800
Montréal (Québec) H3A 2N4

Dear Customer,

Your VPS has booted into rescue mode, meaning that a Linux OS has been launched on your VPS. The reboot is not related to your system, which is correctly installed:

– Your VPS’s tree structure has mounted into ‘/mnt’.

You can log in to your VPS (51.254……..) via SSH with the following parameters:

– username: root
– password: 210JVd8o

You can now carry out the necessary maintenance to restore your VPS. For example, you can:

– check and, if required, deactivate your firewall
– perform a backup or data recovery
– check and update your network configuration files
– etc.

If you think that you have identified the cause of the problem and wish to reboot your VPS normally, you must configure the netboot of your VPS on the hard disk (normal mode).

You will find additional information in our guide:

Now, log into the VPS using the username and password set out in the email.

Find the path where the files are kept. Obviously, it will be the partition where the most space is occupied.

 df –h 
login as: root
root@51.254.....'s password:
root@rescue-pro:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       4.7G  1.3G  3.2G  29% /
udev             10M     0   10M   0% /dev
tmpfs           393M  5.3M  388M   2% /run
tmpfs           982M     0  982M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           982M     0  982M   0% /sys/fs/cgroup
/dev/sdb1       9.8G  8.0G  1.3G  87% /mnt/sdb1

Navigate to the partition you want:

cd /mnt/sdb1

See all the files in it


In Centminmod, the website files are in the /home folder

(In Easyengine, they are in the /var/www folder)

Once you spot the files you want, take a backup with the command

tar -cpzf backup_30032017.tar.gz *

This command will make a tar file of all the contents in the folder.

MySql backup

Normally, to take a backup of the Mysql data, one uses the command

mysqldump --all-databases -uuser -ppassword >database30032017.sql

However, this command will not work in the rescue mode because the mysql service is not working and is not accessible.

Fortunately, we have access to the raw mysql database files (more details are available at

Go to the /var/lib/mysql folder. Here, you will find all the database files bearing the names of the respective databases.

Take a backup of these files with the command

tar -cpzf mysql-backup-30032017.tar.gz *


tar -cvzf mysql-backup-30032017.tar.gz var/lib/mysql

Now, we have to bear in mind that because Centminmod and Easyengine use MariaDB as the MySQL engine, a normal MySQL should be avoided because there will be errors due to some incompatibilities of the two mysql engines.

So, set up another VPS with Centminmod.

In the rescue mode, wget will not work. So we have to use SCP (Secure copy).

Go to the new VPS and pull in the backup of the files and mysql data from the VPS in rescue mode using the command

scp root@ IP-address-of-rescued-VPS:/mnt/sdb1/home/nginx/domains/name-of-backupfile-.tar.gz

Unzip the website files in the required location (/home/nginx/domains/) with the command:

tar -xzf backup-30032017.tar.gz

With regard to the mysql backup data files, go to the /var/lib/mysql folder and deposit the files in that folder.

All the files in the /var/lib/mysql folder must be owned by MySql

This is achieved by executing the following command when inside the folder:

 chown mysql:mysql –R * 


 chown -R mysql:mysql /var/lib/mysql/ 

If you have set up the new VPS with the same password as that in the rescued one, there is no problem. Otherwise change the root password using the command:

mysql -u root -p
use mysql;
update user set password=PASSWORD('your_new_password') where User='root';
flush privileges;

With this, the website files and mysql data is restored to the same condition in which it before you got locked out.

P.S: When you get access to the rescued VPS, try disabling the CSF, IP Tables (if Centos 6) or FirewallD (if Centos 7). Also try manually opening ports 80, 22 etc. If this works, all the trouble to take a backup and move to another VPS etc can be avoided.

DON’T MISS! Free VPS | Selection Of Best Offers In Linux & Windows

How to change root password in rescue mode?

OVH has a nice video tutorial on how to change the root password when one is in rescue mode.

The steps outlined by OVH are the following:

Changing a password when it is lost

Step 1: Identify the mount point

The mount is created automatically on any VPS in the 2016 range, so you just need to identify where your partition is mounted. To do this, you can use two commands:

 df -h

The output to the command is as follows:

 root@rescue-pro:~# df -h
Size Used Avail Use% Mounted on
/dev/vda1 4.7G 1.3G 3.2G 29% /
udev 10M 0 10M 0% /dev
tmpfs 774M 8.4M 766M 2% /run
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/vdb1 20G 934M 18G 5% /mnt/vdb1

Then, enter the command:


The output to the command is as follows:

 root@rescue-pro:~# lsblk
vda 254:0 0 4.9G 0 disk
└─vda1 254:1 0 4.9G 0 part /
vdb 254:16 0 20G 0 disk
└─vdb1 254:17 0 20G 0 part /mnt/vdb1

The output shows that the system partition is mounted on /mnt/vdb1.

Step 2: CHROOT permissions

You now need to edit the root directory, for the changes to be applied to your system. You can do this by using the chroot command. Please enter the following command:

 root@rescue-pro:~# chroot /mnt/vdb1/

You can check by typing the ls -l command, which will list the content stored in the root directory of your system:

 root@rescue-pro:/# ls -l 

Step 3: change the root password

Now, you just need to change the root password with the passwd command:

Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Finally, reboot your VPS on its drive via your OVH Control Panel.

Leave a Reply

Your email address will not be published. Required fields are marked *