1

EDIT: It appears that this might be an inherent issue with the .9 superblock version. Figures that I would only be able to find these links after I posted here.

https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/599515 mdadm assembles with drives instead of partitions


Recently, I added to new disks to a machine. I created one partition on each drive, and used software raid to set up a raid1 between the partitions. However, for some reason after I add the partitions to the array, mdadm also detects the superblock in the underlying block devices. This causes a lot of problems during boot, as udev tries to assemble arrays incrementally and stumbles on /dev/sda before /dev/sda1. As you can see below, only md3 suffers from this problem. It was assembled with mdadm -A /dev/md3 /dev/sda1 /dev/sdb1. Have I set up these partitions incorrectly somehow?

root@blaster:/# mdadm --examine --verbose --scan
ARRAY /dev/md3 level=raid1 num-devices=2 UUID=33868dc0:becdb6b6:8b9f62c7:cb89d2ee
   spares=2   devices=/dev/sdb1,/dev/sdb,/dev/sda1,/dev/sda
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=866cc7e5:f18b48c0:539d4f3e:4592bf76
   devices=/dev/sdd1,/dev/sdc1
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=550101be:d1fac9c9:48c0e818:59501087
   devices=/dev/sdd2,/dev/sdc2
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=7783bbb3:6e381768:8b9f62c7:cb89d2ee
   devices=/dev/sdf1,/dev/sde1

2 Answers 2

1

Linux RAID superblock information is stored in the very last blocks of the device or partition. Re-formatting or or re-partitioning a device generally will NOT overwrite this block, so you have to do it manually. Running mdadm --zero-superblock will do exactly that, but you have to be very careful when you use it, or you'll nuke your RAID metadata.

3
  • I tried this on /dev/sda. It nuked the configuration completely for both the disk and the partition. Luckily it's a RAID1, so it's rebuilding right now.
    – Belly
    Commented May 24, 2012 at 2:26
  • 1
    If the end of the partition goes right to the end of the drive, then the superblock will at the end of the drive. If you size the partition slightly smaller, then the code will be able to distinguish easier.
    – tylerl
    Commented May 24, 2012 at 2:31
  • Yeah, I just found the details about that. I'll see if I can safely resize the partitions. Thanks.
    – Belly
    Commented May 24, 2012 at 2:33
1

The metadata is stored at the end of the disk which caused the issue as you already figured out. To avoid confusion like this you can try using version 1 superblock (man mdadm for details). You have version 1.1 storing this info at the start of the device, and version 1.2 storing it 4k from the start. With both of these versions you will not see this problem.

You must log in to answer this question.

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