Debian – To write in mdadm.conf in initramfs prompt doesn”t not save changes after reboot

debianinitramfsmdadmraid

I made a mistake with my mdadm.conf with my debian backup server. I used this command :

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

to add a raid5 (it works great).

By using double '>>' it write ARRAY AFTER others in file, THAT is my error.

Then, I restarted the server. Now I have a fail at boot

"duplicate MD device on md/0..."

and it load (initramfs) prompt.

I have raids for system boot

md0 & md1

md0 = /dev/sde2 /dev/sdf2

md1 = /dev/sde3 /dev/sdf3

and a md3 raid5 for backups.

md3 = /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

the structure of mdadm.conf is :

(I can't show you the real file because i'm not on the same computer..)

ARRAY md/0 ...
ARRAY md/1 ...
ARRAY md/3 ...
ARRAY md/0 ...
ARRAY md/1 ...

so, there is 2 duplicates (md/0 and md/1)

I tried to comment the two last lines, like this :

ARRAY md/0 ...
ARRAY md/1 ...
ARRAY md/3 ...
#ARRAY md/0 ...
#ARRAY md/1 ...

with 'vi' text editor, then ':x' to save and quit. After reboot, the same error,

so I look :

cat /etc/mdadm/mdadm.conf

and I see :

ARRAY md/0 ...
ARRAY md/1 ...
ARRAY md/3 ...
ARRAY md/0 ...
ARRAY md/1 ...

AGAIN. So my mdadm.conf update doesn't seem to be saved by the system.

On another thread I read that I can use :

update-initramfs -u

to update the loader, but this command show me "Not found"

I'm pretty sure the problem come from the two last lines of mdadm.conf. By commenting them, I think it will works again. But WHAT CAN I DO to save the changes ? Because the system is not able to saves it…

Thanks for the help 🙂

Best Answer

I was solving the same problem.

As I moved drives from existing servers and forgot to zero superblocks initramfs was generated with wrong configuration.

So I went through all drives, adjusted superblocks and then updated initramfs using the same command as you did.

IT fixed the problem.