Bug#661278: mdadm --assemble --scan needs better heuristics when partition boundary is near disk boundary

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Feb 25 21:47:00 UTC 2012


Package: mdadm
Version: 3.2.3-2
Severity: normal

I have a system with mdadm components (0.90 superblocks) that are on
partitions which end close to the end of the disk.

Running "mdadm --assemble --scan" (as happens in the initramfs) fails
to initialize the array, and prints this message:

mdadm: WARNING /dev/sdb1 and /dev/sdb appear to have very similar superblocks.
      If they are really different, please --zero the superblock on one
      If they are the same or overlap, please remove one from the DEVICE list in mdadm.conf

Of course, any normal human sysadmin can look at this and say "sdb1
overlaps with sdb".  So it seems that mdadm could use an improved
heuristic to judge this not-uncommon situation and deal with it
without presenting the user with a failure:

If mdadm sees matching 0.90 superblocks on two devices, and both
devices can fit the superblock's "Used dev size", then choose the
smaller of the two devices.

Alternately, the heuristic could just verify the special case of a
partition and its parent disk (e.g. via major and minor number
comparisons).

Either way, mdadm should be friendlier to the user when this situation
arises.  manually configuring mdadm.conf to only look at partitions
(and ignore full disks) is kind of a pain:

 DEVICE /dev/[hs]d*[123456789]*

(and of course this wouldn't be acceptable for people using whole
disks as mdadm components).

fwiw, another component that has avoidable trouble in this situation
is grub.  I'm working with grub's upstream to improve their heuristics
for handling situations like this, and hope to see this fixed there
shortly [0].  It'd be nice to have mdadm be comparably capable.

      --dkg

[0] https://lists.gnu.org/archive/html/grub-devel/2012-02/msg00003.html

-- Package-specific info:
--- mdadm.conf
CREATE owner=root group=disk mode=0660 auto=yes
HOMEHOST <system>
MAILADDR root
ARRAY /dev/md0 UUID=f43d27b8:268cb667:f364ebb9:997ca579
DEVICE /dev/sd*[123456789]*

--- /etc/default/mdadm
INITRDSTART='all'
AUTOSTART=true
AUTOCHECK=false
START_DAEMON=false
DAEMON_OPTIONS="--syslog"
VERBOSE=false

--- /proc/mdstat:
Personalities : [raid1] 
md0 : active raid1 sdb1[0] sda2[1]
      13256064 blocks [2/2] [UU]
      
unused devices: <none>

--- /proc/partitions:
major minor  #blocks  name

   8        0   19531250 sda
   8        1    6266913 sda1
   8        2   13256178 sda2
   8       16   13260240 sdb
   8       17   13258192 sdb1
   9        0   13256064 md0
 253        0    3145728 dm-0

--- LVM physical volumes:
  PV         VG        Fmt  Attr PSize  PFree
  /dev/md0   vg_trash0 lvm2 a--  12.64g 9.64g
--- mount output
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=575960k,nr_inodes=143990,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=116268k,mode=755)
/dev/mapper/vg_trash0-root on / type ext3 (rw,relatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime,size=232532k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,relatime,size=232532k)

--- initrd.img-3.2.0-1-686-pae:
50965 blocks
f4fbd9099399ab08ba9b9f6c71d77595  ./scripts/local-top/mdadm
f302d7280873929e74ea5437988a6d12  ./etc/mdadm/mdadm.conf
f93000eb15384550f1ec601e01162ed2  ./sbin/mdadm
67fe47b4ab8e627ba0e4094250b22253  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/dm-mirror.ko
416e902eaf5ce942d352f3c462cc6e79  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/dm-log.ko
1ed7d2a172a00705fc8060303ae8948c  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/dm-snapshot.ko
b3e11d99443be45593d01faffbd03bea  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/linear.ko
cc530b4c71ebdddb7f3044520731443e  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/raid1.ko
ec45856a2754214704ad051cfb2758ef  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/raid0.ko
118a27a5a6cad2998f4fa444a09c5889  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/multipath.ko
57040ba2184e1a11ec88647e45361731  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/raid456.ko
d012a5d397b8ecc431857d14812c6a02  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/md-mod.ko
ef75cc7354e8e1b079ae53a56b763bfe  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/dm-mod.ko
5e732d5abcb5898dd8479521975c6ae6  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/dm-region-hash.ko
c846a6c6c6eb59d88091a654d9f9154c  ./lib/modules/3.2.0-1-686-pae/kernel/drivers/md/raid10.ko

