xref: /netbsd-src/external/bsd/pdisk/dist/pdisk.8 (revision 48a628ae0434c4247b560ad8f2eb1dc06d0dd070)
1.\"	$NetBSD: pdisk.8,v 1.2 2013/03/23 15:39:43 christos Exp $
2.Dd April 24, 2003
3.Dt PDISK 8
4.Os
5.Sh NAME
6.Nm pdisk
7.Nd Apple partition table editor
8.Sh SYNOPSIS
9.Nm
10.Op Fl acdfhilLrv
11.Op Fl -abbr
12.Op Fl -compute_size
13.Op Fl -debug
14.Op Fl -fname
15.Op Fl -help
16.Op Fl -interactive
17.Op Fl -list Ar device
18.Op Fl -logical
19.Op Fl -readonly
20.Op Fl -version
21.Op Ar device ...
22.Sh DESCRIPTION
23.Nm
24is a menu driven program which partitions disks using the standard Apple
25disk partitioning scheme described in "Inside Macintosh: Devices".
26It does not support the Intel/DOS partitioning scheme supported by
27.Xr fdisk 8 .
28.Pp
29Supported options are:
30.Bl -tag -width "--compute_sizeXX" -compact
31.It Fl a
32.It Fl -abbr
33Abbreviate the partition types shown in the partition list.
34.It Fl c
35.It Fl -compute_size
36Causes
37.Nm
38to always ignore the device size listed in the partition table
39and compute the device size by other means.
40.It Fl d
41.It Fl -debug
42Turns on debugging.
43Doesn't add that much output, but does add a new command
44.Sq x
45to the editing commands that accesses an eclectic bunch of
46undocumented functionality.
47.It Fl f
48.It Fl -fname
49Show HFS volume names instead of partition name when available.
50.It Fl h
51.It Fl -help
52Prints a short help message.
53.It Fl i
54.It Fl -interactive
55Causes
56.Nm
57to go into an interactive mode similar to the MacOS version of the program.
58.It Fl l
59.It Fl -list Ar device
60.\"If no
61.\".Ar device
62.\"argument is given,
63.\".Nm
64.\"tries to list partition tables for all available hard drives.
65.\"Otherwise,
66.\".Nm
67.\"lists
68List
69the partition tables for the specified
70.Ar devices .
71.It Fl L
72.It Fl -logical
73Show partition limits in logical blocks.
74Default is physical blocks.
75.It Fl r
76.It Fl -readonly
77Prevents
78.Nm
79from writing to the device.
80.It Fl v
81.It Fl -version
82Prints the version number of
83.Nm .
84.El
85.Ss Editing Partition Tables
86An argument which is simply the name of a
87.Ar device
88indicates that
89.Nm
90should edit the partition table of that device.
91.Pp
92The current top level editing commands are:
93.Bd -unfilled -offset indent
94C    (create with type also specified)
95c    create new partition
96d    delete a partition
97h    command help
98i    initialize partition map
99n    (re)name a partition
100P    (print ordered by base address)
101p    print the partition table
102q    quit editing (don't save changes)
103r    reorder partition entry in map
104s    change size of partition map
105t    change the type of an existing partition
106w    write the partition table
107.Ed
108.Pp
109Commands which take arguments prompt for each argument in turn.
110You can also type any number of the arguments separated by spaces
111and those prompts will be skipped.
112The only exception to typeahead are the confirmation prompts on the
113.Ic i
114and
115.Ic w
116commands,
117since if we expect you to confirm the decision, we shouldn't undermine
118that by allowing you to be precipitate about it.
119.Pp
120Partitions are always specified by their number,
121which is the index of the partition entry in the partition map.
122Most of the commands will change the index numbers of all partitions
123after the affected partition.
124You are advised to print the table as frequently as necessary.
125.Pp
126.\"Creating more than fifteen partitions is not advised.
127.\"There may be a bug in old linux kernels which causes
128.\"access to the whole disk fail if more than fifteen partitions are in the map.
129.\".Pp
130The
131.Ic c
132(create new partition) command is the only one with complicated arguments.
133The first argument is the base address (in blocks) of the partition.
134Besides a raw number, you can also specify a partition number followed
135by the letter
136.Sq p
137to indicate that the first block of the new partition should be the same
138as the first block of that existing free space partition.
139The second argument is the length of the partition in blocks.
140This can be a raw number or can be a partition number followed by the
141letter
142.Sq p
143to use the size of that partition or can be a number followed
144by
145.Sq k ,
146.Sq m ,
147or
148.Sq g
149to indicate the size in kilobytes, megabytes, or gigabytes respectively.
150(These are powers of 1024, of course, not powers of 1000.)
151The third argument is the name of the partition.
152This can be a single word without quotes, or a string surrounded by
153single or double quotes.
154The type of the created partition will be Apple_UNIX_SVR2, which is
155the correct type for use with
156.Nx .
157This command will prompt for the unix filesystem slice to set
158in the Block Zero Block bits.
159.Pp
160The
161.Ic C
162command is similar to the
163.Ic c
164command, with the addition of a partition type argument after the
165other arguments.
166Choosing a type of Apple_UNIX_SVR2 will prompt for
167the unix filesystem slice to set in the Block Zero Block bits.
168.Pp
169The
170.Ic i
171(initalize) command prompts for the size of the device.
172.\"This was done to get around a bug in the kernel where it reports the wrong
173.\"size for the device.
174.Pp
175The
176.Ic n
177(name) command allows the name of a partition to be changed.
178Note that the various "Apple_Driver" partitions depend
179on the name field for proper functioning.
180We are not aware of any other partition types with this limitation.
181.Pp
182The
183.Ic r
184(reorder) command allows the index number of partitions to be changed.
185The index numbers are constrained to be a contiguous sequence.
186.Pp
187The
188.Ic t
189(change partition type) command allows the type of a partition to be
190changed.
191Changing the type to Apple_UNIX_SVR2 will prompt for the
192unix filesystem slice to set in the Block Zero Block bits.
193.Pp
194The
195.Ic w
196(write) command writes the partition map out.
197.\"but there is currently a bug in the interaction between MkLinux and Mach
198.\"which causes the partition map not to be reinterpreted.
199In order to use the new partition map you must reboot.
200.Sh SEE ALSO
201.Xr fdisk 8 ,
202.Xr newfs 8
203.Sh HISTORY
204The
205.Nm
206utility was originally developed for MkLinux.
207.Sh AUTHORS
208.An Eryk Vershen
209.Sh BUGS
210Some people believe there should really be just one disk partitioning utility.
211.Pp
212.\".Nm
213.\"should be able to create HFS partitions that work.
214.\".Pp
215Filesystem volume names are out of place in a partition utility.
216This utility supports HFS volume names, but not volume names
217of any other filesystem types.
218.Pp
219The
220.Fl -logical
221option has not been heavily tested.
222.Pp
223.Nm
224will first try to use
225.Xr lseek 2
226with
227.Dv SEEK_END
228to compute the size of the device.
229If this fails, it will try a binary search using
230.Xr lseek 2
231and
232.Xr read 2
233to find the end of the device.
234This has been observed to fail on some raw disk devices.
235As a workaround, try using the block device instead.
236.Nm
237should probably read the disklabel using the
238.Dv DIOCGDINFO
239.Xr ioctl 2
240to get the device size instead.
241