Bug 154479 - disk partitioning does not recognize Apple partitions at install
Summary: disk partitioning does not recognize Apple partitions at install
Alias: None
Product: Fedora
Classification: Fedora
Component: parted
Version: 4
Hardware: powerpc
OS: Linux
Target Milestone: ---
Assignee: Chris Lumens
QA Contact: Brock Organ
Depends On:
Blocks: FC4Target
TreeView+ depends on / blocked
Reported: 2005-04-12 04:12 UTC by John Reiser
Modified: 2007-11-30 22:11 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-05-17 16:05:09 UTC
Type: ---

Attachments (Terms of Use)
cat /proc/partitions (216 bytes, text/plain)
2005-04-15 14:53 UTC, John Reiser
no flags Details
/sbin/parted /dev/hda print (611 bytes, text/plain)
2005-04-15 14:54 UTC, John Reiser
no flags Details
dmesg | grep hda (467 bytes, text/plain)
2005-04-15 14:54 UTC, John Reiser
no flags Details

Description John Reiser 2005-04-12 04:12:44 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050302 Firefox/1.0.1 Fedora/1.0.1-1.3.2

Description of problem:
Disk partitioning does not recognize existing Apple partitions properly when attempting to install on Apple MacMini using FC4-test2-DVD-ppc.iso.  Diskdruid says there are 2 partitions: Free space (128MB start=1 end=17), and Foreign (38026MB start=17 end=4864).  fdisk /dev/hda [Ctrl-Alt-F2 for shell] says "Device contains neither a valid DOS partition table, nor Sun, SGI, or OSF disklabel[.]  Building a new DOS disklabel."

Both of these are incorrect.  The correct layout is given by "sudo /sbin/fdisk" from Ubuntu-5.04-live-powerpc.iso ("Hoary Hedgehog" release):
/dev/hda1 type=Apple_partition_map name=Apple length=63 base=1
/dev/hda2 type=Apple_Free length=262144 base=64 (128.0M)
/dev/hda3 type=Apple_HFS name=Untitled length=77877942 base=262208 (37.1G)
/dev/hda4 type=Apple_Free length=10 base=78140150 (5.0K)

[Apple DiskUtility from the Apple Install DVD sees only one partition of 37.14GB, formatted Mac OS Extended (Journaled)]

So: FC4t2 fdisk cannot be trusted at all, and DiskDruid is also untrustworthy.  These are "show stoppers" that prevent install, because I must multiboot Mac OS X and FC4.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Boot FC4-test2-DVD-ppc on Apple MacMini (Mac OS X 10.3, "40GB" disk.)
2. Accept defaults and/or Next until Partitioning; choose Manual partitioning with DiskDruid.
3. Note only 2 partitions displayed.
4. Ctrl-Alt-F2 for shell; invoke "fdisk /dev/hda" then enter "p\r" to print partition table.  Note warning about no partition table.


Actual Results:  Incorrect display of existing Apple partitioning.

Expected Results:  Correct display of existing Apple partitioning.

Additional info:

Comment 1 Jeremy Katz 2005-04-12 15:13:12 UTC
You should use parted, not fdisk.

Comment 2 John Reiser 2005-04-12 16:04:46 UTC
parted shows only 2 partitions:
  minor=1 start=0.000   end=0.031                     name=Apple
  minor=3 start=128.031 end=38154.370 filesystem=HFS+ name=Untitled
which is missing (or has omitted deliberately) the two Apple_Free partitions that
are shown by Ubuntu.  I wonder if this is reliable.

Comment 3 Karel Zak 2005-04-15 12:42:03 UTC
Please, send the result from "cat /proc/partitions".

Do you have some information about 'hda' in 'dmesg' output? For example I have:

# dmesg | grep hda
    ide0: BM-DMA at 0xf000-0xf007, BIOS settings: hda:DMA, hdb:DMA
