8 .Nd PC slice table maintenance utility
20 In order for the BIOS to boot the kernel,
21 certain conventions must be adhered to.
22 Sector 0 of the disk must contain boot code,
25 BIOS slices can be used to break the disk up into several pieces.
26 The BIOS brings in sector 0 and verifies the magic number.
28 0 boot code then searches the slice table to determine which
31 This boot code then brings in the bootstrap from the
32 active slice and, if marked bootable, runs it.
35 you can have one or more slices with one active.
39 utility can be used to divide space on the disk into slices and set one
46 serves a similar purpose to the
49 The first form is used to
50 display slice information or to interactively edit the slice
52 The second is used to write a slice table using a
54 and is designed to be used by other scripts/programs.
57 .Bl -tag -width indent
59 Change the active slice only.
64 Get the boot code from the file
69 Reinitialize the boot code contained in sector 0 of the disk.
73 .It Fl f Ar configfile
74 Set slice values using the file
78 only modifies explicitly specified slices, unless
80 is also given, in which case all existing slices are deleted (marked
90 in which case standard input is read.
92 .Sx CONFIGURATION FILE ,
93 below, for file syntax.
98 is used, you are not asked if you really want to write the slices
99 table (as you are in the interactive mode).
102 Initialize sector 0 of the disk.
103 Existing slice entries will be cleared
104 (marked as unused) before editing.
108 Initialize sector 0 slice table
111 slice covering the entire disk.
113 Print a slice table in
115 configuration file format and exit; see
116 .Sx CONFIGURATION FILE ,
119 Print summary information and exit.
121 Test mode; do not write slice values.
122 Generally used with the
124 option to see what would be written to the slice table.
128 Update (edit) the disk's sector 0 slice table.
138 prints out the slice table that is written to the disk.
140 Operate on a single slice table entry only.
146 The final disk name can be provided as a
148 disk name only, e.g.\&
150 or as a full pathname.
153 tries to figure out the default disk device name from the
156 When called with no arguments, it prints the sector 0 slice table.
159 ******* Working on device /dev/ad0 *******
160 parameters extracted from in-core disklabel are:
161 cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
163 parameters to be used for BIOS calculations are:
164 cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
166 Warning: BIOS sector numbering starts with sector 1
167 Information from DOS bootblock is:
168 The data for partition 1 is:
169 sysid 165,(FreeBSD/NetBSD/386BSD)
170 start 495, size 380160 (185 Meg), flag 0
171 beg: cyl 1/ sector 1/ head 0;
172 end: cyl 768/ sector 33/ head 14
173 The data for partition 2 is:
175 start 378180, size 2475 (1 Meg), flag 0
176 beg: cyl 764/ sector 1/ head 0;
177 end: cyl 768/ sector 33/ head 14
178 The data for partition 3 is:
180 The data for partition 4 is:
181 sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach)
182 start 380656, size 224234 (109 Meg), flag 80
183 beg: cyl 769/ sector 2/ head 0;
184 end: cyl 197/ sector 33/ head 14
187 The disk is divided into three slices that happen to fill the disk.
188 The second slice overlaps the end of the first.
189 (Used for debugging purposes.)
190 .Bl -tag -width ".Em cyl , sector No and Em head"
192 is used to label the slice.
195 magic number 165 decimal (A5 in hex).
201 fields provide the start address
202 and size of a slice in sectors.
204 specifies that this is the active slice.
210 fields are used to specify the beginning and end addresses of the slice.
214 these numbers are calculated using BIOS's understanding of the disk geometry
215 and saved in the bootblock.
221 flags are used to indicate that the slice data is to be updated.
224 option is also given,
226 will enter a conversational mode.
227 In this mode, no changes will be written to disk unless you explicitly tell
233 utility will display each slice and ask whether you want to edit it.
236 will step through each field, show you the old value,
237 and ask you for a new one.
238 When you are done with the slice,
240 will display it and ask you whether it is correct.
241 It will then proceed to the next entry.
247 fields correct is tricky, so by default,
248 they will be calculated for you;
249 you can specify them if you choose to though.
251 After all the slices are processed,
252 you are given the option to change the
255 Finally, when all the new data for sector 0 has been accumulated,
256 you are asked to confirm whether you really want to rewrite it.
258 The difference between the
265 flag edits (updates) the existing slice parameters
270 them (old values will be ignored);
271 if you edit the first slice,
273 will also set it up 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 the
279 geometry of the drive is.
280 These figures are taken from the in-core disklabel by default,
283 initially gives you an opportunity to change them.
284 This allows you to create a bootblock that can work with drives
285 that use geometry translation under the BIOS.
287 If you hand craft your disk layout,
288 please make sure that the
290 slice starts on a cylinder boundary.
292 Editing an existing slice will most likely result in the loss of
293 all data in that slice.
297 interactively once or twice to see how it works.
298 This is completely safe as long as you answer the last question
300 There are subtleties that
302 detects that are not fully explained in this manual page.
303 .Sh CONFIGURATION FILE
306 option is given, a disk's slice table can be written using values
309 The syntax of this file is very simple;
310 each line is either a comment or a specification, as follows:
311 .Bl -tag -width indent
312 .It Ic # Ar comment ...
313 Lines beginning with a
315 are comments and are ignored.
316 .It Ic g Ar spec1 spec2 spec3
317 Set the BIOS geometry used in slice calculations.
319 three values specified, with a letter preceding each number:
320 .Bl -tag -width indent
322 Set the number of cylinders to
325 Set the number of heads to
328 Set the number of sectors/track to
332 These specs can occur in any order, as the leading letter determines
333 which value is which; however, all three must be specified.
335 This line must occur before any lines that specify slice
338 It is an error if the following is not true:
339 .Bd -literal -offset indent
340 1 <= number of cylinders
341 1 <= number of heads <= 256
342 1 <= number of sectors/track < 64
345 The number of cylinders should be less than or equal to 1024, but this
346 is not enforced, although a warning will be printed.
351 file system) must lie completely within the
352 first 1024 cylinders; if this is not true, booting may fail.
353 Non-bootable slices do not have this restriction.
355 Example (all of these are equivalent), for a disk with 1019 cylinders,
356 39 heads, and 63 sectors:
357 .Bd -literal -offset indent
362 .It Ic p Ar slice type start length
363 Set the slice given by
373 Only those slices explicitly mentioned by these lines are modified;
374 any slice not referenced by a
376 line will not be modified.
377 However, if an invalid slice table is present, or the
379 option is specified, all existing slice entries will be cleared
380 (marked as unused), and these
382 lines will have to be used to
383 explicitly set slice information.
384 If multiple slices need to be
387 lines must be specified; one for each slice.
389 These slice lines must occur after any geometry specification lines,
397 Specifying a slice type of zero is
398 the same as clearing the slice and marking it as unused; however,
399 dummy values (such as
401 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 slice 4 and mark it as unused:
414 Example: to set slice 1 to a
416 slice, starting at sector 1
417 for 2503871 sectors (note: these numbers will be rounded upwards and
418 downwards to correspond to head and cylinder boundaries):
420 .Dl "p 1 165 1 2503871"
425 Can occur anywhere in the config file, but only
428 Example: to make slice 1 the active slice:
433 .Bl -tag -width ".Pa /boot/mbr" -compact
435 The default boot code.
442 The default boot code will not necessarily handle all slice types
443 correctly, in particular those introduced since
447 The entire utility should be made more user-friendly.
451 do not understand the difference between
455 causing difficulty to adjust.
457 You cannot use this command to completely dedicate a disk to
461 command must be used for this.