A simple editor for Apple disk partition format. There are two main versions of pdisk: one for MkLinux and one for the Mac OS. This document describes the Mac OS version of pdisk. Much of this document is also relevant to the MkLinux version, but check the manual page (pdisk.8) also.
Most operating systems have ways to divide disks into several pieces - so that an entire disk does not have to be devoted to one filesystem, or even to one operating system. This division of the disk is usually called partitioning. In some systems the partitioning information is built into the operating system code, but that tends to be restrictive. In the Mac OS the partitioning information is stored on the first few blocks of the disk.
The Apple disk partition scheme was developed in 1986 by the A/UX team with input from the Mac OS and Apple II teams. There was an earlier partition scheme used in the first SCSI drives on the MacPlus, but that was replaced by the current scheme in the Macintosh II and subsequent machines and in subsequent operating system releases. The current scheme is supported by Mac OS, A/UX, ProDos, MkLinux, and "Rhapsody".
Just in case you got pdisk not as part of an MkLinux release: MkLinux is a version of the Linux operating system, converted to run as a server process on top of the Mach microkernel. As with Linux, all of the operating system source code is available for download, including the Mach source. MkLinux runs on many of PowerPC based Macintosh machines.
The Mac OS binary should run on any PowerPC based Macintosh. It has been tested under System 7.6.1 and System 8, but should run on older versions of the Mac OS as well. A Mac OS 68000 binary is also distributed for those who may find it useful.
The main clients for the Mac OS version of pdisk are MkLinux users. pdisk was originally developed for MkLinux. The command syntax was originally identical to that for the 'fdisk' program. (fdisk is a Linux program which edits the DOS/Windows disk partition format.) The Mac OS version is a simple, crude port of the MkLinux version.
The advantages of pdisk over the various Mac OS disk partitioning programs (such as SilverLining, the FWB toolkit, Apple HD SC Setup, DriveSetup, etc) are:
The disadvantages of pdisk are:
The main site for MkLinux is <http://www.mklinux.apple.com>. As of the time this document was written you could find the pdisk distributions at <ftp://ftp.mklinux.apple.com/pub/Other_tools/pdisk/>. This includes binary distributions for MkLinux and the Mac OS, as well as a source distribution.
Though pdisk is a Macintosh program its interface is very un-Macintosh. pdisk is what is called a line-oriented program. In a line-oriented program you do things by typing on the keyboard and the program does not pay attention to the typing until the return key has been typed.
When you start up pdisk it brings up a window with some text in it. The last line of this text should be something like " Top level command (? for help): ". This is the prompt. If you type "?" followed by a return character you should get a list like this:
Notes: Disk have fake names of the form /dev/scsi<bus>.<id> For example, /dev/scsi0.1, /dev/scsi1.3, and so on. MkLinux style names are also allowed (i.e /dev/sda or /dev/hda), and these names follow the MkLinux DR3 conventions. Commands are: h print help v print the version number and release date l list device's map L list all devices' maps e edit device's map E (edit map with specified block size) r toggle readonly flag q quit the program
Some of these commands need what are called arguments - for example l (list) and e (edit) need a single argument, the name of the device to list or edit. Commands which take arguments prompt for each argument in turn. You can also type any number of the arguments separated by spaces and those prompts will be skipped. Commands are case insensitive (e.g. h and H) except when the upper case letter does a variant form of the operation.
This is a good point to show what the partition map listing looks like.
Partition map (with 512 byte blocks) on '/dev/scsi0.2' (/dev/sda) #: type name length base ( size ) 1: Apple_partition_map Apple 63 @ 1 2: Apple_Driver43*Macintosh 54 @ 64 3: Apple_Driver43*Macintosh 74 @ 118 4: Apple_Patches Patch Partition 512 @ 192 5: Apple_HFS untitled 2117430 @ 704 ( 1.0G) 6: Apple_Free Extra 10 @ 2118134 Device block size=512, Number of Blocks=2118143 DeviceType=0x0, DeviceId=0x0 Drivers- 1: @ 64 for 20, type=0x1 2: @ 118 for 32, type=0xffff
The first line indicates what device this is and what size blocks the partition map is using. Most partition maps will use 512-byte blocks, but partition maps can use 1024-byte (1K) or 2048-byte (2K) blocks instead. If we are able to deduce an MkLinux name different from the name then the MkLinux name is given in parentheses.
Next is the partition list. Each partition (or piece) of the disk takes one line of the list. The data describing the partition is called the partition map entry. The entries are listed in order by index. For each entry, the following information is displayed:
Following the partition list is information from block zero of the device which describes the location of drivers.
The e command at the top level menu opens a partition map for editing. The prompt is then changed to "Command (? for help):". If you type "?" followed by a return character you should get a list like this:
Notes: Base and length fields are blocks, which vary in size between media. The name of a partition is descriptive text. Commands are: h help p print the partition table P (print ordered by base address) i initialize partition map s change size of partition map c create new partition (standard MkLinux type) C (create with type also specified) n (re)name a partition d delete a partition r reorder partition entry in map w write the partition table q quit editing (don't save changes)
Commands which take arguments prompt for each argument in turn. You can also type any number of the arguments separated by spaces and those prompts will be skipped. The only exception to typeahead are the confirmation prompts on the i and w commands. Commands can are case insensitive (e.g. h and H) except when the upper case letter does a variant form of the operation.
Partitions are always specified by their number, which the index of the partition entry in the partition map. Many of the commands will change the index numbers of other partitions besides the affected partition. You are advised to print the table as frequently as necessary.
Creating more than fifteen partitions is not advised. There is currently a bug in the some (all?) of the kernels which causes access to the whole disk fail if more than fifteen partitions are in the map.