8 .Nd PC partition table maintenance program
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. The sector
28 0 boot code then searches the partition table to determine which
31 This boot code then brings in the bootstrap from the
33 partition and, if marked bootable, runs it.
35 you can have one or more partitions with one
39 program can be used to divide space on the disk into partitions and set one
46 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
63 Reinitialize the boot code contained in sector 0 of the disk. Ignored
67 .It Fl f Ar configfile
68 Set partition values using the file
72 always modifies existing partitions, unless
74 is also given, in which case all existing partitions are deleted (marked
75 as "unused") before the
79 can be "-", in which case
82 .Sx CONFIGURATION FILE ,
83 below, for file syntax.
88 is used, you are not asked if you really want to write the partition
89 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 full pathname.
131 tries to figure out the default disk device name from the
134 When called with no arguments, it prints the sector 0 partition table.
137 ******* Working on device /dev/ad0 *******
138 parameters extracted from in-core disklabel are:
139 cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
141 parameters to be used for BIOS calculations are:
142 cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
144 Warning: BIOS sector numbering starts with sector 1
145 Information from DOS bootblock is:
146 The data for partition 1 is:
147 sysid 165,(FreeBSD/NetBSD/386BSD)
148 start 495, size 380160 (185 Meg), flag 0
149 beg: cyl 1/ sector 1/ head 0;
150 end: cyl 768/ sector 33/ head 14
151 The data for partition 2 is:
153 start 378180, size 2475 (1 Meg), flag 0
154 beg: cyl 764/ sector 1/ head 0;
155 end: cyl 768/ sector 33/ head 14
156 The data for partition 3 is:
158 The data for partition 4 is:
159 sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach)
160 start 380656, size 224234 (109 Meg), flag 80
161 beg: cyl 769/ sector 2/ head 0;
162 end: cyl 197/ sector 33/ head 14
165 The disk is divided into three partitions that happen to fill the disk.
166 The second partition overlaps the end of the first.
167 (Used for debugging purposes)
168 .Bl -tag -width "cyl, sector and head"
170 is used to label the partition.
173 magic number 165 decimal (A5 in hex).
174 .It Em start No and Em size
175 fields provide the start address
176 and size of a partition in sectors.
178 specifies that this is the active partition.
179 .It Em cyl , sector No and Em head
180 fields are used to specify the beginning address
181 and end address for the partition.
183 these numbers are calculated using BIOS's understanding of the disk geometry
184 and saved in the bootblock.
191 are used to indicate that the partition data is to be updated, unless the
193 option is used. If the
195 option is not used, the
197 program will enter a conversational mode.
198 This mode is designed not to change any data unless you explicitly tell it to.
200 selects defaults for its questions to guarantee the above behavior.
202 It displays each partition
203 and ask if you want to edit it.
205 it will step through each field showing the old value
206 and asking for a new one.
207 When you are done with a partition,
209 will display it and ask if it is correct.
211 will then proceed to the next entry.
217 fields correct is tricky.
219 they will be calculated for you;
220 you can specify them if you choose.
222 After all the partitions are processed,
223 you are given the option to change the
227 when the all the data for the first sector has been accumulated,
228 you are asked if you really want to rewrite sector 0.
229 Only if you answer yes,
230 will the data be written to disk.
232 The difference between the
239 flag just edits the fields as they appear on the disk.
242 flag is used to "initialize" sector 0;
243 it will setup the last BIOS partition to use the whole disk for
247 The automatic calculation of starting cylinder etc. uses
248 a set of figures that represent what the BIOS thinks is the
249 geometry of the drive.
250 These figures are by default taken from the incore disklabel,
251 but the program initially gives you an opportunity to change them.
252 This allows the user to create a bootblock that can work with drives
253 that use geometry translation under the BIOS.
255 If you hand craft your disk layout,
256 please make sure that the
258 partition starts on a cylinder boundary.
259 A number of decisions made later may assume this.
260 (This might not be necessary later.)
262 Editing an existing partition will most likely cause you to
263 lose all the data in that partition.
265 You should run this program interactively once or twice to see how it
266 works. This is completely safe as long as you answer the last question
267 in the negative. There are subtleties that the program detects that are
268 not fully explained in this manual page.
269 .Sh CONFIGURATION FILE
272 option is given, a disk's partition table can be written using values
275 The syntax of this file is very simple. Each line is either a comment or
276 a specification, and whitespace (except for newlines) are ignored:
282 Lines beginning with a "#" are comments and are ignored.
289 Set the BIOS geometry used in partition calculations. There must be
290 three values specified, with a letter preceding each number:
295 Set the number of cylinders to
300 Set the number of heads to
305 Set the number of sectors/track to
309 These specs can occur in any order, as the leading letter determines
310 which value is which; however, all three must be specified.
312 This line must occur before any lines that specify partition
315 It is an error if the following is not true:
316 .Bd -literal -offset indent
317 1 <= number of cylinders
318 1 <= number of heads <= 256
319 1 <= number of sectors/track < 64
322 The number of cylinders should be less than or equal to 1024, but this
323 is not enforced, although a warning will be output. Note that bootable
325 partitions (the "/" filesystem) must lie completely within the
326 first 1024 cylinders; if this is not true, booting may fail.
327 Non-bootable partitions do not have this restriction.
329 Example (all of these are equivalent), for a disk with 1019 cylinders,
330 39 heads, and 63 sectors:
331 .Bd -literal -offset indent
343 Set the partition given by
353 Only those partitions explicitly mentioned by these lines are modified;
354 any partition not referenced by a "p" line will not be modified.
355 However, if an invalid partition table is present, or the
357 option is specified, all existing partition entries will be cleared
358 (marked as unused), and these "p" lines will have to be used to
359 explicitly set partition information. If multiple partitions need to be
360 set, multiple "p" lines must be specified; one for each partition.
362 These partition lines must occur after any geometry specification lines,
369 partitions. Specifying a partition type of zero is
370 the same as clearing the partition and marking it as unused; however,
371 dummy values (such as "0") must still be specified for
376 Note: the start offset will be rounded upwards to a head boundary if
377 necessary, and the end offset will be rounded downwards to a cylinder
378 boundary if necessary.
380 Example: to clear partition 4 and mark it as unused:
381 .Bd -literal -offset indent
385 Example: to set partition 1 to a
387 partition, starting at sector 1
388 for 2503871 sectors (note: these numbers will be rounded upwards and
389 downwards to correspond to head and cylinder boundaries):
391 .Bd -literal -offset indent
401 the active partition. Can occur anywhere in the config file, but only
404 Example: to make partition 1 the active partition:
405 .Bd -literal -offset indent
410 .Bl -tag -width /boot/mbr -compact
412 The default boot code
418 The default boot code will not necessarily handle all partition types
419 correctly, in particular those introduced since MS-DOS 6.x.
421 The entire program should be made more user-friendly.
423 Throughout this man page, the term
425 is used where it should actually be
427 in order to conform with the terms used elsewhere.
429 You cannot use this command to completely dedicate a disk to
433 command must be used for this.