7 .Nd PC slice table maintenance utility
19 In order for the BIOS to boot the kernel,
20 certain conventions must be adhered to.
21 Sector 0 of the disk must contain boot code,
24 BIOS slices can be used to break the disk up into several pieces.
25 The BIOS brings in sector 0 and verifies the magic number.
27 0 boot code then searches the slice table to determine which
30 This boot code then brings in the bootstrap from the
31 active slice and, if marked bootable, runs it.
34 you can have one or more slices with one active.
38 utility can be used to divide space on the disk into slices and set one
42 This command is obsolete.
43 Users are advised to use
52 serves a similar purpose to the
55 The first form is used to
56 display slice information or to interactively edit the slice
58 The second is used to write a slice table using a
60 and is designed to be used by other scripts/programs.
63 .Bl -tag -width indent
65 Change the active slice only.
70 Get the boot code from the file
75 Reinitialize the boot code contained in sector 0 of the disk.
79 .It Fl f Ar configfile
80 Set slice values using the file
84 only modifies explicitly specified slices, unless
86 is also given, in which case all existing slices are deleted (marked
96 in which case standard input is read.
98 .Sx CONFIGURATION FILE ,
99 below, for file syntax.
104 is used, you are not asked if you really want to write the slices
105 table (as you are in the interactive mode).
108 Initialize sector 0 of the disk.
109 Existing slice entries will be cleared
110 (marked as unused) before editing.
114 Initialize sector 0 slice table
117 slice covering the entire disk.
119 Print a slice table in
121 configuration file format and exit; see
122 .Sx CONFIGURATION FILE ,
126 Benign warnings (such as "GEOM not found") are suppressed.
128 Print summary information and exit.
130 Test mode; do not write slice values.
131 Generally used with the
133 option to see what would be written to the slice table.
137 Update (edit) the disk's sector 0 slice table.
147 prints out the slice table that is written to the disk.
149 Operate on a single slice table entry only.
155 The final disk name can be provided as a
157 disk name only, e.g.\&
159 or as a full pathname.
162 tries to figure out the default disk device name from the
165 When called with no arguments, it prints the sector 0 slice table.
168 ******* Working on device /dev/ada0 *******
169 parameters extracted from in-core disklabel are:
170 cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
172 parameters to be used for BIOS calculations are:
173 cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
175 Warning: BIOS sector numbering starts with sector 1
176 Information from DOS bootblock is:
177 The data for partition 1 is:
178 sysid 165,(FreeBSD/NetBSD/386BSD)
179 start 495, size 380160 (185 Meg), flag 0
180 beg: cyl 1/ sector 1/ head 0;
181 end: cyl 768/ sector 33/ head 14
182 The data for partition 2 is:
184 start 378180, size 2475 (1 Meg), flag 0
185 beg: cyl 764/ sector 1/ head 0;
186 end: cyl 768/ sector 33/ head 14
187 The data for partition 3 is:
189 The data for partition 4 is:
190 sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach)
191 start 380656, size 224234 (109 Meg), flag 80
192 beg: cyl 769/ sector 2/ head 0;
193 end: cyl 197/ sector 33/ head 14
196 The disk is divided into three slices that happen to fill the disk.
197 The second slice overlaps the end of the first.
198 (Used for debugging purposes.)
199 .Bl -tag -width ".Em cyl , sector No and Em head"
201 is used to label the slice.
204 magic number 165 decimal (A5 in hex).
210 fields provide the start address
211 and size of a slice in sectors.
213 specifies that this is the active slice.
219 fields are used to specify the beginning and end addresses of the slice.
223 these numbers are calculated using BIOS's understanding of the disk geometry
224 and saved in the bootblock.
230 flags are used to indicate that the slice data is to be updated.
233 option is also given,
235 will enter a conversational mode.
236 In this mode, no changes will be written to disk unless you explicitly tell
242 utility will display each slice and ask whether you want to edit it.
245 will step through each field, show you the old value,
246 and ask you for a new one.
247 When you are done with the slice,
249 will display it and ask you whether it is correct.
250 It will then proceed to the next entry.
256 fields correct is tricky, so by default,
257 they will be calculated for you;
258 you can specify them if you choose to though.
260 After all the slices are processed,
261 you are given the option to change the
264 Finally, when all the new data for sector 0 has been accumulated,
265 you are asked to confirm whether you really want to rewrite it.
267 The difference between the
274 flag edits (updates) the existing slice parameters
279 them (old values will be ignored);
280 if you edit the first slice,
282 will also set it up to use the whole disk for
286 The automatic calculation of starting cylinder etc.\& uses
287 a set of figures that represent what the BIOS thinks the
288 geometry of the drive is.
289 These figures are taken from the in-core disklabel by default,
292 initially gives you an opportunity to change them.
293 This allows you to create a bootblock that can work with drives
294 that use geometry translation under the BIOS.
296 If you hand craft your disk layout,
297 please make sure that the
299 slice starts on a cylinder boundary.
301 Editing an existing slice will most likely result in the loss of
302 all data in that slice.
306 interactively once or twice to see how it works.
307 This is completely safe as long as you answer the last question
309 There are subtleties that
311 detects that are not fully explained in this manual page.
312 .Sh CONFIGURATION FILE
315 option is given, a disk's slice table can be written using values
318 The syntax of this file is very simple;
319 each line is either a comment or a specification, as follows:
320 .Bl -tag -width indent
321 .It Ic # Ar comment ...
322 Lines beginning with a
324 are comments and are ignored.
325 .It Ic g Ar spec1 spec2 spec3
326 Set the BIOS geometry used in slice calculations.
328 three values specified, with a letter preceding each number:
329 .Bl -tag -width indent
331 Set the number of cylinders to
334 Set the number of heads to
337 Set the number of sectors/track to
341 These specs can occur in any order, as the leading letter determines
342 which value is which; however, all three must be specified.
344 This line must occur before any lines that specify slice
347 It is an error if the following is not true:
348 .Bd -literal -offset indent
349 1 <= number of cylinders
350 1 <= number of heads <= 256
351 1 <= number of sectors/track < 64
354 The number of cylinders should be less than or equal to 1024, but this
355 is not enforced, although a warning will be printed.
360 file system) must lie completely within the
361 first 1024 cylinders; if this is not true, booting may fail.
362 Non-bootable slices do not have this restriction.
364 Example (all of these are equivalent), for a disk with 1019 cylinders,
365 39 heads, and 63 sectors:
366 .Bd -literal -offset indent
371 .It Ic p Ar slice type start length
372 Set the slice given by
395 measurement respectively.
400 it is set to the value of the previous partition end.
405 the partition end is set to the end of the disk.
407 Only those slices explicitly mentioned by these lines are modified;
408 any slice not referenced by a
410 line will not be modified.
411 However, if an invalid slice table is present, or the
413 option is specified, all existing slice entries will be cleared
414 (marked as unused), and these
416 lines will have to be used to
417 explicitly set slice information.
418 If multiple slices need to be
421 lines must be specified; one for each slice.
423 These slice lines must occur after any geometry specification lines,
431 Specifying a slice type of zero is
432 the same as clearing the slice and marking it as unused; however,
433 dummy values (such as
435 must still be specified for
440 Note: the start offset will be rounded upwards to a head boundary if
441 necessary, and the end offset will be rounded downwards to a cylinder
442 boundary if necessary.
444 Example: to clear slice 4 and mark it as unused:
448 Example: to set slice 1 to a
450 slice, starting at sector 1
451 for 2503871 sectors (note: these numbers will be rounded upwards and
452 downwards to correspond to head and cylinder boundaries):
454 .Dl "p 1 165 1 2503871"
456 Example: to set slices 1, 2 and 4 to
458 slices, the first being 2 Gigabytes, the second being 10 Gigabytes and the
459 forth being the remainder of the disk (again, numbers will be rounded
470 Can occur anywhere in the config file, but only
473 Example: to make slice 1 the active slice:
478 .Bl -tag -width ".Pa /boot/mbr" -compact
480 The default boot code.
490 first appeared in the Mach Operating System.
491 It was subsequently ported to
496 for Mach Operating System was written by
497 .An Robert Baron Aq Mt rvb@cs.cmu.edu .
501 .An Julian Elischer Aq Mt julian@tfs.com .
503 The default boot code will not necessarily handle all slice types
504 correctly, in particular those introduced since
508 The entire utility should be made more user-friendly.
512 do not understand the difference between
516 causing difficulty to adjust.
518 You cannot use this command to completely dedicate a disk to
522 command must be used for this.