Reduce amount of macro magic. Use the same special characters as nroff
[netbsd-mini2440.git] / dist / pdisk / pdisk.html
blob80cfadcc6cfaac6091c1f81040ce2e68e56cf0b1
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN//2.0">
2 <HTML>
3 <HEAD>
4 <TITLE>pdisk for the Mac OS</TITLE>
5 <X-SAS-WINDOW TOP=42 BOTTOM=477 LEFT=4 RIGHT=556>
6 </HEAD>
7 <BODY BGCOLOR="#FFFFFF">
9 <H2>Overview</H2>
11 <H3>What is pdisk?</H3>
13 <P>A simple editor for Apple disk partition format. There are two
14 main versions of pdisk: one for Linux and one for the Mac OS. This
15 document describes the Mac OS version of pdisk. Much of this document
16 is also relevant to the Linux version, but check the manual page
17 (pdisk.8) also.</P>
19 <H3>What is the Apple disk partition format?</H3>
21 <P>Most operating systems have ways to divide disks into several
22 pieces - so that an entire disk does not have to be devoted to one
23 filesystem, or even to one operating system. This division of the
24 disk is usually called partitioning. In some systems the partitioning
25 information is built into the operating system code, but that tends to
26 be restrictive. In the Mac OS the partitioning information is stored
27 on the first few blocks of the disk.</P>
29 <P>The Apple disk partition scheme was developed in 1986 by the A/UX
30 team with input from the Mac OS and Apple II teams. There was an
31 earlier partition scheme used in the first SCSI drives on the
32 MacPlus, but that was replaced by the current scheme in the Macintosh
33 II and subsequent machines and in subsequent operating system
34 releases. The current scheme is supported by Mac OS, A/UX, ProDos,
35 MkLinux, LinuxPPC, and MacOS X.</P>
37 <H3>What are LinuxPPC and MkLinux?</H3>
39 <P>Just in case you got pdisk other than as part of a LinuxPPC or
40 MkLinux release:</P>
41 <P>LinuxPPC is a port of the true Linux operating system that runs
42 on most of the Power Macintosh systems from Apple Computer. It also
43 runs on several non-Apple PowerPC machines.</P>
44 <P>MkLinux is a portion of the Linux operating system, converted to run
45 as a server process on top of the Mach microkernel. As with Linux,
46 all of the operating system source code is available for
47 <A HREF="http://www.mklinux.org">download</A>, including the
48 Mach source. MkLinux runs on some of PowerPC based Macintosh
49 machines.</P>
51 <H3>Which Macintosh machines does pdisk run on?</H3>
53 <P>The Mac OS binary should run on any PowerPC based Macintosh. It
54 has been tested under System 7.6.1 and System 8, but should run on
55 older versions of the Mac OS as well. A Mac OS 68000 binary is also
56 distributed for those who may find it useful. </P>
58 <H3>Why would I want to use pdisk on the Mac OS?</H3>
60 <P>The main clients for the Mac OS version of pdisk are Linux
61 users. pdisk was originally developed for Linux. The command syntax
62 was originally identical to that for the 'fdisk' program. (fdisk is a
63 Linux program which edits the DOS/Windows disk partition format.) The
64 Mac OS version is a simple, crude port of the Linux version.</P>
66 <P>The advantages of pdisk over the various Mac OS disk partitioning
67 programs (such as SilverLining, the FWB toolkit, Apple HD SC Setup,
68 DriveSetup, etc) are:</P>
70 <UL>
71 <LI>unlike the Apple partitioners, it does not restrict the set of
72 drives it can operate on
74 <LI>it allows partitions to be reordered (helpful, as Linux
75 depends on the order)
77 <LI>it creates Linux partitions by default
79 <LI>it allows the size of the partition map to be changed
81 <LI>it allows the name of a partition to be changed
83 <LI>it allows you to edit the partition map of your boot disk
84 </UL>
86 <P>The disadvantages of pdisk are:</P>
88 <UL>
89 <LI>it doesn't automatically initialize HFS partitions
91 <LI>it can't install disk drivers
93 <LI>it allows you to edit the partition map of your boot disk
94 </UL>
96 <H3>Where can I get the source?</H3>
98 <P>The main site for LinuxPPC is
99 &lt;<A HREF="http://www.linuxppc.org">http://www.linuxppc.org</A>&gt;.
100 The main site for MkLinux is
101 &lt;<A HREF="http://www.mklinux.org">http://www.mklinux.org</A>&gt;.
102 </P>
104 <H2>Description of the program (as of version 0.8)</H2>
106 <P>Though pdisk is a Macintosh program its interface is very
107 un-Macintosh. pdisk is what is called a line-oriented program. In a
108 line-oriented program you do things by typing on the keyboard and the
109 program does not pay attention to the typing until the return key has
110 been typed.</P>
112 <P>When you start up pdisk it brings up a window with some text in
113 it. The last line of this text should be something like " Top level
114 command (? for help): ". This is the prompt. If you type "?" followed
115 by a return character you should get a list like this:</P>
117 <PRE>Notes:
118 Disk have fake names of the form /dev/scsi&lt;bus&gt;.&lt;id&gt;
119 For example, /dev/scsi0.1, /dev/scsi1.3, and so on.
120 Linux style names are also allowed (i.e /dev/sda or /dev/hda).
121 Due to some technical problems these names may not match
122 the 'real' linux names.
123 &nbsp;
124 Commands are:
125 h print help
126 v print the version number and release date
127 l list device's map
128 L list all devices' maps
129 e edit device's map
130 E (edit map with specified block size)
131 r toggle readonly flag
132 f toggle show filesystem name flag
133 q quit the program</PRE>
135 <P>Some of these commands need what are called arguments - for
136 example <B>l</B> (list) and <B>e</B> (edit) need a single argument,
137 the name of the device to list or edit. Commands which take arguments
138 prompt for each argument in turn. You can also type any number of the
139 arguments separated by spaces and those prompts will be skipped.
140 Commands are case insensitive (e.g. <B>h</B> and <B>H</B>) except
141 when the upper case letter does a variant form of the operation.</P>
143 <DL>
144 <DT><B>h</B>
146 <DD>Prints just the command help. The difference between <B>h</B>
147 and <B>?</B> is the latter prints some helpful notes as well.
149 <DT><B>v</B>
151 <DD>Prints a version number and release date. Matches the
152 version in the GetInfo window for the application.
154 <DT><B>l</B>
156 <DD>Prompts for the name of the device and then lists the
157 partition map on that device.
159 <DT><B>L</B>
161 <DD>Lists all the devices.
163 <DT><B>e</B>
165 <DD>Prompts for the name of the device and then opens the partition
166 map for editing.
168 <DT><B>E</B>
170 <DD>Same as <B>e</B>, except also prompts for block size.
172 <DT><B>r</B>
174 <DD>Toggles read-only setting. When read-only is on pdisk will not
175 write a partition map.
177 <DT><B>f</B>
179 <DD>Toggles show filesystem name flag between 'show fileystem name' and
180 'show partition name'. The default is to show the filesystem name. Showing
181 the filesystem name is helpful when you have several equal sized Macintosh
182 partitions on the disk.
184 <DT><B>q</B>
186 <DD>Quit pdisk.
187 </DL>
189 <H3>The form of the listing</H3>
191 <P>This is a good point to show what the partition map listing looks
192 like.</P>
194 <PRE>Partition map (with 512 byte blocks) on '/dev/scsi0.2' (/dev/sda)
195 #: type name length base ( size )
196 1: Apple_partition_map Apple 63 @ 1
197 2: Apple_Driver43*Macintosh 54 @ 64
198 3: Apple_Driver43*Macintosh 74 @ 118
199 4: Apple_Patches Patch Partition 512 @ 192
200 5: Apple_HFS untitled 2117430 @ 704 ( 1.0G)
201 6: Apple_Free Extra 10 @ 2118134
202 &nbsp;
203 Device block size=512, Number of Blocks=2118143
204 DeviceType=0x0, DeviceId=0x0
205 Drivers-
206 1: @ 64 for 20, type=0x1
207 2: @ 118 for 32, type=0xffff</PRE>
209 <P>The first line indicates what device this is and what size blocks
210 the partition map is using. Most partition maps will use 512-byte
211 blocks, but partition maps can use 1024-byte (1K) or 2048-byte (2K)
212 blocks instead. If we are able to deduce an Linux name different
213 from the name then the Linux name is given in parentheses.</P>
215 <P>Next is the partition list. Each partition (or piece) of the disk
216 takes one line of the list. The data describing the partition is
217 called the partition map entry. The entries are listed in order by
218 index. For each entry, the following information is displayed:</P>
220 <UL>
221 <LI>index - where the partition entry is in the map. This does not
222 correspond the relative order of the partition contents and can
223 change when the partition map is edited.
225 <LI>type - the sort of data expected to be in the partition. pdisk
226 doesn't put data into the contents of any partition except the
227 partition map partition. The type is a case-insensitive string.
229 <LI>name - the name is for the user's information. If the name
230 is in quotes then it is the Mac volume name rather than actual
231 partition name.
233 <LI>length - the number of partition blocks the partition takes.
235 <LI>base - the first block of the partition, measured in partition
236 blocks, starting from zero.
238 <LI>size - this is the length in bytes. Only shown if the size is
239 at least one megabyte.
240 </UL>
242 <P>Following the partition list is information from block zero of the
243 device which describes the location of drivers.</P>
245 <H3>Editing Partition Tables</H3>
247 <P>The <B>e</B> command at the top level menu opens a partition map
248 for editing. The prompt is then changed to "Command (? for help):".
249 If you type "?" followed by a return character you should get a list
250 like this:</P>
252 <PRE>Notes:
253 Base and length fields are blocks, which vary in size between media.
254 The name of a partition is descriptive text.
255 &nbsp;
256 Commands are:
257 h help
258 p print the partition table
259 P (print ordered by base address)
260 i initialize partition map
261 s change size of partition map
262 c create new partition (standard Linux type)
263 C (create with type also specified)
264 n (re)name a partition
265 d delete a partition
266 r reorder partition entry in map
267 w write the partition table
268 q quit editing (don't save changes)</PRE>
270 <P>Commands which take arguments prompt for each argument in turn.
271 You can also type any number of the arguments separated by spaces and
272 those prompts will be skipped. The only exception to typeahead are
273 the confirmation prompts on the <B>i</B> and <B>w</B> commands.
274 Commands can are case insensitive (e.g. <B>h</B> and <B>H</B>) except
275 when the upper case letter does a variant form of the operation.</P>
277 <P>Partitions are always specified by their number, which the index
278 of the partition entry in the partition map. Many of the commands
279 will change the index numbers of other partitions besides the
280 affected partition. You are advised to print the table as frequently
281 as necessary.</P>
283 <P>Creating more than fifteen partitions is not advised. There is
284 currently a bug in the some (all?) of the kernels which causes access
285 to the whole disk fail if more than fifteen partitions are in the
286 map.</P>
288 <DL>
289 <DT><B>h</B>
291 <DD>Prints just the command help. The difference between <B>h</B>
292 and <B>?</B> is the latter prints some helpful notes as well.
294 <DT><B>p</B>
296 <DD>Prints the partition table. The form is identical to the
297 listing described above.
299 <DT><B>P</B>
301 <DD>Identical to <B>p</B>, except the entries are listed in the
302 order of the partitions on the disk (i.e. by the increasing base
303 value) rather than in index order.
305 <DT><B>i</B>
307 <DD>Initializes the partition map (rarely used). This command
308 prompts for the size of the device. WARNING - if you write the map
309 after initializing it you will delete all the drivers on the device.
310 That makes the device invisible to the Mac OS. pdisk is not able
311 to install drivers.
313 <DT><B>s</B>
315 <DD>Change the size of the partition map partition. The partition
316 map's size must be less than or equal to the size of the partition
317 it is contained in. This is mostly useful when you want to do
318 tricky things like making a disk with multiple partitioning
319 schemes on it.
321 <DT><B>c</B>
323 <DD>Create a new partition takes three arguments.<BR>
325 The first argument is the base address (in partition blocks) of
326 the partition. Besides a raw number, you can also specify a
327 partition number followed by the letter 'p' to indicate that the
328 first block of the new partition should be the same as the first
329 block of that existing free space partition.<BR>
331 The second argument is the length of the partition in partition
332 blocks. This can be a raw number or can be a partition number
333 followed by the letter 'p' to use the size of that partition or
334 can be a number followed by 'k', 'm', or 'g' to indicate the size
335 in kilobytes, megabytes, or gigabytes respectively. (These are
336 powers of 1024, of course, not powers of 1000.)<BR>
338 The last argument is the name of the partition. This can be a
339 single word without quotes, or a string surrounded by single or
340 double quotes.<BR>
342 The type of the created partition is set to the correct type for
343 Linux ("Apple_UNIX_SVR2").
345 <DT><B>C</B>
347 <DD>Identical to the <B>c</B> command, with the addition of a
348 prompt for the partition type after the other arguments. The type
349 can be a single word without quotes, or a string surrounded by
350 single or double quotes.
352 <DT><B>n</B>
354 <DD>Rename a partition. Do not change the name of any partition
355 whose type starts with "Apple_Driver". The MacOS looks at the
356 names of those partitions. All other partitions should be okay
357 to change.
359 <DT><B>d</B>
361 <DD>Delete a partition. When a partition is deleted it's type is
362 changed to free ("Apple_Free") and then it is combined with any
363 adjacent free space.
365 <DT><B>r</B>
367 <DD>Reorder takes the current index and the desired new index. If
368 you give a new index which is greater than the last index the
369 entry will be moved to the last index.
371 <DT><B>w</B>
373 <DD>Write does write the partition map out, but pdisk does not yet
374 flush the appropriate caches and unmount volumes so the partition
375 map is not reinterpreted. In order to use the new partition map
376 you must reboot your machine. Sorry.
378 <DT><B>q</B>
380 <DD>Quit out of editing. Returns to the top level prompt. If you
381 have modified the partition map you are NOT asked if you want to
382 save the changes, instead the changes are quietly thrown away.
383 </DL>
385 <H3>Known problems</H3>
387 <DL>
388 <DD>This is an awful Mac OS application, it should be rewritten
389 to look the way a Mac OS app should look.
391 <DD>The code assumes a better understanding of the partitioning
392 scheme than most people care to acquire.
394 <DD>&nbsp;
396 <DD>Even more help should be available during user input.
397 </DL>
400 <HR>
401 </P>
403 <ADDRESS><A HREF="mailto:eryk@cfcl.com">eryk@cfcl.com</A>
404 </ADDRESS>
405 </BODY>
406 </HTML>