LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mdadm created raid devices changed name (https://www.linuxquestions.org/questions/linux-newbie-8/mdadm-created-raid-devices-changed-name-4175577632/)

jzoudavy 04-16-2016 11:22 PM

mdadm created raid devices changed name
 
hi all

I used mdadm to create two raid devices, md0 which is a 10G stripped (2x5G) and md1 which is 5G mirrored (2x5G). I mounted them using the mount command and tested them out and it seems to work just find.

Then I rebooted the VM and I found that the under /dev, they are no longer named md0 and md1, but md126 and md127.

Why is that?

Thanks

EDIT: using ubuntu 15.04

smallpond 04-18-2016 10:09 AM

What is in your mdadm.conf?

lazydog 04-18-2016 10:16 AM

Try running
Code:

sudo update-initramfs -u
Seems Ubuntu needs this in order to create the device correctly.

jpollard 04-18-2016 11:03 AM

Quote:

Originally Posted by jzoudavy (Post 5532284)
hi all

I used mdadm to create two raid devices, md0 which is a 10G stripped (2x5G) and md1 which is 5G mirrored (2x5G). I mounted them using the mount command and tested them out and it seems to work just find.

Then I rebooted the VM and I found that the under /dev, they are no longer named md0 and md1, but md126 and md127.

Why is that?

My system did that too. But I noticed that it only happens for those md structures given a name. Those are recorded in /dev/md/<name>. When I created a second named device it was given a new
number - and after reboot, the first created became /dev/md126, and the second /dev/md127. It didn't happen when I created some test md devices (or if I forgot to put a name I wanted).

It makes it look like the small numbered md device names are saved for unnamed devices.

I also saw that a /etc/mdadm.conf was not necessary. The devices are created via UUIDs, and organized by the kernel scanning for md devices. The /etc/mdadm.conf can be used to try to rebuild after a disaster, but is not normally used for anything. I didn't create mine until well after both md devices were created (and after several successful reboots).

I used the /dev/md/<name> to remind me which device I was dealing with (fsck/mkfs/partitioning/...) rather than try to remember which /dev/md[0123...] or which ever I was working on.

I find it harder to have a typo with /dev/md/medialib. Much better than accidentally wiping out a home filesystem or something else important.
Quote:

Thanks

EDIT: using ubuntu 15.04

jzoudavy 04-18-2016 08:25 PM

thanks for the reply guys. It does seem to be that md0 through 125 is already used for something else and it automatically renames them to md126 or higher. I just wish it would remember to automatically edit the /etc/fstab too. or a dynamically created softlink for the new directory.

EDIT:

the underlined statement is wrong. I just rebooted it again and it changed it back to md0 and md1. F**DFKJEIJSF#(!0R(9e8tq0938euf89adsvhjdio newlkrjntgwoeiuv9oaducv iosdjch ck bdslkjvw.

jzoudavy 04-18-2016 11:44 PM

To make it permenant I had to do this:

http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/
Code:

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

jpollard 04-19-2016 06:01 AM

Quote:

Originally Posted by jzoudavy (Post 5533126)
To make it permenant I had to do this:

http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/
Code:

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

The kernel will do it on its own at boot time, and that will use md127, md126,...

In either case, it doesn't matter to me. I mount using volume labels (or UUID) as the only stable names available during the device scan in the initrd.

jzoudavy 04-19-2016 05:10 PM

yeah, suppose I should start using UUIDs too. This is just a play setup so not too important. Honestly UUID is too long. 727cac18-044b-4504-87f1-a5aefa774bda all that just to say /dev/sdb1.

jpollard 04-19-2016 07:09 PM

Quote:

Originally Posted by jzoudavy (Post 5533667)
yeah, suppose I should start using UUIDs too. This is just a play setup so not too important. Honestly UUID is too long. 727cac18-044b-4504-87f1-a5aefa774bda all that just to say /dev/sdb1.

or saying /dev/disk/by-id/ata-SAMSUNG_HD250HJ_S0URJADPC01495-part1 (though knowing the device model/serial is a bit long)

Which is why I like volume labels. There is also a PARTUUID which is much shorter (11 characters); and you can always specify a short UUID as well (which is why I prefer the volume label).

I just find UUIDs hard to remember; but something like "mount LABEL=archive /mnt" is easy (or using /dev/disk/by-label/archive), doesn't depend on the device name (which can change), and reliable.

for fsck (and md devices) I like being able to use /dev/md/mmedia and know I'm referring to the right device (whether it is /dev/md0..1 or md126 or md127).


All times are GMT -5. The time now is 09:00 PM.