Skip to content

bfranske/hfdisk

Repository files navigation

README for pdisk	(9 January 1997)
================

This file accompanies version 0.4 of pdisk.

pdisk is a partition table editor for (Mk)Linux which understands the
Apple disk partitioning format.

Version 0.4 is the second version of pdisk in general distribution.
(Version 0.3 was the first general distribution.) The author of pdisk
is Eryk Vershen ([email protected]).  Any questions, comments, suggestions,
etc. can be sent via email.  I can't guarantee a response, but I'll try.

Please read the man page.  (man ./pdisk.8)

The best curently available documentation on the Apple disk partitioning scheme
is "Inside Macintosh: Devices" pages 3-12 to 3-15 combined with the info
in "Inside Macintosh - Volume V" pages V-576 to V-582.  This, unfortunately,
does not cover everything.

I have also enclosed modified sources for fdisk, which do not have the
byte order problem.  These are derived from the sparc patches (but contain
none of the sun disk label stuff) in the the latest package I found
util-linux-2.5-26.src.rpm, which I got from the RedHat 4.0
distribution.


Building the macintosh application
----------------------------------
I have only built this under Code Warrior 10.  The project file is
included.  The project stationery was 'MacOS:C/C++:ANSI Console PPC'.
Thanks to Martin Minow for the SCSI support code.


Some notes on the apple partitioning
------------------------------------
The apple disk partitioning scheme was developed in 1986. It attempted to
be forward thinking as it was intended to handle drives of sizes up to several
hundred megabytes.  There was a design document, but like most such documents
it was neither complete nor unambiguous.

While the original intent was to handle various block sizes, in practice
only 512 byte blocks are supported.  Since the various address fields are
32 bits unsigned this means the format can handle disks up to 2 Terabytes
in size.  (32bits + 9 bits = 41 bits)
Because the format was designed around SCSI, there is no knowledge of
cylinders or heads, all block address are in absolute sector form.
A correct map should describe every block on the disk except for block zero.

An aside on CDROMs.  Most old apple CDROMs have incorrect data in block zero.
Since the HFS file-system could only handle 512 byte blocks, apple drives had
a special mode where they would do deblocking (i.e. converting 2k blocks
into four 512byte blocks and accepting 512byte block addresses.)  The partition
maps laid down on these disks are for the deblocked form.  In many cases the
partition maps they contain have only the minimum number of fields correct.
At least one CDROM I have seen doesn't even contain a partition map at all,
but is simply an HFS volume.

The documentation in Inside Macintosh is only partially correct.
The boot-arguments field was left out.  A/UX used the boot arguments field
for something that was called the bzb (block zero block - don't ask me why).
This structure evolved over the course of A/UX.  I have recapitulated this
in the dpme.h header file.


Making a disk with Apple & Intel partitioning
---------------------------------------------
Don't cringe. I know it is an awful hack, but sometimes...
While I don't recommend doing this, it can be useful.
The procedure below is what we did.

The intel map can contain NO MORE THAN FOUR PRIMARY PARTITIONS.
You can't have any extended or logical partitions.  (Well, you might get it
to work but I wouldn't want to try it.)  The disk will NOT BE INTEL BOOTABLE.

1) Use pdisk to initialize an apple partition map.  Don't add any partitions
   yet, just write the map out and quit.

2) Use fdisk to create the primary partitions.  Go into the expert 'x' menu
   in fdisk and print out the table with the sector addresses.  Write the
   start and lengths down some where.  Write the table out.

3) Use pdisk again.  Shrink the partition map down, if necessary, so it
   does not overlap any intel partition.  Create an apple partition for each
   intel partition using the start and length value you got from fdisk.
   Write out the map and quit.

At present file systems are not compatible between Linux & MkLinux, but you
can tar stuff into these partitions and tar them out on another machine.



Good luck,

-eryk
 software mechanic
 [email protected]