How to mount your recently slaved drive: (linux)

If your server has recently been re-installed with a new hard drive and your old drive has been slaved so you can recover data, here is how to mount your old drive and access your files.

NOTE: You will need to be logged in as root via a ssh shell to your server.

fdisk -l 

Running fdisk -l will output all physical hard drives connected to your server.
You're looking for names such as /dev/sda  and /dev/sdb

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes

Disk /dev/sdb: 500.1 GB, 500107862016 bytes

You can verify which drive is already mounted by typing the following command.


You should see one or more /dev/sdax partitions mounted currently.

/dev/sda3 on / type ext3 (rw,errors=remount-ro)

Using these two commands make note of your old drive (which wont show up under mount yet)
and make note of the largest linux partition that is partitioned as type 83 (ext3 filesystem.)

In the following example fdisk -l will output the partitions from your old drive (sdb)

 Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    60000255    29999104   83  Linux
/dev/sdb2        60002304    71999487     5998592   82  Linux swap / Solaris
/dev/sdb3        72001536   976773119   452385792   83  Linux

You don't need the boot partition (noted by the boot flag) or your swap partition (virtual ram).

/dev/sdb3 is your linux filesystem that you want to mount to recover your files.

To mount your drive issue the following commands: 

NOTE: (make sure to use the corresponding drive name in the following commands  /dev/sdax or /dev/sdbx  where x is the partition of your linux filesystem from the old drive)

First make a directory to mount the drive into.

mkdir /mnt/olddrive

Then mount the old drive into that directory.

mount /dev/sdb3 /mnt/olddrive

Provided their were no errors output your old drive is now mounted and you can browse to that directory and begin copying files as necessary.

cd /mnt/olddrive

To un-mount the old drive issue the following commands.

cd /

umount /dev/sdb3

Note: If you reboot your server, the old drive will not be mounted automatically and you will have to mount it again using this process. Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)