Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I left my server running all night 'recovering' after i built a new raid 5 array using the command:

mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sd[bcd]1

My server spent all night rebuilding and I got the desired results:

    amir@SuperMassive:~$ sudo mdadm --detail --scan
    [sudo] password for amir: 
    ARRAY /dev/md0 metadata=1.2 name=SuperMassive:0 UUID=2f693f45:accebaf0:70060db8:c5cb42e0

I tried to add this to my mdadm.conf file but kept getting permission denied errors.

amir@SuperMassive:~$ sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf
-bash: /etc/mdadm/mdadm.conf: Permission denied

For some reason which i can not explain i thought a reboot would be a good idea. I did not think about the fact that I had not added my array to the mdadm.conf file. Now when I look at my arrow the name has changed from /dev/MD to /dev/md/SuperMassive:0

amir@SuperMassive:~$ sudo mdadm --detail --scan
[sudo] password for amir: 
ARRAY /dev/md/SuperMassive:0 metadata=1.2 name=SuperMassive:0 UUID=2f693f45:accebaf0:70060db8:c5cb42e0

Can anyone tell me how to fix this ? I really don't want to have to go through another recovery :( I edited the mdadm.conf file to include the proper line from the first mdadm detail scan but after reboot i still get the output from the last mdadm detail scan with the name being /dev/md/SuperMassive:0.

Another thing ot note is that in /dev instead of having md0 and md0p1 i have md127 and md127p1. :(

share|improve this question

2 Answers 2

That's is strange, I see that all the mdadm with sudo. Mayb first you need to stop the array... last time I have to repair a raid I used a live cd... let's try this:

Firt be root (sudo -i), then stop your array

fist do cat /proc/mdstat and save it to a file to see the diferences ok?

mdadm --stop /dev/md0

then re-create the array (sorry)

mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb /dev/sdc /dev/sdd

sav the conf.

mdadm --detail --scan >> /etc/mdadm.conf 

look your conf. cat /proc/mdstat

look at mine for example;

cat /proc/mdstat 
Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] 
md4 : active raid5 sdd4[0] sdg4[4] sdf4[2] sde4[1]
      5762701824 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]

md3 : active raid1 sdh1[0] sdi1[1]
      1953512400 blocks super 1.2 [2/2] [UU]

md2 : active raid5 sdj1[0] sdc1[4] sdb1[2] sda1[1]
      5860535808 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]

md0 : active raid1 sdd2[0] sde2[3] sdf2[2] sdg2[1]
      409152 blocks [4/4] [UUUU]

md1 : active raid5 sdd3[0] sde3[3] sdf3[2] sdg3[1]
      93449856 blocks level 5, 64k chunk, algorithm 2 [4/4] [UUUU]

unused devices: <none>

anyway if this doesnt work show us more info. (mdadm --detail /dev/md0, mdadm --examine /dev/sd[abcde...]) good luck!

share|improve this answer
1  
I wish I had seen your post earlier. I just did a reinstall as this is a fresh machine. However things are still not going to plan - once it is finished recovering I will update on here. –  Amir Feb 25 '12 at 12:52
    
I found I had alignment errors after recovering the raid for the 3rd day in a row.. .grrrr. I read more and repartitioned my drives and this time i made sure they are aligned. Guess what I am doing now - yes you guessed it.. recovering for the 4th day in a row.. –  Amir Feb 25 '12 at 20:52

Additionally I might add that tee would help in your case. So entering

sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf

will lead to no permission denied errors. The tee command together with the append option (-a) takes the output of mdadm and appends it to the file.

In the case you described the output redirection (>>) happens as user amir and you don't have the right to write into the file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.