8 .Nd PC partition table maintenance program
11 .\" !PC98 .Op Fl BIaistu
21 In order for the BIOS to boot the kernel,
22 certain conventions must be adhered to.
23 Sector 0 of the disk must contain boot code,
26 BIOS partitions can be used to break the disk up into several pieces.
27 The BIOS brings in sector 0 and verifies the magic number.
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.
47 The first form is used to
48 display partition information or to interactively edit the partition
50 The second is used to write a partition table using a
52 and is designed to be used by other scripts/programs.
57 Change the active partition only.
62 Get the boot code from the file
65 Reinitialize the boot code contained in sector 0 of the disk.
70 .It Fl f Ar configfile
71 Set partition values using the file
75 always modifies existing partitions, unless
77 is also given, in which case all existing partitions are deleted (marked
78 as "unused") before the
83 can be "-", in which case
87 .Sx CONFIGURATION FILE ,
88 below, for file syntax.
93 is used, you are not asked if you really want to write the partition
94 table (as you are in the interactive mode).
98 .\" Initialize sector 0 of the disk. This implies
104 .\" Initialize the contents of sector 0
107 /\" slice covering the entire disk.
109 Print summary information and exit.
111 Test mode; do not write partition values.
112 Generally used with the
114 option to see what would be written to the partition table.
118 Is used for updating (editing) sector 0 of the disk.
128 prints out the partition table that is written to the disk.
130 Operate on a single fdisk entry only.
136 The final disk name can be provided as a
138 disk name only, e.g.\&
140 or as a fully qualified device node under
142 If omitted, the disks
147 are being searched in that order, until one is
148 being found responding.
150 When called with no arguments, it prints the sector 0 partition table.
153 ******* Working on device /dev/rda0 *******
154 parameters extracted from in-core disklabel are:
155 cylinders=33075 heads=8 sectors/track=32 (256 blks/cyl)
157 parameters to be used for BIOS calculations are:
158 cylinders=33075 heads=8 sectors/track=32 (256 blks/cyl)
160 Media sector size is 512
161 Warning: BIOS sector numbering starts with sector 1
162 Information from DOS bootblock is:
163 The data for partition 1 is:
164 sysmid 148,(FreeBSD/NetBSD/386BSD)
165 start 256, size 2490112 (1215 Meg), sid 196
166 beg: cyl 1/ sector 0/ head 0;
167 end: cyl 9727/ sector 0/ head 0
168 system Name FreeBSD(98)
169 The data for partition 2 is:
170 sysmid 148,(FreeBSD/NetBSD/386BSD)
171 start 2490368, size 5505024 (2688 Meg), sid 196
172 beg: cyl 9728/ sector 0/ head 0;
173 end: cyl 31231/ sector 0/ head 0
174 system Name FreeBSD(98)
175 The data for partition 3 is:
177 The data for partition 4 is:
179 The data for partition 5 is:
181 The data for partition 6 is:
183 The data for partition 7 is:
185 The data for partition 8 is:
187 The data for partition 9 is:
189 The data for partition 10 is:
191 The data for partition 11 is:
193 The data for partition 12 is:
195 The data for partition 13 is:
197 The data for partition 14 is:
199 The data for partition 15 is:
201 The data for partition 16 is:
205 The disk is divided into three partitions that happen to fill the disk.
206 The second partition overlaps the end of the first.
207 (Used for debugging purposes)
208 .Bl -tag -width "cyl, sector and head"
210 is used to label the partition.
213 magic number 148 decimal (94 in hex).
214 .It Em start No and Em size
215 fields provide the start address
216 and size of a partition in sectors.
217 .\" !PC98 .It Em "flag 80"
218 .\" specifies that this is the active partition.
219 .It Em cyl , sector No and Em head
220 fields are used to specify the beginning address
221 and end address for the partition.
223 is the name of the partition.
225 these numbers are calculated using BIOS's understanding of the disk geometry
226 and saved in the bootblock.
233 are used to indicate that the partition data is to be updated, unless the
238 option is not used, the
240 utility will enter a conversational mode.
241 This mode is designed not to change any data unless you explicitly tell it to.
244 utility selects defaults for its questions to guarantee the above behavior.
246 It displays each partition
247 and ask if you want to edit it.
249 it will step through each field showing the old value
250 and asking for a new one.
251 When you are done with a partition,
253 will display it and ask if it is correct.
256 utility will then proceed to the next entry.
262 fields correct is tricky.
264 they will be calculated for you;
265 you can specify them if you choose.
267 After all the partitions are processed,
268 you are given the option to change the
272 when the all the data for the first sector has been accumulated,
273 you are asked if you really want to rewrite sector 0.
274 Only if you answer yes,
275 will the data be written to disk.
277 The difference between the
284 flag just edits the fields as they appear on the disk.
287 flag is used to "initialize" sector 0;
288 it will setup the last BIOS partition to use the whole disk for
292 The automatic calculation of starting cylinder etc.\& uses
293 a set of figures that represent what the BIOS thinks is the
294 geometry of the drive.
295 These figures are by default taken from the incore disklabel,
296 but the program initially gives you an opportunity to change them.
297 This allows the user to create a bootblock that can work with drives
298 that use geometry translation under the BIOS.
300 If you hand craft your disk layout,
301 please make sure that the
303 partition starts on a cylinder boundary.
304 A number of decisions made later may assume this.
305 (This might not be necessary later.)
307 Editing an existing partition will most likely cause you to
308 lose all the data in that partition.
310 You should run this program interactively once or twice to see how it
312 This is completely safe as long as you answer the last question
314 There are subtleties that the program detects that are
315 not fully explained in this manual page.
316 .Sh CONFIGURATION FILE
319 option is given, a disk's partition table can be written using values
322 The syntax of this file is very simple.
323 Each line is either a comment or
324 a specification, and whitespace (except for newlines) are ignored:
330 Lines beginning with a "#" are comments and are ignored.
337 Set the BIOS geometry used in partition calculations.
339 three values specified, with a letter preceding each number:
344 Set the number of cylinders to
349 Set the number of heads to
354 Set the number of sectors/track to
358 These specs can occur in any order, as the leading letter determines
359 which value is which; however, all three must be specified.
361 This line must occur before any lines that specify partition
364 It is an error if the following is not true:
365 .Bd -literal -offset indent
366 1 <= number of cylinders
367 1 <= number of heads <= 256
368 1 <= number of sectors/track < 64
371 The number of cylinders should be less than or equal to 1024, but this
372 is not enforced, although a warning will be output.
375 partitions (the "/" file system) must lie completely within the
376 first 1024 cylinders; if this is not true, booting may fail.
377 Non-bootable partitions do not have this restriction.
379 Example (all of these are equivalent), for a disk with 1019 cylinders,
380 39 heads, and 63 sectors:
381 .Bd -literal -offset indent
393 Set the partition given by
403 Only those partitions explicitly mentioned by these lines are modified;
404 any partition not referenced by a "p" line will not be modified.
405 However, if an invalid partition table is present, or the
407 option is specified, all existing partition entries will be cleared
408 (marked as unused), and these "p" lines will have to be used to
409 explicitly set partition information.
410 If multiple partitions need to be
411 set, multiple "p" lines must be specified; one for each partition.
413 These partition lines must occur after any geometry specification lines,
421 Specifying a partition type of zero is
422 the same as clearing the partition and marking it as unused; however,
423 dummy values (such as "0") must still be specified for
428 Note: the start offset will be rounded upwards to a head boundary if
429 necessary, and the end offset will be rounded downwards to a cylinder
430 boundary if necessary.
432 Example: to clear partition 4 and mark it as unused:
433 .Bd -literal -offset indent
437 Example: to set partition 1 to a
439 partition, starting at sector 1
440 for 2503871 sectors (note: these numbers will be rounded upwards and
441 downwards to correspond to head and cylinder boundaries):
442 .Bd -literal -offset indent
451 the active partition.
452 Can occur anywhere in the config file, but only
455 Example: to make partition 1 the active partition:
456 .Bd -literal -offset indent
461 .Bl -tag -width /boot/mbr -compact
463 The default boot code
468 The default boot code will not necessarily handle all partition types
469 correctly, in particular those introduced since MS-DOS 6.x.
471 The entire program should be made more user-friendly.
473 Throughout this man page, the term
475 is used where it should actually be
477 in order to conform with the terms used elsewhere.
479 You cannot use this command to completely dedicate a disk to
483 command must be used for this.