LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Recovering mdadm superblocks (http://www.linuxquestions.org/questions/linux-general-1/recovering-mdadm-superblocks-713234/)

deck- 03-20-2009 04:34 PM

Recovering mdadm superblocks
 
Hello everyone

I have a raid5 mdadm array which has four drives. My new motherboard has inexplicably cleared three of the super blocks, and I am now left with only one intact superblock.

fdisk -l

Code:

Disk /dev/sda: 20.4 GB, 20490559488 bytes
255 heads, 63 sectors/track, 2491 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x03930393

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        1982    15920383+  83  Linux
/dev/sda2            1983        2491    4088542+  82  Linux swap / Solaris

Disk /dev/sdb: 1000.2 GB, 1000203804160 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000


Disk /dev/sdc: 1000.2 GB, 1000203804160 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000


Disk /dev/sdd: 1000.2 GB, 1000203804160 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000


Disk /dev/sde: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000


Disk /dev/sdf: 1044 MB, 1044250624 bytes
33 heads, 32 sectors/track, 1931 cylinders
Units = cylinders of 1056 * 512 = 540672 bytes
Disk identifier: 0x9348a58e

mdadm --examine /dev/sdb

Code:

mdadm: No md superblock detected on /dev/sdb
mdadm --examine /dev/sdc

Code:

mdadm: No md superblock detected on /dev/sdc
mdadm --examine /dev/sdd

Code:

mdadm: No md superblock detected on /dev/sdd

mdadm --examine /dev/sde

Code:

/dev/sde:
          Magic : a92b4efc
        Version : 00.90.00
          UUID : f781ba39:3975fa64:c36d41f1:ea056919
  Creation Time : Mon Jan  5 14:18:27 2009
    Raid Level : raid5
  Used Dev Size : 976762496 (931.51 GiB 1000.20 GB)
    Array Size : 2930287488 (2794.54 GiB 3000.61 GB)
  Raid Devices : 4
  Total Devices : 4
Preferred Minor : 0

    Update Time : Thu Mar 19 22:39:52 2009
          State : clean
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0
      Checksum : 54f44664 - correct
        Events : 0.92

        Layout : left-symmetric
    Chunk Size : 64K

      Number  Major  Minor  RaidDevice State
this    3      8      32        3      active sync  /dev/sdc

  0    0      8      16        0      active sync  /dev/sdb
  1    1      8      64        1      active sync  /dev/sde
  2    2      8      48        2      active sync  /dev/sdd
  3    3      8      32        3      active sync  /dev/sdc



I have now moved the raid array back to the original file server, but the superblocks are still missing. I am able to assemble the array with only the one drive, but obviously the array cannot be started. I am also unsure about the order of the drives connected to the old server and I am worried that the drives are no longer connected in the same physical order that they originally were.

I am hoping someone with more knowledge than myself can answer a few question:

1. Can this raid array be restored? I am confident that none of the actual data has been impacted, I have only lost my superblocks...


2. If I try to recreate the raid array using mdadm --create --assume-clean and the order of the devices is not the same as the original configuration, will mdadm erase the data on the drives?


3. If I were to buy four more identical drives to the ones that comprise the raid array, dd everything to the new drives, would I be able to test recreating the array on the new drives?


4. Is there anyway to recover data from a mdadm raid array without successfully recreating the array? I am sure the data is still there, I just can't construct the array.


thanks in advance for any advice on how to proceed with this problem.

mostlyharmless 03-30-2009 04:08 PM

(1) Looks like this fellow succeeded in fixing this with the -create option, so it's possible
http://episteme.arstechnica.com/eve/...m/697004072931
(2) I think so.
(3) I think so, but what a pain! It'd be easier to rebuild the array and restore the data from backup. You do have a backup?
(4) Probably not, if I were a forensics guy I'd probably do (3) and alternate the order of drives per (2) until success in (1)

phro 09-21-2010 07:37 PM

A damned windows installer ate the superblock on one of my drives. mostlyharmless you sir are a gentleman and a scholar, that link helped me save my RAID!

Astarath 09-30-2010 08:36 PM

If you can get the UUID from one of the drives with mdadm --examine /dev/sd# then you can just do:

mdadm --assemble /dev/md# --uuid=<UUID>

Here's an example where the root standalone hdd died but the arrays were intact and I had to format and reinstall on a new root hdd

Code:

# mdadm --examine /dev/sda
/dev/sda:
          Magic : a92b4efc
        Version : 0.90.00
          UUID : 42425c2a:9c92d263:68041b65:8817d42b
  Creation Time : Thu Sep  2 20:31:10 2010
    Raid Level : raid5
  Used Dev Size : 1953514496 (1863.02 GiB 2000.40 GB)
    Array Size : 5860543488 (5589.05 GiB 6001.20 GB)
  Raid Devices : 4
  Total Devices : 4
Preferred Minor : 0
<snip>
      Number  Major  Minor  RaidDevice State
this    0      8        0        0      active sync  /dev/sda

  0    0      8        0        0      active sync  /dev/sda
  1    1      8      16        1      active sync  /dev/sdb
  2    2      8      32        2      active sync  /dev/sdc
  3    3      8      48        3      active sync  /dev/sdd

# mdadm --assemble /dev/md0 --uuid=42425c2a:9c92d263:68041b65:8817d42b
mdadm: /dev/md0 has been started with 4 drives.

So it's really quite simple to recover as long as you can get the UUID from one of the drives. I did not have an mdadm.conf or anything on the new install, in case you're wondering.

phro 10-25-2010 08:53 PM

As it happens, I just this moment had a chance to give the UUID assemble a try after getting Meerkat running. Worked just as advertised, hat tip to you sir.


All times are GMT -5. The time now is 11:49 AM.