1 .\" $FreeBSD: src/sbin/i386/fdisk/fdisk.8,v 1.17.2.11 2002/04/25 16:25:12 trhodes Exp $
2 .\" $DragonFly: src/sbin/i386/fdisk/fdisk.8,v 1.2 2003/06/17 04:27:33 dillon Exp $
9 .Nd PC slice table maintenance program
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 slices 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 slice table to determine which
32 This boot code then brings in the bootstrap from the
34 slice and, if marked bootable, runs it.
36 you can have one or more slices with one
40 program can be used to divide space on the disk into slices and set one
47 serves a similar purpose to the DOS program. The first form is used to
48 display slice information or to interactively edit the slice
49 table. The second is used to write a slice table using a
51 and is designed to be used by other scripts/programs.
55 Change the active slice only. Ignored if
59 Get the boot code from the file
64 Reinitialize the boot code contained in sector 0 of the disk. Ignored
68 .It Fl f Ar configfile
69 Set slice values using the file
73 always modifies existing slices, unless
75 is also given, in which case all existing slices are deleted (marked
76 as "unused") before the
80 can be "-", in which case
83 .Sx CONFIGURATION FILE ,
84 below, for file syntax.
89 is used, you are not asked if you really want to write the slices
90 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 slice values. Generally used with the
107 option to see what would be written to the slice table. Implies
110 Is used for updating (editing) sector 0 of the disk. Ignored if
118 prints out the slice 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
135 are searched in that order, until one is found to respond.
137 When called without options,
139 prints the sector 0 slice table.
142 ******* Working on device /dev/ad0 *******
143 parameters extracted from in-core disklabel are:
144 cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
146 parameters to be used for BIOS calculations are:
147 cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
149 Warning: BIOS sector numbering starts with sector 1
150 Information from DOS bootblock is:
151 The data for partition 1 is:
152 sysid 165,(FreeBSD/NetBSD/386BSD)
153 start 495, size 380160 (185 Meg), flag 0
154 beg: cyl 1/ sector 1/ head 0;
155 end: cyl 768/ sector 33/ head 14
156 The data for partition 2 is:
158 start 378180, size 2475 (1 Meg), flag 0
159 beg: cyl 764/ sector 1/ head 0;
160 end: cyl 768/ sector 33/ head 14
161 The data for partition 3 is:
163 The data for partition 4 is:
164 sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach)
165 start 380656, size 224234 (109 Meg), flag 80
166 beg: cyl 769/ sector 2/ head 0;
167 end: cyl 197/ sector 33/ head 14
170 The disk is divided into three slices that happen to fill the disk.
171 The second slice overlaps the end of the first.
172 (Used for debugging purposes.)
173 .Bl -tag -width "cyl, sector and head"
175 is used to label the slice.
178 magic number 165 decimal (A5 in hex).
179 .It Em start No and Em size
180 fields provide the start address
181 and size of a slice in sectors.
183 specifies that this is the active slice.
184 .It Em cyl , sector No and Em head
185 fields are used to specify the beginning and end addresses of the slice.
187 these numbers are calculated using BIOS's understanding of the disk geometry
188 and saved in the bootblock.
195 flags are used to indicate that the slice data is to be updated.
198 option is also given,
200 will enter a conversational mode.
201 In this mode, no changes will be written to disk unless you explicitly tell
206 will display each slice and ask whether you want to edit it.
209 will step through each field, show you the old value,
210 and ask you for a new one.
211 When you are done with the slice,
213 will display it and ask you whether it is correct.
215 will then proceed to the next entry.
221 fields correct is tricky, so by default,
222 they will be calculated for you;
223 you can specify them if you choose to though.
225 After all the slices are processed,
226 you are given the option to change the
229 Finally, when all the new data for sector 0 has been accumulated,
230 you are asked to confirm whether you really want to rewrite it.
232 The difference between the
239 flag just edits (updates) the fields as they appear on the disk,
242 flag is used to "initialize" sector 0;
243 it will set up the last BIOS slice 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 the
249 geometry of the drive is.
250 These figures are taken from the in-core disklabel by default,
253 initially gives you an opportunity to change them.
254 This allows you to create a bootblock that can work with drives
255 that use geometry translation under the BIOS.
257 If you hand craft your disk layout,
258 please make sure that the
260 slice starts on a cylinder boundary.
261 A number of decisions made later may assume this.
262 (This might not be necessary later.)
264 Editing an existing slice will most likely result in the loss of
265 all data in that slice.
269 interactively once or twice to see how it works.
270 This is completely safe as long as you answer the last question
271 in the negative. There are subtleties that
273 detects that are not fully explained in this manual page.
274 .Sh CONFIGURATION FILE
277 option is given, a disk's slice table can be written using values
280 The syntax of this file is very simple;
281 each line is either a comment or a specification, as follows:
287 Lines beginning with a "#" are comments and are ignored.
294 Set the BIOS geometry used in slice calculations. There must be
295 three values specified, with a letter preceding each number:
300 Set the number of cylinders to
305 Set the number of heads to
310 Set the number of sectors/track to
314 These specs can occur in any order, as the leading letter determines
315 which value is which; however, all three must be specified.
317 This line must occur before any lines that specify slice
320 It is an error if the following is not true:
321 .Bd -literal -offset indent
322 1 <= number of cylinders
323 1 <= number of heads <= 256
324 1 <= number of sectors/track < 64
327 The number of cylinders should be less than or equal to 1024, but this
328 is not enforced, although a warning will be printed. Note that bootable
330 slices (the "/" filesystem) must lie completely within the
331 first 1024 cylinders; if this is not true, booting may fail.
332 Non-bootable slices do not have this restriction.
334 Example (all of these are equivalent), for a disk with 1019 cylinders,
335 39 heads, and 63 sectors:
336 .Bd -literal -offset indent
348 Set the slice given by
358 Only those slices explicitly mentioned by these lines are modified;
359 any slice not referenced by a "p" line will not be modified.
360 However, if an invalid slice table is present, or the
362 option is specified, all existing slice entries will be cleared
363 (marked as unused), and these "p" lines will have to be used to
364 explicitly set slice information. If multiple slices need to be
365 set, multiple "p" lines must be specified; one for each slice.
367 These slice lines must occur after any geometry specification lines,
374 slices. Specifying a slice type of zero is
375 the same as clearing the slice and marking it as unused; however,
376 dummy values (such as "0") must still be specified for
381 Note: the start offset will be rounded upwards to a head boundary if
382 necessary, and the end offset will be rounded downwards to a cylinder
383 boundary if necessary.
385 Example: to clear slice 4 and mark it as unused:
386 .Bd -literal -offset indent
390 Example: to set slice 1 to a
392 slice, starting at sector 1
393 for 2503871 sectors (note: these numbers will be rounded upwards and
394 downwards to correspond to head and cylinder boundaries):
396 .Bd -literal -offset indent
406 the active slice. Can occur anywhere in the config file, but only
409 Example: to make slice 1 the active slice:
410 .Bd -literal -offset indent
415 .Bl -tag -width /boot/mbr -compact
417 The default boot code
424 The default boot code will not necessarily handle all slice types
425 correctly, in particular those introduced since MS-DOS 6.x.
427 The entire program should be made more user-friendly.
431 do not understand the difference between
435 causing difficulty to adjust.
437 You cannot use this command to completely dedicate a disk to
441 command must be used for this.