Subject: bug#17994: Linux RAID MBR type code

From: Chris Murphy <[email-masked]>
Date: Sun, 13 Jul 2014 19:07:24 -0600

On Jul 13, 2014, at 4:41 PM, Phillip Susi <[email-masked]> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> On 07/10/2014 07:58 PM, Chris Murphy wrote:
>> This is in master branch.
>> 
>> libparted/labels/dos.c 98	#define PARTITION_LINUX_RAID	0xfd
>> 
>> 
>> This type code and metadata version 0.9 are long deprecated.
>> Parted lacks support for the "non-fs data" partition type code
>> 0xda, which is what should be used for mdadm metadata 1.x
>> partitions.
>> 
>> man 8 mdadm: "When  creating  a partition based array, using mdadm 
>> with version-1.x metadata, the partition type should be set to
>> 0xDA (non fs-data).  This type selection allows for greater
>> precision since using any other [RAID auto-detect (0xFD) or a
>> GNU/Linux partition (0x83)], might create problems in the event of
>> array recovery through a live cdrom."
> 
> Why does it matter?  Linux doesn't pay attention to the partition type
> code anyhow.  I've always just used 0x83.

https://bugzilla.redhat.com/show_bug.cgi?id=1118065#c5
https://bugzilla.redhat.com/show_bug.cgi?id=1118065#c8

I find this logic troubling. It's rather similar to the logic that lead to parted using the pre-existing Microsoft basic data GUID when making Linux partitions on GPT disks; out of a pool of just under infinite alternative GUIDs. "Oh it doesn't really matter" on Linux, but meanwhile on dual boot systems, Windows recognizes its partitiontype GUID, but not the contents of the partition, and actively invites the user to reformat it.

For example, 0x83 partition type, and mdadm metadata 1.0 on md raid1 suggests that the partition can be mounted stand alone rather than first assembling the raid. If something actually were to do this, the array would become inconsistent and unrepairable without rather knowledgable manual intervention. A partition with md metadata is in fact not a Linux filesystem, so really we shouldn't lie about what it is by using the wrong partition type code.

Chris Murphy