Mount How do I get to the data on my server?

Run the following commands to mount the drive(s): (this example applies to the dedicated servers): Warning!Older servers still using IDE drivers or those without software RAID must use /dev/hda2 instead of /dev/md2. Virtual servers and dedicated servers without software RAID but with SATD drives must use /dev/sda3 or/dev/hda3 (/dev/sda2 or /dev/hda2 with older installations).

cd /mnt
mkdir rescue
mount -o ro /dev/md2 /mnt/rescue

or

mount -o ro /dev/sda3 /mnt/rescue

The drive is now mounted in “read only” mode. If you wish to write to the drive, it must be mounted as follows:

mount /dev/md2 /mnt

or

mount /dev/sda3 /mnt

If you want to do something more than just getting to your data, like changing the kernel or something similar, additional (virtual) filesystems should be mounted:

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

or shorter (with a script):

chroot-prepare /mnt/rescue

Now it is possible to enter the installed system with:

chroot /mnt/rescue /bin/bash

How do I run a file system check?

If you are seeing error messages in the syslog or you simply suspect there are problems with the file system you can check it. This should be done when the partitions are not mounted, otherwise it can lead to data loss.
To start a filesystem check run the following command (EQ server example):

fsck -C0 /dev/md2

The -C0 option displays a progress bar. For every error found you will be asked whether it should be repaired or not. If all errors should be corrected automatically, the -y option can be used:

fsck -C0 -y /dev/md2

To be on the safe side the fsck can be run with the explicit file system type instead of autodection, e.g.:

fsck.ext3 /dev/md2
fsck.ext2 /dev/md2
...

Note: If fsck stops with the message “exited signal 11”, it may help to use the fsck version of the installed system, and not that of the Rescue System. To do that the root partition must be mounted and all files required for fsck have to be copied into a directory of the Rescue System. Do not forget to unmount the partition with “umount” before running the filesystem check!

The fsck versions for the different filesystems must be called explicitly inside the new directory. Otherwise the version of the Rescue System will be run.

./fsck.ext3 /dev/md2

How do I re-install my server from the Rescue System?

Hetzner offes a comfortable, menu driven script called installimage. For further information please refer to:Installing Operating Systems using ‘installimage’

How do I copy images of the partitions of my server encrypted to another server?

This short tutorial describes how partitions can by copied as image to another server with the Rescue System,sshfs and partimage.

To mount a foreign directory on a server using ssh, you need to install sshfs in the rescue system and load the “fuse” module.

apt-get update
apt-get install sshfs
modprobe fuse

Now a directory from a remote server can be mounted encrypted.

sshfs  username@remote.host:/directory/on/remote/server/  /mnt

Another way to secure the partitions is by using partimage, which is already preinstalled on the Rescue System:

partimage

The program partimage is not very complicated and most things should be straightforward. At the top choose the partition to be saved and in the middle type in the name of the image file and its path.

Alternatives to sshfs are NFS or SMB/CIFS mounts. Since neither of them are very common on a public Linux server, sshfs is usually the best choice, plus it is encrypted.

Instead of using partimage to copy single partitions, the whole drive can be copied using dd. However, dd copies blockwise. If it encounters an error, the program terminates (should this be the case, you can use “dd_rescue”). You should also be very careful to use the right device names for “if=” and “of=”, otherwise you might accidently erase all your data. The main disadvantage of dd is that it (unnecessarily) also copies empty parts of the drive.

I forgot my root password. What do I do now?

With the help of the Rescue System you can set a new root password.

First mount the installed system:

cd /mnt
mkdir rescue
mount /dev/md2 /mnt/rescue

If you have a VQ server with a standard installation you need to use /dev/hda3 or /dev/sda3.

Then change root into the system:

chroot /mnt/rescue

and run:

passwd

where you can enter a new root password. After typing “exit” you can reboot the server.

How do I mount a software RAID in the Rescue System?

The command:

cat /proc/mdstat

shows all available software RAID arrays. Normally the Rescue System assembles all autodected arrays. Should your array not be automatically started you can manually do so with the following command:

mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1

Now you can mount the recently created MD device with:

mount /dev/md0 /mnt

Other Rescue Systems

In addition to the Linux-based Rescue System, there are also rescue systems for the following operating systems:

Leave a comment