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 program can be used to divide space on the disk into partitions and set one
47 serves a similar purpose to the DOS program. The first form is used to
48 display partition information or to interactively edit the partition
49 table. The second is used to write a partition table using a
51 and is designed to be used by other scripts/programs.
55 Change the active partition only. Ignored if
59 Get the boot code from the file
62 Reinitialize the boot code contained in sector 0 of the disk. Ignored
66 .It Fl f Ar configfile
67 Set partition values using the file
71 always modifies existing partitions, unless
73 is also given, in which case all existing partitions are deleted (marked
74 as "unused") before the
78 can be "-", in which case
81 .Sx CONFIGURATION FILE ,
82 below, for file syntax.
87 is used, you are not asked if you really want to write the partition
88 table (as you are in the interactive mode). Use with caution!
91 .\" Initialize sector 0 of the disk. This implies
97 .\" Initialize the contents of sector 0
100 /\" slice covering the entire disk.
102 Print summary information and exit.
104 Test mode; do not write partition values. Generally used with the
106 option to see what would be written to the partition table. Implies
109 Is used for updating (editing) sector 0 of the disk. Ignored if
117 prints out the partition table that is written to the disk.
119 Operate on a single fdisk entry only. Ignored if
124 The final disk name can be provided as a
126 disk name only, e.g.\&
128 or as a fully qualified device node under
130 If omitted, the disks
135 are being searched in that order, until one is
136 being found responding.
138 When called with no arguments, it prints the sector 0 partition table.
141 ******* Working on device /dev/rda0 *******
142 parameters extracted from in-core disklabel are:
143 cylinders=33075 heads=8 sectors/track=32 (256 blks/cyl)
145 parameters to be used for BIOS calculations are:
146 cylinders=33075 heads=8 sectors/track=32 (256 blks/cyl)
148 Media sector size is 512
149 Warning: BIOS sector numbering starts with sector 1
150 Information from DOS bootblock is:
151 The data for partition 1 is:
152 sysmid 148,(FreeBSD/NetBSD/386BSD)
153 start 256, size 2490112 (1215 Meg), sid 196
154 beg: cyl 1/ sector 0/ head 0;
155 end: cyl 9727/ sector 0/ head 0
156 system Name FreeBSD(98)
157 The data for partition 2 is:
158 sysmid 148,(FreeBSD/NetBSD/386BSD)
159 start 2490368, size 5505024 (2688 Meg), sid 196
160 beg: cyl 9728/ sector 0/ head 0;
161 end: cyl 31231/ sector 0/ head 0
162 system Name FreeBSD(98)
163 The data for partition 3 is:
165 The data for partition 4 is:
167 The data for partition 5 is:
169 The data for partition 6 is:
171 The data for partition 7 is:
173 The data for partition 8 is:
175 The data for partition 9 is:
177 The data for partition 10 is:
179 The data for partition 11 is:
181 The data for partition 12 is:
183 The data for partition 13 is:
185 The data for partition 14 is:
187 The data for partition 15 is:
189 The data for partition 16 is:
193 The disk is divided into three partitions that happen to fill the disk.
194 The second partition overlaps the end of the first.
195 (Used for debugging purposes)
196 .Bl -tag -width "cyl, sector and head"
198 is used to label the partition.
201 magic number 148 decimal (94 in hex).
202 .It Em start No and Em size
203 fields provide the start address
204 and size of a partition in sectors.
205 .\" !PC98 .It Em "flag 80"
206 .\" specifies that this is the active partition.
207 .It Em cyl , sector No and Em head
208 fields are used to specify the beginning address
209 and end address for the partition.
211 is the name of the partition.
213 these numbers are calculated using BIOS's understanding of the disk geometry
214 and saved in the bootblock.
221 are used to indicate that the partition data is to be updated, unless the
223 option is used. If the
225 option is not used, the
227 program will enter a conversational mode.
228 This mode is designed not to change any data unless you explicitly tell it to.
230 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.
241 will then proceed to the next entry.
247 fields correct is tricky.
249 they will be calculated for you;
250 you can specify them if you choose.
252 After all the partitions are processed,
253 you are given the option to change the
257 when the all the data for the first sector has been accumulated,
258 you are asked if you really want to rewrite sector 0.
259 Only if you answer yes,
260 will the data be written to disk.
262 The difference between the
269 flag just edits the fields as they appear on the disk.
272 flag is used to "initialize" sector 0;
273 it will setup the last BIOS partition to use the whole disk for
277 The automatic calculation of starting cylinder etc. uses
278 a set of figures that represent what the BIOS thinks is the
279 geometry of the drive.
280 These figures are by default taken from the incore disklabel,
281 but the program initially gives you an opportunity to change them.
282 This allows the user to create a bootblock that can work with drives
283 that use geometry translation under the BIOS.
285 If you hand craft your disk layout,
286 please make sure that the
288 partition starts on a cylinder boundary.
289 A number of decisions made later may assume this.
290 (This might not be necessary later.)
292 Editing an existing partition will most likely cause you to
293 lose all the data in that partition.
295 You should run this program interactively once or twice to see how it
296 works. This is completely safe as long as you answer the last question
297 in the negative. There are subtleties that the program detects that are
298 not fully explained in this manual page.
299 .Sh CONFIGURATION FILE
302 option is given, a disk's partition table can be written using values
305 The syntax of this file is very simple. Each line is either a comment or
306 a specification, and whitespace (except for newlines) are ignored:
312 Lines beginning with a "#" are comments and are ignored.
319 Set the BIOS geometry used in partition calculations. There must be
320 three values specified, with a letter preceding each number:
325 Set the number of cylinders to
330 Set the number of heads to
335 Set the number of sectors/track to
339 These specs can occur in any order, as the leading letter determines
340 which value is which; however, all three must be specified.
342 This line must occur before any lines that specify partition
345 It is an error if the following is not true:
346 .Bd -literal -offset indent
347 1 <= number of cylinders
348 1 <= number of heads <= 256
349 1 <= number of sectors/track < 64
352 The number of cylinders should be less than or equal to 1024, but this
353 is not enforced, although a warning will be output. Note that bootable
355 partitions (the "/" filesystem) must lie completely within the
356 first 1024 cylinders; if this is not true, booting may fail.
357 Non-bootable partitions do not have this restriction.
359 Example (all of these are equivalent), for a disk with 1019 cylinders,
360 39 heads, and 63 sectors:
361 .Bd -literal -offset indent
373 Set the partition given by
383 Only those partitions explicitly mentioned by these lines are modified;
384 any partition not referenced by a "p" line will not be modified.
385 However, if an invalid partition table is present, or the
387 option is specified, all existing partition entries will be cleared
388 (marked as unused), and these "p" lines will have to be used to
389 explicitly set partition information. If multiple partitions need to be
390 set, multiple "p" lines must be specified; one for each partition.
392 These partition lines must occur after any geometry specification lines,
399 partitions. Specifying a partition type of zero is
400 the same as clearing the partition and marking it as unused; however,
401 dummy values (such as "0") must still be specified for
406 Note: the start offset will be rounded upwards to a head boundary if
407 necessary, and the end offset will be rounded downwards to a cylinder
408 boundary if necessary.
410 Example: to clear partition 4 and mark it as unused:
411 .Bd -literal -offset indent
415 Example: to set partition 1 to a
417 partition, starting at sector 1
418 for 2503871 sectors (note: these numbers will be rounded upwards and
419 downwards to correspond to head and cylinder boundaries):
420 .Bd -literal -offset indent
429 the active partition. Can occur anywhere in the config file, but only
432 Example: to make partition 1 the active partition:
433 .Bd -literal -offset indent
438 .Bl -tag -width /boot/mbr -compact
440 The default boot code
445 The default boot code will not necessarily handle all partition types
446 correctly, in particular those introduced since MS-DOS 6.x.
448 The entire program should be made more user-friendly.
450 Throughout this man page, the term
452 is used where it should actually be
454 in order to conform with the terms used elsewhere.
456 You cannot use this command to completely dedicate a disk to
460 command must be used for this.