seldom_used n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 06 Feb 2007 Posts: 25
|
Posted: Sun Apr 27, 2008 8:10 pm Post subject: [solved] Minor number collision when moving md raid arrays |
|
|
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 ) would be great to hear it. |
|