--- initrd's /conf/conf.d/md:
MD_HOMEHOST='trash'
MD_DEVPAIRS='/dev/md0:raid1'
MD_LEVELS='raid1'
MD_DEVS=all
MD_MODULES='raid1'

--- /proc/modules:
dm_mod 57278 3 - Live 0xf82fd000
raid1 26218 1 - Live 0xf82c9000
md_mod 85719 2 raid1, Live 0xf832f000

--- /var/log/syslog:

--- volume detail:
/dev/sda:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : f43d27b8:268cb667:f364ebb9:997ca579
  Creation Time : Fri Feb 24 02:59:43 2012
     Raid Level : raid1
  Used Dev Size : 13256064 (12.64 GiB 13.57 GB)
     Array Size : 13256064 (12.64 GiB 13.57 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0

    Update Time : Sat Feb 25 21:24:26 2012
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0
       Checksum : f0315348 - correct
         Events : 20


      Number   Major   Minor   RaidDevice State
this     1       8        2        1      active sync   /dev/sda2

   0     0       8       17        0      active sync   /dev/sdb1
   1     1       8        2        1      active sync   /dev/sda2
--
/dev/sda1 is not recognised by mdadm.
/dev/sda2:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : f43d27b8:268cb667:f364ebb9:997ca579
  Creation Time : Fri Feb 24 02:59:43 2012
     Raid Level : raid1
  Used Dev Size : 13256064 (12.64 GiB 13.57 GB)
     Array Size : 13256064 (12.64 GiB 13.57 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0

    Update Time : Sat Feb 25 21:24:26 2012
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0
       Checksum : f0315348 - correct
         Events : 20


      Number   Major   Minor   RaidDevice State
this     1       8        2        1      active sync   /dev/sda2

   0     0       8       17        0      active sync   /dev/sdb1
   1     1       8        2        1      active sync   /dev/sda2
--
/dev/sdb:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : f43d27b8:268cb667:f364ebb9:997ca579
  Creation Time : Fri Feb 24 02:59:43 2012
     Raid Level : raid1
  Used Dev Size : 13256064 (12.64 GiB 13.57 GB)
     Array Size : 13256064 (12.64 GiB 13.57 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0

    Update Time : Sat Feb 25 21:24:26 2012
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0
       Checksum : f0315355 - correct
         Events : 20


      Number   Major   Minor   RaidDevice State
this     0       8       17        0      active sync   /dev/sdb1

   0     0       8       17        0      active sync   /dev/sdb1
   1     1       8        2        1      active sync   /dev/sda2
--
/dev/sdb1:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : f43d27b8:268cb667:f364ebb9:997ca579
  Creation Time : Fri Feb 24 02:59:43 2012
     Raid Level : raid1
  Used Dev Size : 13256064 (12.64 GiB 13.57 GB)
     Array Size : 13256064 (12.64 GiB 13.57 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0

    Update Time : Sat Feb 25 21:24:26 2012
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0
       Checksum : f0315355 - correct
         Events : 20


      Number   Major   Minor   RaidDevice State
this     0       8       17        0      active sync   /dev/sdb1

   0     0       8       17        0      active sync   /dev/sdb1
   1     1       8        2        1      active sync   /dev/sda2
--

--- /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-3.2.0-1-686-pae root=/dev/mapper/vg_trash0-root ro quiet

--- grub2:
insmod raid
set root='(vg_trash0-root)'
  insmod raid
  set root='(vg_trash0-root)'
	insmod raid
	set root='(vg_trash0-root)'
	linux	/boot/vmlinuz-3.2.0-1-686-pae root=/dev/mapper/vg_trash0-root ro  quiet
	insmod raid
	set root='(vg_trash0-root)'
	linux	/boot/vmlinuz-3.2.0-1-686-pae root=/dev/mapper/vg_trash0-root ro single 

--- udev:
ii  udev           175-3.1        /dev/ and hotplug management daemon
6df86db16655769fa94086d3ee13453a  /lib/udev/rules.d/64-md-raid.rules

--- /dev:
brw-rw---T 1 root disk 9, 0 Feb 25 21:09 /dev/md0

/dev/disk/by-id:
total 0
lrwxrwxrwx 1 root root  9 Feb 25 21:09 ata-QUANTUM_FIREBALLP_LM13_883011560304 -> ../../sdb
lrwxrwxrwx 1 root root 10 Feb 25 21:09 ata-QUANTUM_FIREBALLP_LM13_883011560304-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Feb 25 21:09 ata-WDC_WD200BB-75DEA0_WD-WMAD21424320 -> ../../sda
lrwxrwxrwx 1 root root 10 Feb 25 21:09 ata-WDC_WD200BB-75DEA0_WD-WMAD21424320-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Feb 25 21:09 ata-WDC_WD200BB-75DEA0_WD-WMAD21424320-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Feb 25 21:09 dm-name-vg_trash0-root -> ../../dm-0
lrwxrwxrwx 1 root root 10 Feb 25 21:09 dm-uuid-LVM-wLdusu0VcjglKWQSWTmYM2kjGf4SvsUT3RtopkVowsNy7R4Kfwag8WxsYpWHdMSv -> ../../dm-0
lrwxrwxrwx 1 root root  9 Feb 25 21:09 md-uuid-f43d27b8:268cb667:f364ebb9:997ca579 -> ../../md0
lrwxrwxrwx 1 root root  9 Feb 25 21:09 scsi-SATA_QUANTUM_FIREBAL883011560304 -> ../../sdb
lrwxrwxrwx 1 root root 10 Feb 25 21:09 scsi-SATA_QUANTUM_FIREBAL883011560304-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Feb 25 21:09 scsi-SATA_WDC_WD200BB-75DWD-WMAD21424320 -> ../../sda
lrwxrwxrwx 1 root root 10 Feb 25 21:09 scsi-SATA_WDC_WD200BB-75DWD-WMAD21424320-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Feb 25 21:09 scsi-SATA_WDC_WD200BB-75DWD-WMAD21424320-part2 -> ../../sda2

/dev/disk/by-path:
total 0
lrwxrwxrwx 1 root root  9 Feb 25 21:09 pci-0000:00:1f.1-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 Feb 25 21:09 pci-0000:00:1f.1-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Feb 25 21:09 pci-0000:00:1f.1-scsi-0:0:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root  9 Feb 25 21:09 pci-0000:00:1f.1-scsi-1:0:0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Feb 25 21:09 pci-0000:00:1f.1-scsi-1:0:0:0-part1 -> ../../sdb1

/dev/disk/by-uuid:
total 0
lrwxrwxrwx 1 root root 10 Feb 25 21:09 f7631934-2b10-47c3-b06f-f9da71e0fd30 -> ../../dm-0

/dev/md:
total 0

Auto-generated on Sat, 25 Feb 2012 21:25:16 +0000
by mdadm bugscript 3.2.3-2

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-1-686-pae (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mdadm depends on:
ii  debconf      1.5.41
ii  initscripts  2.88dsf-22
ii  libc6        2.13-26
ii  lsb-base     3.2-28.1
ii  udev         175-3.1

Versions of packages mdadm recommends:
ii  default-mta | mail-transport-agent  <none>
ii  module-init-tools                   3.16-1

mdadm suggests no packages.

-- debconf information:
  mdadm/initrdstart_msg_errexist:
  mdadm/mail_to: root
  mdadm/initrdstart_msg_errmd:
* mdadm/initrdstart: all
  mdadm/initrdstart_msg_intro:
  mdadm/autostart: true
  mdadm/initrdstart_msg_errconf:
* mdadm/autocheck: false
  mdadm/initrdstart_notinconf: false
  mdadm/initrdstart_msg_errblock:
* mdadm/start_daemon: false





More information about the pkg-mdadm-devel mailing list