How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

September 22, 2015

centos /dev/md127 problem after reboot

Filed under: Linux — Tags: , , , , — admin @ 1:06 pm

Hello
Well today I want to explain about my raid experience.
I have to setup a hybrid server on hetzner. I setup the ssd on raid1 using installimage and those other hard drive I have create a raid from linux and mounted them on /raid1 directory .
However after reboot, my /dev/md4 disappear and a /dev/md127 appear.
To create the raid I have use this
fdisk /dev/sdc and /dev/sdd . Make a primary partition and set it up as fd software raid partition .

mdadm –create /dev/md4 –level=1 –raid-devices=2 /dev/sdc1 /dev/sdd1
mkfs.ext4 /dev/md4
mkdir /raid1
mount /dev/md4 /raid1

And insert this into fstab file
/dev/md4 /raid1 ext4 noatime,rw 0 0

So how to fix this ?
First I try to input some information into /etc/mdadm.conf but without luck . It appear that the linux read this late and the centos/ubuntu initalize this from initrd . So in order to fix this some steps have to be done .
After reboot try to fill the information into mdadm.conf with
ARRAY /dev/md/4 UUID=b3c33fe5:3b078681:e2776e37:4f9fd991
The UUID I have taken from

mdadm –detail /dev/md4

First unmount and stop the raid

mdadm –stop /dev/md127
After this assemble it again with your desire
mdadm –assemble /dev/md4 /dev/sdc1 /dev/sdd1

After this I have copy the
/boot/initramfs-2.6.32-573.3.1.el6.x86_64.img to a backup file ( initramfs-2.6.32-573.3.1.el6.x86_64.img-back ) in case something go wrong.

After this run
dracut –force

If is centos 5 or less you have to copy initrd file and to recreate use
mkinitrd -f -v /boot/initrd-$(uname -r).img $(uname -r)

On ubuntu you have to run
sudo update-initramfs -u

And restart the server.

Powered by WordPress