Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Minor number collision when moving md raid arrays
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
seldom_used
n00b
n00b


Joined: 06 Feb 2007
Posts: 25

PostPosted: Sun Apr 27, 2008 8:10 pm    Post subject: [solved] Minor number collision when moving md raid arrays Reply with quote

Was stumped for a while on this one. Imagine this:
Running a Gentoo file server with three md arrays: /dev/md0, /dev/md1, /dev/md2
I wanted to add more drives from another Gentoo machine with the same raid setup: /dev/md0, /dev/md1, /dev/md2. There is nothing in common between the arrays except they were named the same.
So, upon installing the drives the file server would not pass md autodetection since there were two different arrays wanting to use the same name: /dev/md0 or 1 or 2... What's worse the root filesystem was on one of the arrays so I had no tools to repair it in-situ.

In the end I booted off an install CD, assembled each array by hand with
Code:
mdadm -A /dev/mdX /dev/sdaY /dev/sdbY ...
An illustration of the problem is that running mdadm --examine --scan shows this:
Code:
ARRAY /dev/md0 level=raid5 num-devices=4 UUID=fc8da353:68a26fbe:d19bbe36:dfc9c426
ARRAY /dev/md1 level=raid5 num-devices=4 UUID=16b09173:a5640d97:8454f804:ef8b4396
ARRAY /dev/md2 level=raid1 num-devices=4 UUID=9867c248:b7fe0ec2:7d91be05:22b98c80
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=bae4173f:d665f810:6e28826f:b1b8df4f
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=c63d9d57:5c876c5e:b578ae4e:afaf3280
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=392c6b04:3e8280a8:4aeecfbd:dbf096b3

You can see that /dev/md0, 1, 2 are each mentioned twice - hence md autodetect code doesn't know what to do during bootup.

The solution is in the man page for mdadm: superblocks are updated with current metadata on the first write to the array. Once the arrays were all running at proper nodes, from /dev/md0 through /dev/md5, the trick is to mount the ones that would cause conflicts (in my case /dev/md3 through 5), and write something to each array. This causes the superblocks to be updated with correct minor numbers.
Upon unmounting everything and rebooting md autorun went well and arrays were numbered properly.

If there is a cleaner solution (ugh... install CD and all the mounting-unmounting :roll: ) would be great to hear it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum