Debian Bug report logs - #441033
parted breaks GPT/MBR hybrid system (Intel Mac)

version graph

Package: parted; Maintainer for parted is Parted Maintainer Team <parted-maintainers@alioth-lists.debian.net>; Source for parted is src:parted (PTS, buildd, popcon).

Reported by: "Debian Live user" <hramrach@centrum.cz>

Date: Thu, 6 Sep 2007 09:36:07 UTC

Severity: normal

Found in versions parted/1.7.1-5.1, parted/1.8.8.git.2008.03.24-11

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Parted Maintainer Team <parted-maintainers@lists.alioth.debian.org>:
Bug#441033; Package parted. (full text, mbox, link).


Acknowledgement sent to "Debian Live user" <hramrach@centrum.cz>:
New Bug report received and forwarded. Copy sent to Parted Maintainer Team <parted-maintainers@lists.alioth.debian.org>. (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: "Debian Live user" <hramrach@centrum.cz>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: parted: breaks Intel Mac partitions
Date: Thu, 06 Sep 2007 11:35:19 +0000
Package: parted
Version: 1.7.1-5.1
Severity: normal


There are several problems with parted on intel macs.

First, these have actually two partitions tables, GPT and MBR.

Unlike *fdisk parted displays the GPT partition and allows to edit it.
However, it removes partition from both tables but only adds them to GPT
so the two tables have to be synchronized with other tools.

Also the partition that is created with parted has the flag 'msftres'
that cannot be removed. This flag makes most OS X tools ignore the
partition.  This is probably caused by parted setting the type of the
partition to MS Reserved. The type cannot be displayed or changed in
parted, or at least I could not figure out which command would at least
display it.


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.21-2-486
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages parted depends on:
ii  libc6                     2.6-2          GNU C Library: Shared libraries
ii  libncurses5               5.6+20070716-1 Shared libraries for terminal hand
ii  libparted1.7-1            1.7.1-5.1      The GNU Parted disk partitioning s
ii  libreadline5              5.2-3          GNU readline and history libraries

parted recommends no packages.

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, Parted Maintainer Team <parted-maintainers@lists.alioth.debian.org>:
Bug#441033; Package parted. (Thu, 30 Oct 2008 13:36:03 GMT) (full text, mbox, link).


Acknowledgement sent to Osamu Aoki <osamu@debian.org>:
Extra info received and forwarded to list. Copy sent to Parted Maintainer Team <parted-maintainers@lists.alioth.debian.org>. (Thu, 30 Oct 2008 13:36:04 GMT) (full text, mbox, link).


Message #10 received at 441033@bugs.debian.org (full text, mbox, reply):

From: Osamu Aoki <osamu@debian.org>
To: 441033@bugs.debian.org, 441033-submitter@bugs.debian.org
Subject: parted does not undestand GPT/MBR hybrid
Date: Thu, 30 Oct 2008 22:30:50 +0900
found 441033 1.8.8.git.2008.03.24-11
retitle 441033 parted breaks GPT/MBR hybrid system (Intel Mac)
thanks

Hi,

When updating GPT partition table, parted assumes system is pure EFI
booted with GUID partition table (GPT).  This is not the case for Intel
Mac or other newer MOBO if the user wishes to use BIOS emulation.

parted has 2 problems here:
 * It erase first 444=(512-2-64-2) bytes where classic MBR bootloader is
   installed. --> It should preserve it (at least when hybrid partition
   is found)
 * It erases partition data for /dev/sda2, /dev/sda4, and /dev/sda4
   stored in the last part of MBR.  --> It should update it following
   updated GPT data like gptsync does for hybrid partition.

I suggest to add one more mklabel option: something like "gpt-hybrid"

For system with matching initial partition tables between GPT and MBR,
assume it as "gpt-hybrid".  

For system with non-zero byte at the first byte of disk with GPT, ask
user about updating MBR contents if it is not in sync.

For "gpt-hybrid" system, never over write first 444=(512-2-64-2) bytes
and always update last 64+2 bytes by GPT configuration just like gptsync
in refit source package does.  (I guess borrowing it into parted is good
idea.)

For people looking for workaround for debian-installer, see
  http://wiki.debian.org/MacBook/DebianInstallTutorial

As for the original bug reporter's complain that partition type is the
same as windows, it seems it is by design.  As I see 
  http://en.wikipedia.org/wiki/GUID_Partition_Table
under "Partition entries (LBA 2–33)", both OS uses "Partition type GUID"
 EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
Thus no way to distinguish them apart.  If the original reporter does
not like message given by other partitioning tools such as gptsync
reporting it as "EFI System (FAT)", he needs to complain to that
program.  msftres seems to be some macOS thingy though.

Cheers,

Osamu




Bug marked as found in version 1.8.8.git.2008.03.24-11. Request was from Osamu Aoki <osamu@debian.org> to control@bugs.debian.org. (Thu, 30 Oct 2008 13:36:08 GMT) (full text, mbox, link).


Changed Bug title to `parted breaks GPT/MBR hybrid system (Intel Mac)' from `parted: breaks Intel Mac partitions'. Request was from Osamu Aoki <osamu@debian.org> to control@bugs.debian.org. (Thu, 30 Oct 2008 13:36:08 GMT) (full text, mbox, link).


Message sent on to "Debian Live user" <hramrach@centrum.cz>:
Bug#441033. (Thu, 30 Oct 2008 13:36:11 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Parted Maintainer Team <parted-maintainers@lists.alioth.debian.org>:
Bug#441033; Package parted. (Thu, 30 Oct 2008 14:27:03 GMT) (full text, mbox, link).


Acknowledgement sent to Osamu Aoki <osamu@debian.org>:
Extra info received and forwarded to list. Copy sent to Parted Maintainer Team <parted-maintainers@lists.alioth.debian.org>. (Thu, 30 Oct 2008 14:27:14 GMT) (full text, mbox, link).


Message #22 received at 441033@bugs.debian.org (full text, mbox, reply):

From: Osamu Aoki <osamu@debian.org>
To: 441033@bugs.debian.org, 441033-submitter@bugs.debian.org
Subject: parted does not undestand GPT/MBR hybrid
Date: Thu, 30 Oct 2008 23:24:17 +0900
Hi,

Excuse me.  I took a look at more carefully...

As for the original bug reporter's complain that "partition type of linux
is wong" is correct.  As I use gptsync
osamu@snoopy:~$ sudo gptsync /dev/sda

Current GPT partition table:
 #      Start LBA      End LBA  Type
 1             40       409639  EFI System (FAT)
 2         409640     33701927  Mac OS X HFS+
 3       33964072    100810791  EFI System (FAT)
 4      101072936    134365223  EFI System (FAT)
 5      134627368    142753831  EFI System (FAT)
 6      143015976    147210279  Basic Data
 7      147210280    156301447  Linux Swap

Current MBR partition table:
 # A    Start LBA      End LBA  Type
 1              1       409639  ee  EFI Protective
 2         409640     33701927  af  Mac OS X HFS+
 3 *     33964072    100810791  83  Linux
 4      101072936    134365223  83  Linux

Status: Tables are synchronized, no need to sync.

As I check gptsync source and http://en.wikipedia.org/wiki/GUID_Partition_Table

 "Partition type GUID"                   gptsync
 C12A7328-F81F-11D2-BA4B-00A0C93EC93B   "EFI System (FAT)"
 EBD0A0A2-B9E5-4433-87C0-68B6B72699C7   "Basic Data" <<< This is for linux/windows data

As I see parted source for gpt.c, it looks right

#define PARTITION_BASIC_DATA_GUID \
    ((efi_guid_t) { PED_CPU_TO_LE32 (0xEBD0A0A2), PED_CPU_TO_LE16 (0xB9E5), \
                    PED_CPU_TO_LE16 (0x4433), 0x87, 0xC0, \

Then I realized what OP meant by msftres.

But following looks strange:
        if (fs_type) {
                if (strncmp (fs_type->name, "fat", 3) == 0
                    || strcmp (fs_type->name, "ntfs") == 0) {
                        gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID;
                        return 1;
                }
...
                        gpt_part_data->type = PARTITION_BASIC_DATA_GUID;

Also I am not sure why there is no ext2/ext3.  If it is designed to pass this section, then 
gpt_part_data->type = PARTITION_BASIC_DATA_GUID;???  So parted should
set ext2/et3 to EBD0A0A2-B9E5-4433-87C0-68B6B72699C7   "Basic Data"
instead.  There is something funny...

Cheers,

Osamu




Message sent on to "Debian Live user" <hramrach@centrum.cz>:
Bug#441033. (Thu, 30 Oct 2008 14:27:16 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Parted Maintainer Team <parted-maintainers@lists.alioth.debian.org>:
Bug#441033; Package parted. (Fri, 31 Oct 2008 12:18:05 GMT) (full text, mbox, link).


Acknowledgement sent to Osamu Aoki <osamu@debian.org>:
Extra info received and forwarded to list. Copy sent to Parted Maintainer Team <parted-maintainers@lists.alioth.debian.org>. (Fri, 31 Oct 2008 12:18:05 GMT) (full text, mbox, link).


Message #30 received at 441033@bugs.debian.org (full text, mbox, reply):

From: Osamu Aoki <osamu@debian.org>
To: 441033@bugs.debian.org, 441033-submitter@bugs.debian.org
Subject: msftres (parted does not undestand GPT/MBR hybrid)
Date: Fri, 31 Oct 2008 21:14:16 +0900
Hi,

I looked into msftres issue.  I was a bit confused.  Now that I realize
OP was talking about flag: msftres.  In my case it is not set.  I can
set/reset it with type command.  So I see no issue.

As for my memo on Type reported by gptsync (based on Partition type
GUIDs), it seems wikipedia description is confusing.  Linux ext2
partition with this partition type set to EFI System (FAT) works best
with gptsync.  If I set this GUID to Linux Data partition GUID: 
   EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
using hex editor then gptsync did not like it.  So this choice of GUID
value of  EFI System (FAT) = C12A7328-F81F-11D2-BA4B-00A0C93EC93B must
be intentional one.  (It is somewhat uneasy but it works.)

In conclusion, problem on MacBook (Intel Mac) is handling of hybrid
MBR/GPT.  Thus inclusion of gptsync code and not zapping initial
444bytes are the key here.

Osamu




Message sent on to "Debian Live user" <hramrach@centrum.cz>:
Bug#441033. (Fri, 31 Oct 2008 12:18:06 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Jan 14 02:14:07 2024; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.