Search code examples
linuxmounthard-drive

Access data from a drive without mounting


Recently my hard drive on my dedicated server crashed and the hosting company had to replace the drive. however I had a backup hard drive that was taking daily backups.

Now I have a new drive and a fresh OS installed. the backup hard drive is attached to the server but I am not sure how to access the drive and restore the backup files.

would mounting the drive remove all the current data on it? if yes then whats the best way to restore the data from the hard drive? (also I dont have physical access to the drive)


Solution

    1. you need to know what was filesystem used on backup drive (mounting will not erase any files unless you use wrong filetype declaration)

    2. you need to know the name of the backup device (for example: /dev/sdaX)

    3. now as a root on your fresh system create a mountpoint (a directory) - usually you should put it in /mnt, for example /mnt/backup

    4. do mount -t [filesystem on backup drive] [backup device] [mountpoint] for example:

      mount -t ext4 /dev/sda5 /mnt/backup

    5. if everything is fine all your backup is available in /mnt/backup and you can do whatever you want with it

    See: http://linux.die.net/man/8/mount http://www.linfo.org/mount_point.html