1

My laptop, running Ubuntu Natty, is partitioned like so:

  • /dev/sda1: 500MB, /boot
  • /dev/sda2: 148GB, /

sda2 is a software RAID1 with 1 device. This is intentional -- I periodically reshape the array with external drives.

When operating normally, the array looks like:

  • /dev/md0, [sda2]

This all works great, except that that when I boot, the array is detected as:

  • /dev/md127, [sda]

i.e. the whole drive, not the partition. I assume that this is because the 0.90 metadata format is stored at the end, but... surely it stores the start address or device somewhere?

mdadm --examine gives identical results for /dev/sda and /dev/sda2; I would expect it to fail on /dev/sda, but (again) I assume that this is because the metadata for sda2 happens to be in the correct place for sda as well.

Why is the wrong raid device detected automatically? Short of repartitioning the drive, is there any way I can prevent sda from being detected as a RAID array?

1 Answer 1

1

You should be able to prevent /dev/sda from being detected as an array device by appropriately crafting DEVICE entries in /etc/mdadm/mdadm.conf. Specifically, you can ensure that a partition (like /dev/sda2) is used---and a whole-drive device (like /dev/sda) is ignored---by specifying a DEVICE pattern like the following:

DEVICE /dev/sd[a-z][1-9]

You can also give multiple (glob-style) patterns, either separated by spaces, or in additional DEVICE lines.

Finally, be certain to comment-out/remove any line in mdadm.conf containing DEVICE partitions, so that mdadm does not consider the contents of /proc/partitions.

3
  • Ah, excellent suggestion - I assumed that initrd used mdadm --auto-detect to start arrays. I will try adjusting mdadm.conf and report back next time I need to reboot.
    – Ian Howson
    May 22, 2011 at 23:57
  • 1
    After modifying mdadm.conf, you may need to run update-initramfs for the new version to be used during boot.
    – sciurus
    May 23, 2011 at 14:50
  • Steven Monday and sciurus's answers were bang on. Tweak mdadm.conf, run update-initramfs. Thanks!
    – Ian Howson
    May 26, 2011 at 0:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .