Select Category
Sitemap Help Contact
print article

Mount a Partition in the Linux Rescue System

For Linux Dedicated and Dynamic Cloud Server packages.

Learn how to mount your hard drive partitions when using the Linux Rescue System, so you can make changes to configuration files on your hard drive, or back up your data.

If you have a Linux VPS, you can use the Linux VPS Repair Mode instead.

When your server boots normally, your partitions are mounted automatically during startup so you have access to those files. When booting a server using the Rescue System however, the partitions are not mounted automatically. This article may be used as a genereal guide for mounting partitions, if you are not already familiar.

Step 1
Please Boot the Server Using the Linux Rescue System and then connect to the server using SSH. If network access to your server has been disabled for some reason, you will then have to connect using Serial Console Access for Dedicated Servers or VNC Console if you have a Dynamic Cloud Server.

You will also need to log in to the Rescue System as the root user. Use the randomly generated password that was provided to you in the 1&1 Control Panel when setting your system to boot into the Linux Rescue System.

Step 2
Once you are logged in to the Rescue System, type fdisk -l to list the current partition tables. In this example, the system is set up using software RAID 1 using two drives - sda and sdb. As you can see below, each of the two drives have the same partitions and then are linked together through Multiple Device Drivers and shown as md1, md5 and md6.
rescue~# fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x38993954

Device    Boot      Start         End    Sectors    Size  Id  System
/dev/sda1            2048     8390655    8388608      4G  fd  Linux raid autodetect
/dev/sda2         8390656    12584959    4194304      2G  82  Linux swap / Solaris
/dev/sda3        12584960  1940940208  144552870  925.5G  fd  Linux raid autodetect


Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x9fabc3f6

Device    Boot      Start         End    Sectors    Size  Id  System
/dev/sdb1            2048     8390655    8388608      4G  fd  Linux raid autodetect
/dev/sdb2         8390656    12584959    4194304      2G  82  Linux swap / Solaris
/dev/sdb3        12584960  1940940208  144552870  925.5G  fd  Linux raid autodetect

Disk /dev/md3: 925.5 GiB, 993761296384 bytes, 1940940032 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/md1: 4 GiB, 4294901760 bytes, 8388480 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/vg00-usr: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/vg00-var: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/vg00-home: 5 GiB, 5368709120 bytes, 10485760 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes

rescue:~# 125849591940940208    Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        1217     9775521   83  Linux
/dev/sda2            1218        1461     1959930   82  Linux swap / Solaris
/dev/sda4            1462       91201   720836550    5  Extended
/dev/sda5            1462        2678     9775521   83  Linux
/dev/sda6            2679       91201   711060966   83  Linux
rescue:~#
Step 3
Type the mount command and press ENTER to view the already mounted devices. You should not see any /dev/md[], /dev/sd[] or /dev/hd[] devices listed as they are not automatically mounted by the Rescue System.
rescue:~# mount
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
tmpfs on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,qid=5,mode=620)
rescue:~#
Step 4
We will now mount the hard drive's root parition to the /mnt folder of the Rescue System.

For software RAID, type mount /dev/md1 /mnt to mount the root md partition to the /mnt folder.
rescue:~# mount /dev/md1 /mnt

For hardware RAID, type mount /dev/sda1 /mnt to mount the root sda1 partition to the /mnt folder.
rescue:~# mount /dev/sda1 /mnt
Step 5
Type the mount command again to verify that it has mounted correctly.
rescue:~# mount
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
tmpfs on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,qid=5,mode=620)
/dev/md1 on /mnt type ext3 (rw)
rescue:~#
Step 6
Type cat /mnt/etc/fstab to output the file to the screen. This is the /etc/fstab file on your hard drive that specifies which folder each partition should be mounted to. Because we are in the Rescue System and the hard drive's root partition is mounted to /mnt we reference the file as /mnt/etc/fstab.

Each /dev/md[] device will show the correct mount folder directly after. As you can see from the file, the /dev/md1 parition should be mounted to the / folder (root folder). Since we are using the Rescue System, we can not mount /dev/md1 to the / folder as the Rescue System is using the / folder. Therefore, we mounted /dev/md1 to the /mnt folder on the Rescue System and the /mnt/ folder will now essentially be the root folder for the contents of your hard drive.
rescue:~# cat /mnt/etc/fstab
/dev/md1        /               ext3    defaults                   1 1
/dev/sda2       none            swap    sw
/dev/sdb2       none            swap    sw
/dev/vg00/usr   /usr            ext4    defaults,noatime           0 2
/dev/vg00/var   /var            ext4    defaults,usrquota,noatime  0 2
/dev/vg00/home  /home           ext4    defaults,usrquota,noatime  0 2
devpts          /dev/pts        devpts  gid=5,mode=620             0 0
none            /proc           proc    defaults                   0 0
none            /tmp            tmpfs   defaults                   00
rescue:~#

For hardware RAID, the output will be similar to the image below instead.
rescue:~# cat /mnt/etc/fstab
/dev/sda1       /               ext3    defaults,usrquota        1 1
/dev/sda2       none            swap    sw
/dev/sda5       /usr            xfs     defaults                 0 2
/dev/sda6       /var            xfs     defaults,usrquota        0 2
devpts          /dev/pts        devpts  gid=5,mode=620           0 0
none            /proc           proc    defaults                 0 0
none            /tmp            tmpfs   size=1g                  0 0
rescue:~#
Step 7
Next we will mount the other devices to the correct folders ensuring that each is preceded with /mnt as this is where we mounted the root partition of the hard drive. Use the image below for reference.

rescue:~# mount /dev/vg00/usr /mnt/usr
rescue:~# mount /dev/vg00/var /mnt/var
rescue:~# mount /dev/vg00/home /mnt/home
rescue:~#

For hardware RAID, use the image below for reference instead.

rescue:~# mount /dev/sda5 /mnt/usr
rescue:~# mount /dev/sda6 /mnt/var
rescue:~#
Step 8
You should now be able to change directories to the /mnt folder and view the entire contents of your hard drive(s)!
rescue:~# cd /mnt
rescue:~# ls
bin   home            lib64       opt   sbin     tmp      vmlinuz.old
boot  initrd.img      lost+found  proc  selinux  usr
dev   initrd.img.old  media       root  srv      var
etc   lib             mnt         run   sys      vmlinuz