1

I have just broke my software RAID 5 Array (build using mdadm) set up by changing one of the HDD partition.

The exact command I used is:

sudo parted -s /dev/sdb mklabel msdos

on one of 4 HDDs in my array.

Is there a way how to fix this HDD and add it back to array without loosing any data?

I'm very new to linux, so now sure how to show you more info about my set up.

Mike

2
  • Are you using hardware or software Raid?
    – Mitch
    Jun 5, 2012 at 11:05
  • I'm using software raid
    – Mike
    Jun 5, 2012 at 11:07

3 Answers 3

0

How to add the 4th disk back to the raid? "From Mike's Question in previous comment"

Edit this for your needs:

mdadm --add /dev/md1 /dev/sdf1
mdadm --grow /dev/md1 --raid-devices=4

This then took several hours to reshape the array.

The filesystem the needs to be expanded to fill up the new space.

fsck.ext3 /dev/md1
resize2fs /dev/md1
2
  • Thanx Subv3rsion that will do it :)
    – Mike
    Jun 5, 2012 at 12:15
  • That is how to add a new disk to an array, and expand it to use the additional space, not how to fix @Mike's problem.
    – psusi
    Jun 5, 2012 at 14:04
0

You can use a tool named raidextract.

Example usage:

./raidextract --window 1024 --stripe 16 --rotate 6 \
    --start $((0x41C6E79A00)) --length $((4096*1024*64000)) \
    --failed 5 /dev/sd[a-g] | ssh othermachine dd of=RecoveredFilesystem

If you use raidextract to read a filesystem image, you can write the output to a file and run all the standard filesystem tools (tune2fs, e2fsck) on the file. Once you've finished, you can the mount the filesystem with mount -o loop.

For more information, you can read this: http://www.chiark.greenend.org.uk/~peterb/linux/raidextract/

Hope this helps.

4
  • Cheers Subv3rsion, unfortunately I dont have other HDD where can I output 3TB of data to :( I thought that by having Raid-5 one of the HDD is redundant and all data could be easily recovered if one hdd dies.
    – Mike
    Jun 5, 2012 at 11:38
  • Well, note that RAID isn't a backup system. Jun 5, 2012 at 11:39
  • One more thing, can you try do a XFS repair? then try to mount it again. Jun 5, 2012 at 11:42
  • 1
    ok, I managed to start the raid in degraded state and mount it. Good news is I can access all the data. How to add the 4th disk back to the raid?
    – Mike
    Jun 5, 2012 at 12:01
0

If the only thing you did was blow away the partition table with parted, then all you have to do to fix it is to recreate the partition table exactly as it was before. Put parted into sector mode with the unit s command, and you can probably look at the other disks in the array to guess how this one was partitioned.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .