Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
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 '11 at 23:57
After modifying mdadm.conf, you may need to run update-initramfs for the new version to be used during boot. – sciurus May 23 '11 at 14:50
Steven Monday and sciurus's answers were bang on. Tweak mdadm.conf, run update-initramfs. Thanks! – Ian Howson May 26 '11 at 0:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.