Move an existing RAID 5 array from Ubuntu to Gentoo

gentoomdmdadmraid

I have a 64-bit Ubuntu machine with a 4-disk RAID 5 using software raid (md). I've been able to boot an Ubuntu LiveCD and recognize the array with a simple mdadm -A /dev/md0. It was easy to mount after that and nothing had to rebuild.

I'm installing Gentoo on this box now (multi-boot, non-RAID root partition) and I have md auto-detect turned on in the kernel. When I boot Gentoo I get: "invalid superblock magic on sdd" for each of the drives in the array. I boot back to Ubuntu and they mount no problem.

I tried copying the mdadm.conf that works in Ubuntu to Gentoo, and then ran mdadm -A /dev/md0 but it reports that there is no array named md0.

I don't want to lose data (obviously) and I don't want to have to let the RAID rebuild every time I switch between OSes. Any help is appreciated.

Both are using mdadm 3.1.4

Both are running 64-bit kernels.

mdadm -D /dev/md0 from Ubuntu yields: http://pastebin.com/5gj2QNkV

UPDATE: After rebooting I noticed that it still complains about invalid blocks, but cat /proc/mdstat shows an inactive /dev/md127 with the same disks as my raid. I want to mount it but I don't want to get stuck waiting for a rebuild or destroying it inadvertently. mdadm -D /dev/md127
Here is pastebin of mdadm -D /dev/md127 on gentoo: http://pastebin.com/gDCWn0Rn

UPDATE II:

dmesg output about 'invalid raid superblocks' http://paste.ubuntu.com/885471/

fdisk -l from Ubuntu, /dev/md0 does not have any partitions but I do have it mounted and accessible: http://paste.ubuntu.com/885475/

Best Answer

The renaming of software raid devices is something unproblematic (here from md0 to md127). I've seen this over the last years and you shouldn't worry about it.

But your were totally right to ask about the auto-assembly warnings. Here, the devil lies in the details. In dmesg you see it's trying to find mdadm 0.90c superblocks (the old ones). It fails and it does naturally fail, because your volume is formatted using version 1.2 metadata. No problem here too.

See man 8 mdadm about which metadata format you have as default on Ubuntu and Gentoo. I would guess even if it's not in the manpages, that you run different kernel configs concerning soft raid (see "Multiple Devices" in make menuconfig).

So, in my experience of around eight years with mdadm/soft raid with linux, you are good to go. No reason to worry, besides getting a more current kernel :-)

EDIT: Also, dont worry about your array being corrupt. You can clearly see from your status pastes, that its just fine, as one would expect.

Do you have further questions on the matter?