hda: ST360015A, ATA DISK drive
hda: max request size: 128KiB
hda: 117231408 sectors (60022 MB) w/2048KiB Cache, CHS=65535/16/63, UDMA(100)
 hda: hda1 hda2 < hda5 hda6 hda7 hda8 >

Comment 4 John Reiser 2005-04-15 14:53:00 UTC
Created attachment 113224 [details]
cat /proc/partitions

This is as reported from a running installed FC4t2.  Sequence was: use Apple
Disk Utility to create scheme "3 partitions" which actually gives 5: Apple
label (31KB), Apple Free (128KB), hfs+ (26GB as adjusted by me), Apple Free
(1GB as adjusted by me),
Apple Free (10.8GB as adjusted by me).	Then re-install Mac OS X from Apple

Then use FC4-test2-DVD-ppc to install.	Disk Druid sees 3 partitions: Free
(256KB), "Foreign" (26GB), Free (11.8GB).  Note that last two Apple Free
partitions have been reported together as a single Free space:	OK, I guess,
not what is seen by other tools.

Then I ask for 1GB swap, then 10GB root, then "commit."  Disk Druid interrupts
to require 1MB Apple_Bootstrap, which I do.  The Disk Druid map now shows:
/dev/hda2  1MB	Apple Bootstrap
Free	   127MB
/dev/hda3  26GB  Foreign
/dev/hda4  10.8GB ext3 / [root]
/dev/hda5  1GB	swap
and I proceed with installation.

Comment 5 John Reiser 2005-04-15 14:54:05 UTC
Created attachment 113225 [details]
/sbin/parted /dev/hda print

As reported after install of FC4-test2-DVD-ppc.

Comment 6 John Reiser 2005-04-15 14:54:59 UTC
Created attachment 113227 [details]
dmesg | grep hda

As reported after install of FC4-test2-DVD-ppc.

Comment 7 Karel Zak 2005-04-18 11:35:51 UTC
a) fdisk man: "It understands DOS type partition tables and BSD or SUN type
disklabels". It means it's fdisk feature and you should use the parted command.

b) It isn't bug that the parted command skips "Apple_Free" partitions. It's
strange feature. I'm sure that the parted command is reliable and you can use it.

For example SUSE disable this "feature" and they use follow patch:

--- libparted/disk_mac.c
+++ libparted/disk_mac.c        2003/03/17 13:54:22
@@ -422,8 +422,6 @@
        if (_rawpart_cmp_type (raw_part, "Apple_Void"))
                return 0;
-       if (_rawpart_cmp_type (raw_part, "Apple_Free"))
-               return 0;
        if (_rawpart_cmp_type (raw_part, "Apple_Scratch"))
                return 0;
        if (_rawpart_cmp_type (raw_part, "Apple_Extra"))

... re-assign to parted maintainer. I think we can use this patch too.

Comment 8 Chris Lumens 2005-04-28 14:12:35 UTC
John - What are the names of the Apple_Free partitions as reported by the Ubuntu

Comment 9 John Reiser 2005-04-28 14:54:51 UTC
Today I see
-----Ubuntu 5.04  parted /dev/hda
Disk geometry for /dev/hda: 0.000-38154.375 megabytes
Disk label type: mac
Minor    Start       End     Filesystem  Name                  Flags
1          0.000      0.031              Apple
2          0.031      1.031  hfs         untitled              boot
3        128.031  26307.386  hfs+        Apple_HFS_Untitled_2
4      26307.387  37131.375  ext3        untitled
5      37131.375  38154.375  linux-swap  swap                  swap
where minor 1 is the Mac "partition table", minor 2 is Yellow Dog bootstrap,
1.031 to 128.031 is special free space that is reserved for disk drivers [mostly
for SCSI, USB, FireWire, etc.; unused for IDE], minor 3 is MacOS X, minor 4 is
FC4, minor 5 is swap.

