Bug 510476

Summary: "msftres" flag bug in GNU Parted while using GPT disk
Product: [Fedora] Fedora Reporter: Keshav Amburay <the.ridikulus.rat>
Component: partedAssignee: Joel Andres Granados <jgranado>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: 11CC: jgranado
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-13 12:45:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Keshav Amburay 2009-07-09 12:30:33 UTC
Description of problem:

Please correct the "msftres" flag bug in libparted by deleting the following code from (parted-source-dir)/libparted/labels/gpt.c :-

if (strncmp (fs_type->name, "fat", 3) == 0
|| strcmp (fs_type->name, "ntfs") == 0) {
gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID;
return 1;
}

The "Microsoft Reserved" Partition in GPT is needed only for conversion from a basic disk to dynamic disk in Windows. Otherwise it is not at all needed and according to Microsoft, any FAT(16,32 etc..) or NTFS partition(s) should be "Basic Data Partition" if they have to be accessible in Windows and Mac (Linux allows access even to a msftres partition).

Think of it like the 128 MB gap between partitions imposed by Mac OS X's Disk Utility in GPT disk for future usage which cannot be anticipated at present. Microsoft creates this partition for any future usage similar to the 128 MB gap.

The above mentioned code in libparted assumes that any FAT or NTFS partition must be marked as Microsoft Reserved (the same way any HFS partition must be marked Apple_HFS), but this is not correct.

This bug can be corrected by either deleting the above lines or by modifying them as follows :-

if (strncmp (fs_type->name, "fat", 3) == 0
|| strcmp (fs_type->name, "ntfs") == 0) {
gpt_part_data->type = PARTITION_BASIC_DATA_GUID;
return 1;
}

Comment 1 Keshav Amburay 2009-07-10 13:57:26 UTC
What is a Microsoft Reserved Partition?

The Microsoft Reserved Partition reserves space on each disk drive for subsequent use by operating system software. GUID Partition Table disks do not allow hidden sectors. Software components that formerly used hidden sectors now allocate portions of the Microsoft Reserved Partition for component-specific partitions. For example, converting a basic disk to a dynamic disk causes the Microsoft Reserved Partition on that disk to be reduced in size and a newly created partition holds the dynamic disk database.

Will end users see the Extensible Firmware Interface System Partition, Microsoft Reserved Partition, and OEM-specific partitions?

The user won't see these partitions exposed in Windows Explorer, nor is any recognized file system exposed to legacy programs such as Context Indexing. The Extensible Firmware Interface System Partition, OEM-specific, and other unrecognized partitions will be visible only in the Disk Management MMC snap-in.

What partitions are mounted by default by Windows?

Windows exposes only basic data partitions. Other partitions with FAT file systems may be mounted, but not exposed (only programmatically). Only basic data partitions are assigned drive letters or mount points.

The Microsoft Reserved Partition (and any partitions that are created from the Microsoft Reserved Partition) could have recognizable file systems; none are exposed.

What happens when a basic disk is converted to dynamic?

For a drive to be eligible for conversion to dynamic, all basic data partitions on the drive must be contiguous. If other unrecognized partitions separate basic data partitions, the disk cannot be converted. This is one of the reasons that the Microsoft Reserved Partition must be created before any basic data partitions.

The first step in conversion is to separate a portion of the Microsoft Reserved Partition to create the configuration database partition. All non-bootable basic partitions are then combined into a single data container partition. Boot partitions are retained as separate data container partitions. This is analogous to conversion of primary partitions.

Retrieved from http://support.microsoft.com/kb/302873 - FAQ about GPT Disk Architecture

Comment 2 Joel Andres Granados 2009-07-13 12:29:04 UTC
- Is this a regression or is it something that is present in both parted-1.8.8 and parted-1.9.0?
- Does this have to do anything with appleTV partitions?

Comment 3 Joel Andres Granados 2009-07-13 12:45:46 UTC

*** This bug has been marked as a duplicate of bug 483402 ***

Comment 4 Keshav Amburay 2009-07-13 13:37:48 UTC
(In reply to comment #3)
> 
> *** This bug has been marked as a duplicate of 483402 ***  

(In reply to comment #2)
> - Is this a regression or is it something that is present in both parted-1.8.8
> and parted-1.9.0?
> - Does this have to do anything with appleTV partitions?  

This bug does not have anything to do with AppleTV Partitions or anything else related to Fedora appletv support patch. This bug occurs because some parted developer, at some point of time, misunderstood the real need for Microsoft Reserved Partitions in GPT and added the mentioned code in gpt.c file thinking that any FAT or NTFS partition should be by default marked as msftres, which is exactly opposite to what Microsoft claims and How Windows deals with FAT and NTFS partitions in GPT. This is just a 128 MB reserved (for future use) space for converting basic disks to dynamic discs and tasks similar to that by Windows compensating for the absence of Hidden Sectors in GPT.

Comment 5 Joel Andres Granados 2009-07-14 11:33:02 UTC
Keshav:

Thx for the clarification.  Will consider this for my current work in parted.

For future comments pls use  https://bugzilla.redhat.com/show_bug.cgi?id=483402 as that one is the one being used to track this issue.