gparted/include
Mike Fleetwood 5f02bcf463 Detect Linux SWRaid members by querying mdadm (#756829)
Detection of Linux SWRaid members currently fails in a number of cases:

1)  Arrays which use metadata type 0.90 or 1.0 store the super block at
    the end of the partition.  So file system signatures in at least
    linear and mirrored arrays occur at the same offsets in the
    underlying partitions.  As libparted only recognises file systems
    this is what is detected, rather than an SWRaid member.

    # mdadm -E -s -v
    ARRAY /dev/md/1  level=raid1 metadata=1.0 num-devices=2 UUID=15224a42:c25bbcd9:15db6000:4e5fe53a name=chimney:1
       devices=/dev/sda1,/dev/sdb1
    ...
    # wipefs /dev/sda1
    offset               type
    ----------------------------------------------------------------
    0x438                ext4   [filesystem]
                         LABEL: chimney-boot
                         UUID:  10ab5f7d-7d8a-4171-8b6a-5e973b402501

    0x1fffe000           linux_raid_member   [raid]
                         LABEL: chimney:1
                         UUID:  15224a42-c25b-bcd9-15db-60004e5fe53a

    # parted /dev/sda print
    Model: ATA VBOX HARDDISK (scsi)
    Disk /dev/sda: 34.4GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number  Start   End     Size    Type      File system  Flags
     1      1049kB  538MB   537MB   primary   ext4         boot, raid
    ...

2)  Again with metadata type 0.90 or 1.0 arrays blkid may report the
    contained file system instead of an SWRaid member.  Have a single
    example of this configuration with a mirrored array containing the
    /boot file system.  Blkid reports one member as ext4 and the other as
    SWRaid!

    # blkid | egrep 'sd[ab]1'
    /dev/sda1: UUID="10ab5f7d-7d8a-4171-8b6a-5e973b402501" TYPE="ext4" LABEL="chimney-boot"
    /dev/sdb1: UUID="15224a42-c25b-bcd9-15db-60004e5fe53a" UUID_SUB="0a095e45-9360-1b17-0ad1-1fe369e22b98" LABEL="chimney:1" TYPE="linux_raid_member"

    Bypassing the blkid cache gets the correct result.

    # blkid -c /dev/null /dev/sda1
    /dev/sda1: UUID="15224a42-c25b-bcd9-15db-60004e5fe53a" UUID_SUB="d0460f90-d11a-e80a-ee1c-3d104dae7e5d" LABEL="chimney:1" TYPE="linux_raid_member"

    However this can't be used because if a user has a floppy configured
    in the BIOS but no floppy attached, GParted will wait for minutes as
    the kernel tries to access non-existent hardware on behalf of the
    blkid query.  See commit:
        18f863151c
        Fix long scan problem when BIOS floppy setting incorrect

3)  Old versions of blkid don't recognise SWRaid members at all so always
    report the file system when found.  Occurs with blkid v1.0 on
    RedHat / CentOS 5.

The only way I can see how to fix all these cases is to use the mdadm
command to query the configured arrays.  Then use this information for
first choice when detecting partition content, making the order: SWRaid
members, libparted, blkid and internal.

GParted shell wrapper already creates temporary blank udev rules to
prevent Linux Software RAID arrays being automatically started when
GParted refreshes its device information[1].  However an administrator
could manually stop or start arrays or change their configuration
between refreshes so GParted must load this information every refresh.
On my desktop with 4 internal hard drives and 3 testing Linux Software
RAID arrays, running mdadm adds between 0.20 and 0.30 seconds to the
device refresh time.

