0

is it possible to restore a raid 5 array, previously created using mdadm, after an accidental "--create" command instead of "--assemble" (the goal was to move the array after a system format)

configuration: raid 5 array using 3 hard drives, each with one linux-raid-autodetect partition, array created with mdadm on suse linux enterprise server 10.

3a2roub
  • 294
  • 4
  • 15
  • As Bart said, just restore from backup. The one you took before playing with HDs, RAID Arrays, and reinstalling the system. – Chris S Oct 15 '10 at 14:14
  • how exactly can i restore from backup? the hard disk where the previous system was installed is fried beyond repair.. what and how do u mean restore from backup? – 3a2roub Oct 15 '10 at 14:40

2 Answers2

1

To my knowledge, without playing with low level disk editing tools to read the drive, the time spent trying to recover it may be better spent or more effectively used restoring from a backup.

You could try running testdisk from a recovery CD/bootable CD, but no single disk will have all the data, so I don't know how it'll handle the information. I suppose you could try just restoring old partition information if it sees it, but there's no guarantee that it won't further screw up the data if it's still there.

Best answer: recover from backup.

Bart Silverstrim
  • 31,172
  • 9
  • 67
  • 87
1

If you create RAID with the same configuration, it should work:

(root)# mdadm --create --verbose /dev/md0 --level=5  --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1

(root)# mkdir /raid

(root)# mount /dev/md0 /raid/

(root)# cp /vmlinuz /raid/

(root)# md5sum /raid/vmlinuz 
a36c45658d6bc5371ac432bd0af92a0e  /raid/vmlinuz

(root)# mdadm -S /dev/md0 
mdadm: stopped /dev/md0

(root)# mdadm --zero-superblock /dev/sdb1 
(root)# mdadm --zero-superblock /dev/sdc1 
(root)# mdadm --zero-superblock /dev/sdd1

(root)# mdadm --create --verbose /dev/md1 --level=5  --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1

(root)# mount /dev/md1 /raid/

(root)# md5sum /raid/vmlinuz 
a36c45658d6bc5371ac432bd0af92a0e  /raid/vmlinuz

otherwise, show "mdadm --create" command

bindbn
  • 5,211
  • 2
  • 26
  • 24
  • yes, thats how i created it. only when i mount it mount /dev/md0 /mnt it says: you need to specify the filesystem type. i didnt perform mkfs.ext3 or formatted after creating it because i dont want to lose data. now what? – 3a2roub Oct 15 '10 at 14:22
  • try # dumpe2fs /dev/md0... maybe you used LVM? try: lvm vgscan – bindbn Oct 15 '10 at 14:38
  • dumpe2fs returned bad magic number.. im trying re-creating the array after zero-superblocking the partitions. – 3a2roub Oct 15 '10 at 15:21