3

I had a 2-drive RAID-1 array running on ubuntu, which I had forgotten about. The host I was running them on is now dead, leaving me with these two disks. How can I get data off of them? If I dump them- using dd or the such- how can I read that data in a useful format?

alicht
  • 33
  • 3
  • `mdadm` has no problem with reading from and creating a device for an array from a different host. Have you scanned and/or checked `/proc/mdstat`? – Shane Madden Jul 04 '12 at 01:44

2 Answers2

2

With RAID1 you can simply mount the drive as if it were a single drive.

So put the drive in another computer and for instance if the drive was at /dev/sdb run mount /dev/sdb1 /mnt/ You may have to specify the file system. So mount -t ext4 /dev/sdb1 /mnt/ for instance if the old volume was ext4.

3dinfluence
  • 12,449
  • 2
  • 28
  • 41
2

mdadm stores all the array data on the disks themselves and is highly portable between the same or newer versions. Assuming the mirroring was up-to-date, you can even read the data off a single disk via e.g. a USB adapter. (Of course, having backups would reduce the need to do any of this).

All of these steps could be done from a running system but a LiveCD etc. will work just about as well:

  1. Attach the drives to the system you want to use to recover the data
  2. Find the partition/disk info with dmesg output, sudo fdisk -l etc.
  3. Find the mdadm metadata from the disks (use your own disk values here):

    $ sudo mdadm --examine /dev/sda1
    $ sudo mdadm --examine /dev/sdb1
    

    The "Preferred Minor" value will tell you which array (e.g. /dev/md0) the disks were part of.

  4. Assemble the array:

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

    If everything is OK, you'll get a message like "md0 started with 2 devices"; check /proc/mdstat to be certain.

  5. If the array had a partition table, use fdisk -l to find it and mount the correct partition (kpartx can be useful here); otherwise, simply mount /dev/md0 /mnt/temp as appropriate

Mounting a single disk may or may not "just work" as 3dinfluence said, depending on the mdadm metadata location; to be sure, you can assemble with a single member using

$ mdadm --assemble /dev/md0 /dev/sda1 --run.
Andrew
  • 8,002
  • 3
  • 36
  • 44