LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Mdadm raid (https://www.linuxquestions.org/questions/linux-software-2/mdadm-raid-730498/)

shadowers 06-03-2009 04:23 PM

Mdadm raid
 
I have a failed legacy Mdadm raid 1 and need to recover it. One drive has the data still, and the next needs to be added to the array. During the down time I have changed distros to Gentoo. I need to either recreate my legacy array without losing the data on the first drive, or create a superblock array and keep the data in tact.

mostlyharmless 06-03-2009 05:17 PM

Well, I'd imagine that mdadm -B /dev/mdX /dev/device1 missing --level=1 --raid-devices=2 would start your array with the missing drive. You could then mdadm --add /dev/mdX /dev/device2 to rebuild redundancy, or you could copy the data to a new array with superblocks. See man mdadm.

shadowers 06-03-2009 05:36 PM

I executed the command and got this:

Code:

mdadm: ADD_NEW_DISK failed for /dev/hdb1: Invalid argument

mostlyharmless 06-03-2009 05:57 PM

Hmm, maybe you can't --add on a legacy array. I presume that it was the second command that gave you an error. You might want to post Exactly what you typed with fdisk -l as well to avoid misunderstanding.

Assuming that's OK, I'd just build a new array, mount both of them and rsync or cp the data over. Something like:
#check the oldarray to make sure it's built and running
mdadm -S /dev/mdX
# mount it
mount /dev/mdX /mnt/oldarray
#make a new array with superblocks somewhere else
mdadm --create /dev/mdY /deviceA /deviceB
#check to make sure it's what you want
mdadm -S /dev/mdY
#mount it
mount /dev/mdY /mnt/newarray
rsync -avH /mnt/oldarray /mnt/newarray

shadowers 06-03-2009 11:17 PM

I typed
Code:

mdadm -B /dev/mdX /dev/device1 missing --level=1 --raid-devices=2
It returned

Code:

mdadm: ADD_NEW_DISK failed for /dev/hdb1: Invalid argument
I have the data backed up, and I would have recreated the array a long time ago. Only issue is my dad is wanting me to do everything I can to rebuild it rather than loosing the data on the drives, even though its backed up...

mostlyharmless 06-04-2009 10:34 AM

You mean you typed something like
mdadm -B /dev/md0 /dev/hdb1 missing --level=1 --raid-devices=2
right?
Not something like
mdadm -B /dev/hdb1 /dev/device1 missing --level=1 --raid-devices=2
right?
Just trying to be clear, my syntax was meant as a general example not a specific recipe!

shadowers 06-04-2009 01:20 PM

I didnt use the general stuff haha, but I'm working on it. My local Gentoo Guru is helping me =P


All times are GMT -5. The time now is 05:35 PM.