[CentOS] help with rebuilding md0 (Raid5)

Wed May 20 15:32:26 UTC 2009
Daniel Bird <dbird at sgul.ac.uk>

Sorry, this is going to be a rather long post...Here's the situation; I
have 4 IDE disks from an old snap server which fails to mount the raid
array. We believe there is a controller error on the SNAP so we've put
them in another box running CentOS 5 and can see the disks OK.

hda thru hdd looks like this

Disk /dev/hdd: 185.2 GB, 185283624960 bytes
255 heads, 63 sectors/track, 22526 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdd1   *           1           2       16041+  83  Linux
/dev/hdd2               3          70      546210   83  Linux
/dev/hdd3              71         138      546210    5  Extended
/dev/hdd4             139       21781   173844468   83  Linux
/dev/hdd5              71         104      273104+  83  Linux
/dev/hdd6             105         138      273104+  83  Linux


I can mount hdX1 and hdX2 (hdx2 is xfs) on all disks.

Now /etc/raidtab (from one of the hdx2 partions) has the following entry
which I'd like to re-create on the CentOS box

raiddev   /dev/md0
  raid-level      5
  nr-raid-disks           4
  nr-spare-disks          0
  persistent-superblock   1
  chunk-size              64
  device                /dev/hda4
  raid-disk             0
  device                /dev/hdc4
  raid-disk             1
  device                /dev/hde4
  raid-disk             2
  device                /dev/hdg4
  raid-disk             3

I've also checked the superblocks

/dev/hda4:
          Magic : a92b4efc
        Version : 00.90.00
           UUID : a72e334f:a9ccba81:bba665d8:82a3c378
  Creation Time : Mon Jun 30 12:00:28 2003
     Raid Level : raid5
  Used Dev Size : 173844352 (165.79 GiB 178.02 GB)
     Array Size : 521533056 (497.37 GiB 534.05 GB)
   Raid Devices : 4
  Total Devices : 3
Preferred Minor : 0

    Update Time : Tue May 19 21:40:43 2009
          State : active
 Active Devices : 2
Working Devices : 2
 Failed Devices : 1
  Spare Devices : 0
       Checksum : cbe14089 - correct
         Events : 0.22

         Layout : left-asymmetric
     Chunk Size : 64K

      Number   Major   Minor   RaidDevice State
this     0       3        4        0      active sync   /dev/hda4

   0     0       3        4        0      active sync   /dev/hda4
   1     1      22        4        1      faulty   /dev/hdc4
   2     2       0        0        2      faulty removed
   3     3      34        4        3      active sync
/dev/hdb4:
          Magic : a92b4efc
        Version : 00.90.00
           UUID : a72e334f:a9ccba81:bba665d8:82a3c378
  Creation Time : Mon Jun 30 12:00:28 2003
     Raid Level : raid5
  Used Dev Size : 173844352 (165.79 GiB 178.02 GB)
     Array Size : 521533056 (497.37 GiB 534.05 GB)
   Raid Devices : 4
  Total Devices : 3
Preferred Minor : 0

    Update Time : Sat Aug  2 19:26:28 2008
          State : active
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0
       Checksum : ca62ce2c - correct
         Events : 0.21

         Layout : left-asymmetric
     Chunk Size : 64K

      Number   Major   Minor   RaidDevice State
this     1      22        4        1      active sync   /dev/hdc4

   0     0       3        4        0      active sync   /dev/hda4
   1     1      22        4        1      active sync   /dev/hdc4
   2     2       0        0        2      faulty removed
   3     3      34        4        3      active sync
/dev/hdc4:
          Magic : a92b4efc
        Version : 00.90.00
           UUID : a72e334f:a9ccba81:bba665d8:82a3c378
  Creation Time : Mon Jun 30 12:00:28 2003
     Raid Level : raid5
  Used Dev Size : 173844352 (165.79 GiB 178.02 GB)
     Array Size : 521533056 (497.37 GiB 534.05 GB)
   Raid Devices : 4
  Total Devices : 4
Preferred Minor : 0

    Update Time : Sun Jul 22 22:33:00 2007
          State : active
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0
       Checksum : c871f493 - correct
         Events : 0.18

         Layout : left-asymmetric
     Chunk Size : 64K

      Number   Major   Minor   RaidDevice State
this     2      33        4        2      active sync

   0     0       3        4        0      active sync   /dev/hda4
   1     1      22        4        1      active sync   /dev/hdc4
   2     2      33        4        2      active sync
   3     3      34        4        3      active sync
/dev/hdd4:
          Magic : a92b4efc
        Version : 00.90.00
           UUID : a72e334f:a9ccba81:bba665d8:82a3c378
  Creation Time : Mon Jun 30 12:00:28 2003
     Raid Level : raid5
  Used Dev Size : 173844352 (165.79 GiB 178.02 GB)
     Array Size : 521533056 (497.37 GiB 534.05 GB)
   Raid Devices : 4
  Total Devices : 3
Preferred Minor : 0

    Update Time : Sat Aug  2 19:26:28 2008
          State : active
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0
       Checksum : ca62ce3c - correct
         Events : 0.21

         Layout : left-asymmetric
     Chunk Size : 64K

      Number   Major   Minor   RaidDevice State
this     3      34        4        3      active sync

   0     0       3        4        0      active sync   /dev/hda4
   1     1      22        4        1      active sync   /dev/hdc4
   2     2       0        0        2      faulty removed
   3     3      34        4        3      active sync



This is my fist stab and re-assembling an array after moving the disks
so I though I'd double check how I would go about re-assembling this Can
I simply do

mdadm --assemble --scan

? Or do I need to reset the superblocks and re-assemble in degraded mode
somehow?

TIA

Dan