LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-16-2016, 11:22 PM   #1
jzoudavy
Member
 
Registered: Apr 2012
Distribution: Ubuntu, SUSE, Redhat
Posts: 188

Rep: Reputation: Disabled
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

Last edited by jzoudavy; 04-16-2016 at 11:38 PM.
 
Old 04-18-2016, 10:09 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
What is in your mdadm.conf?
 
Old 04-18-2016, 10:16 AM   #3
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Try running
Code:
sudo update-initramfs -u
Seems Ubuntu needs this in order to create the device correctly.
 
Old 04-18-2016, 11:03 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by jzoudavy View Post
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
 
Old 04-18-2016, 08:25 PM   #5
jzoudavy
Member
 
Registered: Apr 2012
Distribution: Ubuntu, SUSE, Redhat
Posts: 188

Original Poster
Rep: Reputation: Disabled
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.

Last edited by jzoudavy; 04-18-2016 at 11:29 PM.
 
Old 04-18-2016, 11:44 PM   #6
jzoudavy
Member
 
Registered: Apr 2012
Distribution: Ubuntu, SUSE, Redhat
Posts: 188

Original Poster
Rep: Reputation: Disabled
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
 
Old 04-19-2016, 06:01 AM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by jzoudavy View Post
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.

Last edited by jpollard; 04-19-2016 at 06:03 AM.
 
Old 04-19-2016, 05:10 PM   #8
jzoudavy
Member
 
Registered: Apr 2012
Distribution: Ubuntu, SUSE, Redhat
Posts: 188

Original Poster
Rep: Reputation: Disabled
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.
 
Old 04-19-2016, 07:09 PM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by jzoudavy View Post
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).

Last edited by jpollard; 04-19-2016 at 07:16 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mdadm raid devices unmounted, not able to stop or mount them kamalryu Linux - Newbie 1 03-16-2013 06:58 AM
RAID devices changed their names sluge Linux - Newbie 1 02-16-2012 09:21 PM
[SOLVED] RAID 5 array not assembling all 3 devices on boot using MDADM, one is degraded. kirby9 Linux - Software 11 11-20-2010 10:32 AM
mdadm: how to avoid complete rebuild of RAID 6 array (6/8 active devices) pbwtortilla Linux - Server 4 12-25-2009 08:06 PM
How do I get mdadm to assemble a raid using local and nbd devices adrian_stephens Linux - Server 3 05-29-2009 10:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration