VPS down : Booting from hard disk… MBR

If your VPS is down and has become inaccessible, whether by http, ftp, ssh, ping and you have the following message on the OVH KVM console:

Booting from hard disk...

That means that the boot management, ie the MBR (master boot record) is corrupt, broken. It must be repaired by reinstalling GRUB, updating it and changing the order of the partitions. To do this it will first restart the server in rescue mode, mount the partition in which the system is located.

root@rescue-pro:~# mount --bind /dev /mnt/sdb1/dev &&
mount --bind /dev/pts /mnt/sdb1/dev/pts &&
mount --bind /proc /mnt/sdb1/proc &&
mount --bind /sys /mnt/sdb1/sys

Then do a chroot:

root@rescue-pro:/# chroot /mnt/sdb1/

Install GRUB:

root@rescue-pro:/# apt-get install grub

Install GRUB in the wanted partition:

root@rescue-pro:~# grub-install /dev/sdb
Searching for GRUB installation directory ... found: /boot/grub
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(hd0)   /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0
(hd1)   /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1

Update GRUB:

root@rescue-pro:/# update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...
Generating /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-3.2.0-4-amd64
Updating /boot/grub/menu.lst ... done

After the reboot (normal), we have the following message in the KVM:

root (hd1,0)
Error 21: selected disk does not exist

In fact, there is an error in /boot/grub/menu.lst. Just do :

root@rescue-pro:~# e

To edit, then again:

root@rescue-pro:~# e

To edit the corresponding line in the menu.lst file. And replace:

root (hd1,0)


root (hd0,0)

Touch the Enter key, and:

root@rescue-pro:~# b

To boot on the partition. And now the VPS will normally reboot on the good partition.

The complete guide: Booting from hard drive – MBR – OVH.


Leave a Reply

Notify of