summaryrefslogtreecommitdiff
path: root/sbin/pdisk/README
blob: aeda6d7405b66184dd0ddaa344a19cb8063903fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
Product name:	pdisk
Version:	0.7
Ship date:	18 February 1998
Company name:	Apple Computer
Author name:	Eryk Vershen <eryk@apple.com>

Description:	A low-level Apple partition table editor for (Mk)Linux.
		A MacOS version exists for "standalone" use.

What's New:	Added support for ATA/IDE disks without LBA capability
		Fixed bug - create partition with unmodified size failed
		Added support for new (DR3) MkLinux names - show MkLinux
		name when displaying under another name and allow the
		MkLinux name to be used on input.

Last time:	MacOS version handles IDE/ATA and ATAPI devices.
		Added interactive mode
		Added ability to rename a partition
		Added 68k target to MacOS CodeWarrior project
		
Requirements:	MkLinux - just run the binary
		Linux -	recompile for your hardware
		MacOS - Distributed binaries for PowerPC or 68000
			I haven't tried it except on 7.6.1 and 8.0

Price:		Free

Legalese:	
    Copyright 1996,1997,1998 by Apple Computer, Inc.
    All Rights Reserved 

    Permission to use, copy, modify, and distribute this software and 
    its documentation for any purpose and without fee is hereby granted, 
    provided that the above copyright notice appears in all copies and 
    that both the copyright notice and this permission notice appear in 
    supporting documentation. 

    APPLE COMPUTER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
    INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
    FOR A PARTICULAR PURPOSE. 

    IN NO EVENT SHALL APPLE COMPUTER BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
    CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
    LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
    NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 


Contact Info:	Go to <http://www.mklinux.apple.com> to find out about MkLinux.
		Go to the Faq-O-Matic (there should be a pointer or three
		in the MkLinux pages) and search for 'pdisk'.
		You can send mail to the author. There is  no guarantee of
		a response, but it is your best hope of getting a bug fixed
		or a feature added.


Other info:


READ the html file or the man page.


Finding out about apple partitioning
------------------------------------
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.
		

Building the macintosh application
----------------------------------
I have only built this under Code Warrior Pro.  The project file is included.
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
most devices use a partitioning block size of 512 bytes.
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.
Bootable CD-ROMs have even stranger partition maps since two are laid down:
one at 2K offsets and one at 512-byte offsets.  If you notice that these
overlap then you begin to get an idea of how weird these maps can be.

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 vershen
 software mechanic

 work:      eryk@apple.com
 non-work:  eryk@cfcl.com