Bug#496573: raid.mod uses wrong disk number from superblock

Felix Zielcke fzielcke at z-51.de
Mon Aug 25 18:55:35 UTC 2008


Package: grub2
Severity: important

The Linux mdraid hsa 2 fields in it's superblock for the total count of
RAID disks.

>From /usr/include/linux/raid/md_p.h:
        __u32 nr_disks;         /*  9 total disks in the raid set             */
        __u32 raid_disks;       /* 10 disks in a fully functional raid set    */

taken from a RAID 1 with 1 disk removed:

# mdadm -Q --detail /dev/md0

  Raid Level : raid1
  Raid Devices : 2
  Total Devices : 1

    Number   Major   Minor   RaidDevice State
       0       0        0        0      removed
       1       8       49        1      active sync   /dev/sdd1



GRUB raid.mod currently uses the "Total Devices : 1" field for it's
total number of disks.

So GRUB checks in my case above only the first removed disk of the
array.

On my raid1 this means it fails to read valid data at all.
For raid 0 and 5 you need the whole disk count in the array not only the
attached ones to calculate from which disk should be read.

Attached little patch fixes this problem.
This has been already fixed upstream by Bean with his complete RAID
overhaul.

-- 
Felix Zielcke'

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 02_mdraid_sb_raid_disks.diff
Type: text/x-patch
Size: 417 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20080825/c02e8dc0/attachment.bin 


More information about the Pkg-grub-devel mailing list