[1] a255abf343
    Prevent GParted starting stopped Linux Software RAID arrays (#709640)

Bug 756829 - SWRaid member detection enhancements
2015-11-02 10:03:45 -07:00
..
.cvsignore added *.swp some modifications to pass 'make distcheck' minor cleanups 2005-11-25 12:59:47 +00:00
Copy_Blocks.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
DMRaid.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
Device.h Display device serial numbers (#751251) 2015-07-01 10:22:47 -06:00
DialogFeatures.h Make the File System Support dialog resizable (#342682) 2014-01-27 10:54:48 -07:00
DialogManageFlags.h Stop copying selected partition object in Manage Flags dialog (#750168) 2015-06-10 10:44:33 -06:00
Dialog_Base_Partition.h Rename Dialog_Base_Partition member to new_partition 2015-06-10 10:44:33 -06:00
Dialog_Disklabel.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
Dialog_FileSystem_Label.h Rename class to Dialog_FileSystem_Label (#741424) 2015-02-01 10:08:23 -07:00
Dialog_Partition_Copy.h Remove Set_Data() from the copy, resize/move and new dialog class APIs 2015-06-10 10:44:33 -06:00
Dialog_Partition_Info.h Stop copying selected partition object in Information dialog (#750168) 2015-06-10 10:43:43 -06:00
Dialog_Partition_Name.h Make support of naming for other partition table types possible (#746214) 2015-03-25 10:02:42 -06:00
Dialog_Partition_New.h Remove Set_Data() from the copy, resize/move and new dialog class APIs 2015-06-10 10:44:33 -06:00
Dialog_Partition_Resize_Move.h Remove Set_Data() from the copy, resize/move and new dialog class APIs 2015-06-10 10:44:33 -06:00
Dialog_Progress.h Change OperationDetail to not store complex objects in STL containers (#729139) 2014-05-18 10:07:45 -06:00
Dialog_Rescue_Data.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
DrawingAreaVisualDisk.h Store pointers to partition objects in DrawingAreaVisualDisk (#750168) 2015-06-10 10:43:14 -06:00
FS_Info.h Workaround older blkid not distinguishing between FAT16 and FAT32 (#743181) 2015-03-09 11:04:13 -06:00
FileSystem.h Remove unused public member variable FileSystem::success 2015-09-21 10:11:19 -06:00
Frame_Resizer_Base.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
Frame_Resizer_Extended.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
GParted_Core.h Create new method GParted_Core::useable_device() (#755495) 2015-10-08 13:00:01 -06:00
HBoxOperations.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
LVM2_PV_Info.h Display list of Logical Volumes in the Partition Information dialog (754649) 2015-09-15 20:12:12 +01:00
Makefile.am Detect Linux SWRaid members by querying mdadm (#756829) 2015-11-02 10:03:45 -07:00
Operation.h Replace Operation class members index and index_extended with local variables (#755214) 2015-09-28 11:02:07 -06:00
OperationChangeUUID.h Encapsulate operation merging inside the Operation* classes (#755214) 2015-09-28 10:41:39 -06:00
OperationCheck.h Encapsulate operation merging inside the Operation* classes (#755214) 2015-09-28 10:41:39 -06:00
OperationCopy.h Encapsulate operation merging inside the Operation* classes (#755214) 2015-09-28 10:41:39 -06:00
OperationCreate.h Encapsulate operation merging inside the Operation* classes (#755214) 2015-09-28 10:41:39 -06:00
OperationDelete.h Encapsulate operation merging inside the Operation* classes (#755214) 2015-09-28 10:41:39 -06:00
OperationDetail.h Change OperationDetail to not store complex objects in STL containers (#729139) 2014-05-18 10:07:45 -06:00
OperationFormat.h Encapsulate operation merging inside the Operation* classes (#755214) 2015-09-28 10:41:39 -06:00
OperationLabelFileSystem.h Encapsulate operation merging inside the Operation* classes (#755214) 2015-09-28 10:41:39 -06:00
OperationNamePartition.h Encapsulate operation merging inside the Operation* classes (#755214) 2015-09-28 10:41:39 -06:00
OperationResizeMove.h Encapsulate operation merging inside the Operation* classes (#755214) 2015-09-28 10:41:39 -06:00
Partition.h Add whole_device flag to the partition object (#743181) 2015-03-09 11:04:13 -06:00
PipeCapture.h Prevent cross thread write after free in _OnReadable() (#731752) 2014-07-06 10:22:40 -06:00
Proc_Partitions_Info.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
SWRaid_Info.h Detect Linux SWRaid members by querying mdadm (#756829) 2015-11-02 10:03:45 -07:00
TreeView_Detail.h Store pointers to partition objects in TreeView_Details (#750168) 2015-06-10 10:43:14 -06:00
Utils.h Implement shell style exit status decoding (#754684) 2015-09-21 10:11:19 -06:00
Win_GParted.h Stop including removed <sigc++/class_slot.h> header (#756035) 2015-10-05 10:14:35 -06:00
btrfs.h Support changing the UUID of a btrfs file system (#751337) 2015-06-28 10:57:58 -06:00
exfat.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
ext2.h Check for e4fsprogs commands for ext4 support on RHEL/CentOS 5.x (#738706) 2014-10-27 09:32:36 -06:00
f2fs.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
fat16.h Remove prohibited characters from FAT16/32 labels (#755608) 2015-10-04 09:57:07 -06:00
hfs.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
hfsplus.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
i18n.h Make include guards unique (#539297) 2013-06-05 10:57:39 -06:00
jfs.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
linux_swap.h Add const qualifier to get_custom_text() member functions 2015-05-19 10:34:59 -06:00
lvm2_pv.h Add const qualifier to get_custom_text() member functions 2015-05-19 10:34:59 -06:00
nilfs2.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
ntfs.h Add const qualifier to get_custom_text() member functions 2015-05-19 10:34:59 -06:00
reiser4.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
reiserfs.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
ufs.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
xfs.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00