I also see
-----Ubuntu 5.04  fdisk /dev/hda
Command (? for help): /dev/hda
        #                    type name                 length   base     ( size
)  system
/dev/hda1     Apple_partition_map Apple                    63 @ 1        (
31.5k)  Partition map
/dev/hda2         Apple_Bootstrap untitled               2048 @ 64       ( 
1.0M)  NewWorld bootblock
/dev/hda3               Apple_HFS Apple_HFS_Untitled_2 53615320 @ 262208   (
25.6G)  HFS
/dev/hda4         Apple_UNIX_SVR2 untitled           22167528 @ 53877528 (
10.6G)  Linux native
/dev/hda5         Apple_UNIX_SVR2 swap                2095104 @ 76045056
(1023.0M)  Linux swap
/dev/hda6              Apple_Free Extra                260096 @ 2112    
(127.0M)  Free space
Block size=512, Number of Blocks=78140160
DeviceType=0x0, DeviceId=0x0
which might be better.

Comment 10 John Reiser 2005-04-28 15:01:25 UTC
I recall that "Apple_Free" was the type given for minor 4 and minor 5 [what was
to  become FC4 root and swap] just after using Apple Disk Utility to repartition
the disk into "3 partitions" [the actual menu choice in the Apple software].

Comment 11 Chris Lumens 2005-04-28 17:58:26 UTC
Upstream parted has been patched to skip Apple_Free partitions with a name of
Extra, but not other Apple_Free partitions.  In addition, Andrew (the parted
maintainer) indicates that most Apple_Free partitions should be skipped because
they just indicate free space.

Comment 12 John Reiser 2005-04-28 18:20:49 UTC
No actual partition should be skipped.  That is, the structure that is present
on disk should be displayed "as is".  If there are two consecutive Apple_Free
partitions, then the list should have two consecutive lines, one for each
partition.  Do not collapse down to one line of "Free space"; do not omit entirely.

Why?  For best-possible reliability, and disaster avoidance.  Disk partitioning
is  frought with peril; errors and misunderstandings are frequently
un-recoverable.  When a tool "interprets" the actual on-disk structure by
displaying something else, then that is the number one source of errors.  The
tool's interpretation cannot be as up-to-date as the user's actual usage.  There
is no substitute for showing the actual on-disk structure.

Comment 13 Karel Zak 2005-04-29 09:01:21 UTC
I definitely agree with John. It is user who has brain... The information about
partitions is pretty important and there's no place any "interpretation" or
pseudo-intellect by software.

Comment 14 Andrew Clausen 2005-05-02 22:00:03 UTC
I disagree with both Karel and John.

Unless users have been reading manuals about how partition tables work, they are
unlikely to know which partitions are safe to delete, and which ones aren't. 
Especially in the Mac case.

An objective of Parted is to make partitioning look the same, regardless of the
platform.  This means users don't need to learn any boring details, and it also
means that installers can autopartition without needing any special rules for
each architecture.

Support for free-space partitions could not be added to libparted without major
API changes.

Comment 15 John Reiser 2005-05-02 22:42:29 UTC
If the disk partitioning tool does not have an option to give an
"un-interpreted" readout of the existing on-disk partitioning scheme, then that
tool is worse than no-good.  It simply cannot be trusted by an expert user, and
a user with valuable data tends to become an expert at preserving the data. 
[Yes, I took _another_ backup just before partitioning; but the restore process
takes an hour or more, and that time is expensive.]

Perhaps you can "sugar coat" the usual readout for casual/infrequent users
and/or other programs, but please provide an option to printout the existing
"raw" scheme, nicely formatted, with as little "massaging" as possible.  In
fact, being able to compare the "raw" report with the "massaged" report is
exceedingly useful.

Comment 16 Chris Lumens 2005-05-17 16:05:09 UTC
In keeping with our strategy of tracking upstream as closely as possible, I have
merged Andrew's patch as described above from CVS into our parted package,
version 1.6.22-2.  If this behavior is not what you think is correct, please try
to convince upstream and I will merge in whatever patches he makes along these

Note You need to log in before you can comment on or make changes to this bug.