Bug#344617: userspace incorrectly detects RAID (d-i)

Elliott Mitchell ehem at m5p.com
Sat May 20 22:19:19 UTC 2006


>From: martin f krafft <madduck at debian.org>
> > Would result in detection of md0 on sd?1, md1 on sd?2, md3 on sd?4,
> > md4 on sd?5, and md5 on sd?6.
> 
> Is there a second disk? If not, could you please give me more
> information on how your RAID is set up?
> 
> I will try to reproduce this problem, but I have no experience with
> non-Dos partition tables.

Do you think there is a device literally named /dev/sd? on my system?
Yes, I have been known to do some silly things, but nothing that
ridiculous yet. Of course there are multiple disks, in this case three,
so sd?1 was refering to the set of devices /dev/sda1, /dev/sdb1 and
/dev/sdc1.

The key point here is that most partitioning schemes include a "whole
disk" entry in their table (notably SunOS-style, FreeBSD-style and
IRIX-style). This is most often the 3rd entry/device C ("controller"
perhaps?). MSDOS-style aren't /supposed/ to have such entries, but
someone silly could try to make their MSDOS-style tables look like
everyone else's (dd to the rescue!).

If the outermost slice is RAIDed, then the userspace detection routinues
will incorrectly detect the presence of a RAID set on the whole disk
slice (since the signatures are at the end, and the end of the whole
disk slice will likely be at the same place as the end of the outermost
slice) and tell the kernel to load the whole disk slice as one RAID set.

If the RAID level on the outermost slice differs from the level on other
slices (either different level, or even no RAID at all). This WILL
result in data destruction.


There are two handy schemes I see to detect this situation. First,
make the userspace routines identify the slicing scheme, know which slice
is the overlap one and also be able to identify the RAID autorun type
(0xfd). Second, retrieve the slice data from the kernel
(/proc/partitions) and avoid slices which overlap other slices.

The first looks to be more "correct", but requires userspace to know
about all the schemes that are out there. The second is incorrect, but
fairly easy to implement and has the advantage of catching broken
tables. For my money, go with the second.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         EHeM at gremlin.m5p.com PGP 8881EF59         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
    \___\_|_/82 04 A1 3C C7 B1 37 2A*E3 6E 84 DA 97 4C 40 E6\_|_/___/






More information about the pkg-mdadm-devel mailing list