1 .\" $FreeBSD: src/sbin/pc98/fdisk/fdisk.8,v 1.1.2.7 2001/12/20 16:47:07 ru Exp $
2 .\" $DragonFly: src/sbin/pc98/fdisk/Attic/fdisk.8,v 1.2 2003/06/17 04:27:34 dillon Exp $
9 .Nd PC partition table maintenance program
12 .\" !PC98 .Op Fl BIaistu
23 In order for the BIOS to boot the kernel,
24 certain conventions must be adhered to.
25 Sector 0 of the disk must contain boot code,
28 BIOS partitions can be used to break the disk up into several pieces.
29 The BIOS brings in sector 0 and verifies the magic number. The sector
30 0 boot code then searches the partition table to determine which
33 This boot code then brings in the bootstrap from the
35 partition and, if marked bootable, runs it.
37 you can have one or more partitions with one
41 program can be used to divide space on the disk into partitions and set one
48 serves a similar purpose to the DOS program. The first form is used to
49 display partition information or to interactively edit the partition
50 table. The second is used to write a partition table using a
52 and is designed to be used by other scripts/programs.
56 Change the active partition only. Ignored if
60 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!
92 .\" Initialize sector 0 of the disk. This implies
98 .\" Initialize the contents of sector 0
101 /\" slice covering the entire disk.
103 Print summary information and exit.
105 Test mode; do not write partition values. Generally used with the
107 option to see what would be written to the partition table. Implies
110 Is used for updating (editing) sector 0 of the disk. Ignored if
118 prints out the partition table that is written to the disk.
120 Operate on a single fdisk entry only. Ignored if
125 The final disk name can be provided as a
127 disk name only, e.g.\&
129 or as a fully qualified device node under
131 If omitted, the disks
136 are being searched in that order, until one is
137 being found responding.
139 When called with no arguments, it prints the sector 0 partition table.
142 ******* Working on device /dev/rda0 *******
143 parameters extracted from in-core disklabel are:
144 cylinders=33075 heads=8 sectors/track=32 (256 blks/cyl)
146 parameters to be used for BIOS calculations are:
147 cylinders=33075 heads=8 sectors/track=32 (256 blks/cyl)
149 Media sector size is 512
150 Warning: BIOS sector numbering starts with sector 1
151 Information from DOS bootblock is:
152 The data for partition 1 is:
153 sysmid 148,(FreeBSD/NetBSD/386BSD)
154 start 256, size 2490112 (1215 Meg), sid 196
155 beg: cyl 1/ sector 0/ head 0;
156 end: cyl 9727/ sector 0/ head 0
157 system Name FreeBSD(98)
158 The data for partition 2 is:
159 sysmid 148,(FreeBSD/NetBSD/386BSD)
160 start 2490368, size 5505024 (2688 Meg), sid 196
161 beg: cyl 9728/ sector 0/ head 0;
162 end: cyl 31231/ sector 0/ head 0
163 system Name FreeBSD(98)
164 The data for partition 3 is:
166 The data for partition 4 is:
168 The data for partition 5 is:
170 The data for partition 6 is:
172 The data for partition 7 is:
174 The data for partition 8 is:
176 The data for partition 9 is:
178 The data for partition 10 is:
180 The data for partition 11 is:
182 The data for partition 12 is:
184 The data for partition 13 is:
186 The data for partition 14 is:
188 The data for partition 15 is:
190 The data for partition 16 is:
194 The disk is divided into three partitions that happen to fill the disk.
195 The second partition overlaps the end of the first.
196 (Used for debugging purposes)
197 .Bl -tag -width "cyl, sector and head"
199 is used to label the partition.
202 magic number 148 decimal (94 in hex).
203 .It Em start No and Em size
204 fields provide the start address
205 and size of a partition in sectors.
206 .\" !PC98 .It Em "flag 80"
207 .\" specifies that this is the active partition.
208 .It Em cyl , sector No and Em head
209 fields are used to specify the beginning address
210 and end address for the partition.
212 is the name of the partition.
214 these numbers are calculated using BIOS's understanding of the disk geometry
215 and saved in the bootblock.
222 are used to indicate that the partition data is to be updated, unless the
224 option is used. If the
226 option is not used, the
228 program will enter a conversational mode.
229 This mode is designed not to change any data unless you explicitly tell it to.
231 selects defaults for its questions to guarantee the above behavior.
233 It displays each partition
234 and ask if you want to edit it.
236 it will step through each field showing the old value
237 and asking for a new one.
238 When you are done with a partition,
240 will display it and ask if it is correct.
242 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 "/" filesystem) 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.