8 .Nd PC partition table maintenance program
11 .\" !PC98 .Op Fl BIaistu
22 In order for the BIOS to boot the kernel,
23 certain conventions must be adhered to.
24 Sector 0 of the disk must contain boot code,
27 BIOS partitions can be used to break the disk up into several pieces.
28 The BIOS brings in sector 0 and verifies the magic number. The sector
29 0 boot code then searches the partition table to determine which
32 This boot code then brings in the bootstrap from the
34 partition and, if marked bootable, runs it.
36 you can have one or more partitions with one
40 utility can be used to divide space on the disk into partitions and set one
46 utility serves a similar purpose to the DOS program. The first form is used to
47 display partition information or to interactively edit the partition
48 table. The second is used to write a partition table using a
50 and is designed to be used by other scripts/programs.
54 Change the active partition only. Ignored if
58 Get the boot code from the file
61 Reinitialize the boot code contained in sector 0 of the disk. Ignored
65 .It Fl f Ar configfile
66 Set partition values using the file
70 always modifies existing partitions, unless
72 is also given, in which case all existing partitions are deleted (marked
73 as "unused") before the
77 can be "-", in which case
80 .Sx CONFIGURATION FILE ,
81 below, for file syntax.
86 is used, you are not asked if you really want to write the partition
87 table (as you are in the interactive mode). Use with caution!
90 .\" Initialize sector 0 of the disk. This implies
96 .\" Initialize the contents of sector 0
99 /\" slice covering the entire disk.
101 Print summary information and exit.
103 Test mode; do not write partition values. Generally used with the
105 option to see what would be written to the partition table. Implies
108 Is used for updating (editing) sector 0 of the disk. Ignored if
116 prints out the partition table that is written to the disk.
118 Operate on a single fdisk entry only. Ignored if
123 The final disk name can be provided as a
125 disk name only, e.g.\&
127 or as a fully qualified device node under
129 If omitted, the disks
134 are being searched in that order, until one is
135 being found responding.
137 When called with no arguments, it prints the sector 0 partition table.
140 ******* Working on device /dev/rda0 *******
141 parameters extracted from in-core disklabel are:
142 cylinders=33075 heads=8 sectors/track=32 (256 blks/cyl)
144 parameters to be used for BIOS calculations are:
145 cylinders=33075 heads=8 sectors/track=32 (256 blks/cyl)
147 Media sector size is 512
148 Warning: BIOS sector numbering starts with sector 1
149 Information from DOS bootblock is:
150 The data for partition 1 is:
151 sysmid 148,(FreeBSD/NetBSD/386BSD)
152 start 256, size 2490112 (1215 Meg), sid 196
153 beg: cyl 1/ sector 0/ head 0;
154 end: cyl 9727/ sector 0/ head 0
155 system Name FreeBSD(98)
156 The data for partition 2 is:
157 sysmid 148,(FreeBSD/NetBSD/386BSD)
158 start 2490368, size 5505024 (2688 Meg), sid 196
159 beg: cyl 9728/ sector 0/ head 0;
160 end: cyl 31231/ sector 0/ head 0
161 system Name FreeBSD(98)
162 The data for partition 3 is:
164 The data for partition 4 is:
166 The data for partition 5 is:
168 The data for partition 6 is:
170 The data for partition 7 is:
172 The data for partition 8 is:
174 The data for partition 9 is:
176 The data for partition 10 is:
178 The data for partition 11 is:
180 The data for partition 12 is:
182 The data for partition 13 is:
184 The data for partition 14 is:
186 The data for partition 15 is:
188 The data for partition 16 is:
192 The disk is divided into three partitions that happen to fill the disk.
193 The second partition overlaps the end of the first.
194 (Used for debugging purposes)
195 .Bl -tag -width "cyl, sector and head"
197 is used to label the partition.
200 magic number 148 decimal (94 in hex).
201 .It Em start No and Em size
202 fields provide the start address
203 and size of a partition in sectors.
204 .\" !PC98 .It Em "flag 80"
205 .\" specifies that this is the active partition.
206 .It Em cyl , sector No and Em head
207 fields are used to specify the beginning address
208 and end address for the partition.
210 is the name of the partition.
212 these numbers are calculated using BIOS's understanding of the disk geometry
213 and saved in the bootblock.
220 are used to indicate that the partition data is to be updated, unless the
222 option is used. If the
224 option is not used, the
226 utility will enter a conversational mode.
227 This mode is designed not to change any data unless you explicitly tell it to.
230 utility selects defaults for its questions to guarantee the above behavior.
232 It displays each partition
233 and ask if you want to edit it.
235 it will step through each field showing the old value
236 and asking for a new one.
237 When you are done with a partition,
239 will display it and ask if it is correct.
242 utility will then proceed to the next entry.
248 fields correct is tricky.
250 they will be calculated for you;
251 you can specify them if you choose.
253 After all the partitions are processed,
254 you are given the option to change the
258 when the all the data for the first sector has been accumulated,
259 you are asked if you really want to rewrite sector 0.
260 Only if you answer yes,
261 will the data be written to disk.
263 The difference between the
270 flag just edits the fields as they appear on the disk.
273 flag is used to "initialize" sector 0;
274 it will setup the last BIOS partition to use the whole disk for
278 The automatic calculation of starting cylinder etc. uses
279 a set of figures that represent what the BIOS thinks is the
280 geometry of the drive.
281 These figures are by default taken from the incore disklabel,
282 but the program initially gives you an opportunity to change them.
283 This allows the user to create a bootblock that can work with drives
284 that use geometry translation under the BIOS.
286 If you hand craft your disk layout,
287 please make sure that the
289 partition starts on a cylinder boundary.
290 A number of decisions made later may assume this.
291 (This might not be necessary later.)
293 Editing an existing partition will most likely cause you to
294 lose all the data in that partition.
296 You should run this program interactively once or twice to see how it
297 works. This is completely safe as long as you answer the last question
298 in the negative. There are subtleties that the program detects that are
299 not fully explained in this manual page.
300 .Sh CONFIGURATION FILE
303 option is given, a disk's partition table can be written using values
306 The syntax of this file is very simple. Each line is either a comment or
307 a specification, and whitespace (except for newlines) are ignored:
313 Lines beginning with a "#" are comments and are ignored.
320 Set the BIOS geometry used in partition calculations. There must be
321 three values specified, with a letter preceding each number:
326 Set the number of cylinders to
331 Set the number of heads to
336 Set the number of sectors/track to
340 These specs can occur in any order, as the leading letter determines
341 which value is which; however, all three must be specified.
343 This line must occur before any lines that specify partition
346 It is an error if the following is not true:
347 .Bd -literal -offset indent
348 1 <= number of cylinders
349 1 <= number of heads <= 256
350 1 <= number of sectors/track < 64
353 The number of cylinders should be less than or equal to 1024, but this
354 is not enforced, although a warning will be output. Note that bootable
356 partitions (the "/" file system) must lie completely within the
357 first 1024 cylinders; if this is not true, booting may fail.
358 Non-bootable partitions do not have this restriction.
360 Example (all of these are equivalent), for a disk with 1019 cylinders,
361 39 heads, and 63 sectors:
362 .Bd -literal -offset indent
374 Set the partition given by
384 Only those partitions explicitly mentioned by these lines are modified;
385 any partition not referenced by a "p" line will not be modified.
386 However, if an invalid partition table is present, or the
388 option is specified, all existing partition entries will be cleared
389 (marked as unused), and these "p" lines will have to be used to
390 explicitly set partition information. If multiple partitions need to be
391 set, multiple "p" lines must be specified; one for each partition.
393 These partition lines must occur after any geometry specification lines,
400 partitions. Specifying a partition type of zero is
401 the same as clearing the partition and marking it as unused; however,
402 dummy values (such as "0") must still be specified for
407 Note: the start offset will be rounded upwards to a head boundary if
408 necessary, and the end offset will be rounded downwards to a cylinder
409 boundary if necessary.
411 Example: to clear partition 4 and mark it as unused:
412 .Bd -literal -offset indent
416 Example: to set partition 1 to a
418 partition, starting at sector 1
419 for 2503871 sectors (note: these numbers will be rounded upwards and
420 downwards to correspond to head and cylinder boundaries):
421 .Bd -literal -offset indent
430 the active partition. Can occur anywhere in the config file, but only
433 Example: to make partition 1 the active partition:
434 .Bd -literal -offset indent
439 .Bl -tag -width /boot/mbr -compact
441 The default boot code
446 The default boot code will not necessarily handle all partition types
447 correctly, in particular those introduced since MS-DOS 6.x.
449 The entire program should be made more user-friendly.
451 Throughout this man page, the term
453 is used where it should actually be
455 in order to conform with the terms used elsewhere.
457 You cannot use this command to completely dedicate a disk to
461 command must be used for this.