xref: /dflybsd-src/sbin/fdisk/fdisk.8 (revision 0b9204869b3132ae8528b805014cb92d5e82975b)
1fca180e3SMatthew Dillon.\" $FreeBSD: src/sbin/i386/fdisk/fdisk.8,v 1.17.2.11 2002/04/25 16:25:12 trhodes Exp $
2fca180e3SMatthew Dillon.\"
37d89978dSSascha Wildner.Dd February 14, 2020
4fca180e3SMatthew Dillon.Dt FDISK 8
5fca180e3SMatthew Dillon.Os
6fca180e3SMatthew Dillon.Sh NAME
7fca180e3SMatthew Dillon.Nm fdisk
8fca180e3SMatthew Dillon.Nd PC slice table (MBR) maintenance program
9fca180e3SMatthew Dillon.Sh SYNOPSIS
10fca180e3SMatthew Dillon.Nm
11*0b920486SMatthew Dillon.Op Fl BCEIaistux
12fca180e3SMatthew Dillon.Op Fl b Ar bootcode
13fca180e3SMatthew Dillon.Op Fl p Ar diskimage
14fca180e3SMatthew Dillon.Op Fl 1234
15fca180e3SMatthew Dillon.Op Ar disk
16fca180e3SMatthew Dillon.Nm
17fca180e3SMatthew Dillon.Fl f Ar configfile
18fca180e3SMatthew Dillon.Op Fl itv
19fca180e3SMatthew Dillon.Op Ar disk
20fca180e3SMatthew Dillon.Sh PROLOGUE
21fca180e3SMatthew DillonIn order for the BIOS to boot the kernel,
22fca180e3SMatthew Dilloncertain conventions must be adhered to.
23fca180e3SMatthew DillonSector 0 of the disk must contain an MBR, which contain boot code,
24fca180e3SMatthew Dillona slice table,
25fca180e3SMatthew Dillonand a magic number.
26fca180e3SMatthew DillonBIOS slices can be used to break the disk up into several pieces.
27fca180e3SMatthew Dillon.Dx
28fca180e3SMatthew Dillonslices are called partitions under DOS
29fca180e3SMatthew Dillon.Dq ( partition
30fca180e3SMatthew Dillonhas another meaning under
31fca180e3SMatthew Dillon.Dx ,
32fca180e3SMatthew Dillonsee
33fca180e3SMatthew Dillon.Xr disklabel 8 ) .
34fca180e3SMatthew Dillon.Dx
35fca180e3SMatthew Dillonsupports 30 MBR slices, s1-s4 will be DOS primary partitions,
36fca180e3SMatthew Dillons5-s30 will be DOS partitions in extended DOS partitions.
37fca180e3SMatthew DillonThe BIOS brings in sector 0 and verifies the magic number.
38fca180e3SMatthew DillonThe sector
39fca180e3SMatthew Dillon0 boot code then searches the slice table to determine which
40fca180e3SMatthew Dillonslice is marked
41fca180e3SMatthew Dillon.Em active .
42fca180e3SMatthew DillonThis boot code then brings in the bootstrap from the
43fca180e3SMatthew Dillon.Em active
44fca180e3SMatthew Dillonslice and, if marked bootable, runs it.
45fca180e3SMatthew DillonUnder DOS,
46fca180e3SMatthew Dillonyou can have one or more slices with one
47fca180e3SMatthew Dillon.Em active .
48fca180e3SMatthew DillonThe DOS
49fca180e3SMatthew Dillon.Nm
50fca180e3SMatthew Dillonprogram can be used to divide space on the disk into slices and set one
51fca180e3SMatthew Dillon.Em active .
52fca180e3SMatthew Dillon.Sh DESCRIPTION
53fca180e3SMatthew DillonThe
54fca180e3SMatthew Dillon.Dx
55fca180e3SMatthew Dillonprogram,
56fca180e3SMatthew Dillon.Nm ,
57fca180e3SMatthew Dillonserves a similar purpose to the DOS program.
58fca180e3SMatthew DillonThe first form is used to
59fca180e3SMatthew Dillondisplay slice information or to interactively edit the slice table.
60fca180e3SMatthew DillonThe second is used to write a slice table using a
61fca180e3SMatthew Dillon.Ar configfile
62fca180e3SMatthew Dillonand is designed to be used by other scripts/programs.
63fca180e3SMatthew Dillon.Pp
64fca180e3SMatthew DillonOptions are:
65fca180e3SMatthew Dillon.Bl -tag -width indent
66fca180e3SMatthew Dillon.It Fl a
67fca180e3SMatthew DillonChange the active slice only.
68fca180e3SMatthew DillonIgnored if
69fca180e3SMatthew Dillon.Fl f
70fca180e3SMatthew Dillonis given.
71fca180e3SMatthew Dillon.It Fl b Ar bootcode
72fca180e3SMatthew DillonGet the boot code from the file
73fca180e3SMatthew Dillon.Ar bootcode .
74fca180e3SMatthew DillonDefault is
75fca180e3SMatthew Dillon.Pa /boot/mbr .
76fca180e3SMatthew Dillon.It Fl p Ar diskimage
77fca180e3SMatthew DillonThe disk image is specified as a normal file instead of as a device,
78fca180e3SMatthew Dillonwhich is useful when building emulated disks for vmware, bochs, etc.\&
79fca180e3SMatthew Dillon.It Fl B
80fca180e3SMatthew DillonReinitialize the boot code contained in sector 0 of the disk.
81fca180e3SMatthew DillonIgnored if
82fca180e3SMatthew Dillon.Fl f
83fca180e3SMatthew Dillonis given.
84fca180e3SMatthew Dillon.It Fl C
85fca180e3SMatthew DillonSet CHS fields to wrapped values.
86fca180e3SMatthew DillonNormally the CHS fields for a slice are set to all 1's if they
87fca180e3SMatthew Dillonwould otherwise wrap.
88fca180e3SMatthew DillonThis typically causes BIOSes to properly detect
89fca180e3SMatthew Dillonthat the disk should be put in Large mode.
90fca180e3SMatthew DillonThis option may be needed on very old PCs.
91e0fb398bSTim.It Fl E
927b8c2c90SSascha WildnerUse TRIM to erase the device/partition before creating the file system.
937b8c2c90SSascha WildnerThe underlying device must have the TRIM sysctl enabled.
947b8c2c90SSascha WildnerOnly devices that support TRIM will have such a sysctl option
957b8c2c90SSascha Wildner.Va ( kern.cam.da.X.trim_enabled ) .
967b8c2c90SSascha WildnerFor use with the
97e0fb398bSTim.Fl I
98e0fb398bSTimor
99e0fb398bSTim.Fl u
100e0fb398bSTimoption.
101fca180e3SMatthew Dillon.It Fl f Ar configfile
102fca180e3SMatthew DillonSet slice values using the file
103fca180e3SMatthew Dillon.Ar configfile .
104fca180e3SMatthew DillonThe
105fca180e3SMatthew Dillon.Ar configfile
106fca180e3SMatthew Dillonalways modifies existing slices, unless
107fca180e3SMatthew Dillon.Fl i
108fca180e3SMatthew Dillonis also given, in which case all existing slices are deleted (marked
109fca180e3SMatthew Dillonas
110fca180e3SMatthew Dillon.Dq unused )
111fca180e3SMatthew Dillonbefore the
112fca180e3SMatthew Dillon.Ar configfile
113fca180e3SMatthew Dillonis read.
114fca180e3SMatthew DillonThe
115fca180e3SMatthew Dillon.Ar configfile
116fca180e3SMatthew Dilloncan be
117fca180e3SMatthew Dillon.Sq - ,
118fca180e3SMatthew Dillonin which case
119fca180e3SMatthew Dillon.Ar stdin
120fca180e3SMatthew Dillonis read.
121fca180e3SMatthew DillonSee
122fca180e3SMatthew Dillon.Sx CONFIGURATION FILE ,
123fca180e3SMatthew Dillonbelow, for file syntax.
124fca180e3SMatthew Dillon.Pp
125fca180e3SMatthew Dillon.Em WARNING :
126fca180e3SMatthew Dillonwhen
127fca180e3SMatthew Dillon.Fl f
128fca180e3SMatthew Dillonis used, you are not asked if you really want to write the slices
129fca180e3SMatthew Dillontable (as you are in the interactive mode).
130fca180e3SMatthew DillonUse with caution!
131fca180e3SMatthew Dillon.It Fl i
132fca180e3SMatthew DillonInitialize sector 0 of the disk.
133fca180e3SMatthew DillonThis implies
134fca180e3SMatthew Dillon.Fl u ,
135fca180e3SMatthew Dillonunless
136fca180e3SMatthew Dillon.Fl f
137fca180e3SMatthew Dillonis given.
138fca180e3SMatthew Dillon.It Fl I
139fca180e3SMatthew DillonInitialize the contents of sector 0
140fca180e3SMatthew Dillonfor one
141fca180e3SMatthew Dillon.Dx
142fca180e3SMatthew Dillonslice covering the entire disk.
143fca180e3SMatthew Dillon.It Fl s
144fca180e3SMatthew DillonPrint a summary of all slices on the disk and exit.
145fca180e3SMatthew DillonAll other options will be ignored.
146fca180e3SMatthew Dillon.It Fl t
147fca180e3SMatthew DillonTest mode; do not write slice values.
148fca180e3SMatthew DillonGenerally used with the
149fca180e3SMatthew Dillon.Fl f
150fca180e3SMatthew Dillonoption to see what would be written to the slice table.
151fca180e3SMatthew DillonImplies
152fca180e3SMatthew Dillon.Fl v .
153fca180e3SMatthew Dillon.It Fl u
154fca180e3SMatthew DillonIs used for updating (editing) sector 0 of the disk.
155fca180e3SMatthew DillonIgnored if
156fca180e3SMatthew Dillon.Fl f
157fca180e3SMatthew Dillonis given.
158fca180e3SMatthew Dillon.It Fl v
159fca180e3SMatthew DillonBe verbose.
160fca180e3SMatthew DillonWhen
161fca180e3SMatthew Dillon.Fl f
162fca180e3SMatthew Dillonis used,
163fca180e3SMatthew Dillon.Nm
164fca180e3SMatthew Dillonprints out the slice table that is written to the disk.
165*0b920486SMatthew Dillon.It Fl x
166*0b920486SMatthew DillonExpand the last valid slice in an existing fdisk table to fit
167*0b920486SMatthew Dillonthe device.  Used to expand traditional DOS labels when the underlying
168*0b920486SMatthew Dillonstorage has been enlarged, or the image has been copied to a larger
169*0b920486SMatthew Dillondevice.
170*0b920486SMatthew Dillon.Pp
171*0b920486SMatthew DillonThis feature does not work on GPT partitions, use 'gpt expand device'
172*0b920486SMatthew Dilloninstead.
173fca180e3SMatthew Dillon.It Fl 1234
174fca180e3SMatthew DillonOperate on a single fdisk entry only.
175fca180e3SMatthew DillonIgnored if
176fca180e3SMatthew Dillon.Fl f
177fca180e3SMatthew Dillonis given.
178fca180e3SMatthew Dillon.El
179fca180e3SMatthew Dillon.Pp
180fca180e3SMatthew DillonThe final disk name can be provided as a
181fca180e3SMatthew Dillon.Sq bare
182fca180e3SMatthew Dillondisk name only, e.g.\&
183fca180e3SMatthew Dillon.Pa da0 ,
184fca180e3SMatthew Dillonor as a fully qualified device node under
185fca180e3SMatthew Dillon.Pa /dev .
186fca180e3SMatthew DillonIf omitted, the disks
187fca180e3SMatthew Dillon.Pa ad0 ,
188fca180e3SMatthew Dillon.Pa da0
189fca180e3SMatthew Dillonand
190fca180e3SMatthew Dillon.Pa vkd0
191fca180e3SMatthew Dillonare searched in that order, until one is found to respond.
192fca180e3SMatthew Dillon.Pp
193fca180e3SMatthew DillonWhen called without options,
194fca180e3SMatthew Dillon.Nm
195fca180e3SMatthew Dillonprints the sector 0 slice table.
196fca180e3SMatthew DillonAn example follows:
197fca180e3SMatthew Dillon.Bd -literal
198fca180e3SMatthew Dillon	******* Working on device /dev/ad0 *******
199fca180e3SMatthew Dillon	parameters extracted from in-core disklabel are:
200fca180e3SMatthew Dillon	cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
201fca180e3SMatthew Dillon
202fca180e3SMatthew Dillon	parameters to be used for BIOS calculations are:
203fca180e3SMatthew Dillon	cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
204fca180e3SMatthew Dillon
205fca180e3SMatthew Dillon	Warning: BIOS sector numbering starts with sector 1
206fca180e3SMatthew Dillon	Information from DOS bootblock is:
207fca180e3SMatthew Dillon	The data for partition 1 is:
2087d89978dSSascha Wildner	sysid 108,(DragonFly BSD)
209fca180e3SMatthew Dillon	    start 495, size 380160 (185 Meg), flag 0
210fca180e3SMatthew Dillon		beg: cyl 1/ sector 1/ head 0;
211fca180e3SMatthew Dillon		end: cyl 768/ sector 33/ head 14
212fca180e3SMatthew Dillon	The data for partition 2 is:
213fca180e3SMatthew Dillon	sysid 164,(unknown)
214fca180e3SMatthew Dillon	    start 378180, size 2475 (1 Meg), flag 0
215fca180e3SMatthew Dillon		beg: cyl 764/ sector 1/ head 0;
216fca180e3SMatthew Dillon		end: cyl 768/ sector 33/ head 14
217fca180e3SMatthew Dillon	The data for partition 3 is:
218fca180e3SMatthew Dillon	<UNUSED>
219fca180e3SMatthew Dillon	The data for partition 4 is:
220fca180e3SMatthew Dillon	sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach)
221fca180e3SMatthew Dillon	    start 380656, size 224234 (109 Meg), flag 80
222fca180e3SMatthew Dillon		beg: cyl 769/ sector 2/ head 0;
223fca180e3SMatthew Dillon		end: cyl 197/ sector 33/ head 14
224fca180e3SMatthew Dillon.Ed
225fca180e3SMatthew Dillon.Pp
226fca180e3SMatthew DillonThe disk is divided into three slices that happen to fill the disk.
227fca180e3SMatthew DillonThe second slice overlaps the end of the first.
228fca180e3SMatthew Dillon(Used for debugging purposes.)
229fca180e3SMatthew Dillon.Bl -tag -width "cyl, sector and head"
230fca180e3SMatthew Dillon.It Em "sysid"
231fca180e3SMatthew Dillonis used to label the slice.
232fca180e3SMatthew Dillon.Dx
2334db76ef7SAaron LIreserves the magic number 108 decimal (6C in hexadecimal).
234fca180e3SMatthew Dillon.It Em start No and Em size
235fca180e3SMatthew Dillonfields provide the start address
236fca180e3SMatthew Dillonand size of a slice in sectors.
237fca180e3SMatthew Dillon.It Em "flag 80"
238fca180e3SMatthew Dillonspecifies that this is the active slice.
239fca180e3SMatthew Dillon.It Em cyl , sector No and Em head
240fca180e3SMatthew Dillonfields are used to specify the beginning and end addresses of the slice.
241fca180e3SMatthew Dillon.It Em Note :
242fca180e3SMatthew Dillonthese numbers are calculated using BIOS's understanding of the disk geometry
243fca180e3SMatthew Dillonand saved in the bootblock.
244fca180e3SMatthew Dillon.El
245fca180e3SMatthew Dillon.Pp
246fca180e3SMatthew DillonThe
247fca180e3SMatthew Dillon.Fl i
248fca180e3SMatthew Dillonand
249fca180e3SMatthew Dillon.Fl u
250fca180e3SMatthew Dillonflags are used to indicate that the slice data is to be updated.
251fca180e3SMatthew DillonUnless the
252fca180e3SMatthew Dillon.Fl f
253fca180e3SMatthew Dillonoption is also given,
254fca180e3SMatthew Dillon.Nm
255fca180e3SMatthew Dillonwill enter a conversational mode.
256fca180e3SMatthew DillonIn this mode, no changes will be written to disk unless you explicitly tell
257fca180e3SMatthew Dillon.Nm
258fca180e3SMatthew Dillonto.
259fca180e3SMatthew Dillon.Pp
260fca180e3SMatthew Dillon.Nm Fdisk
261fca180e3SMatthew Dillonwill display each slice and ask whether you want to edit it.
262fca180e3SMatthew DillonIf you say yes,
263fca180e3SMatthew Dillon.Nm
264fca180e3SMatthew Dillonwill step through each field, show you the old value,
265fca180e3SMatthew Dillonand ask you for a new one.
266fca180e3SMatthew DillonWhen you are done with the slice,
267fca180e3SMatthew Dillon.Nm
268fca180e3SMatthew Dillonwill display it and ask you whether it is correct.
269fca180e3SMatthew Dillon.Nm Fdisk
270fca180e3SMatthew Dillonwill then proceed to the next entry.
271fca180e3SMatthew Dillon.Pp
272fca180e3SMatthew DillonGetting the
273fca180e3SMatthew Dillon.Em cyl , sector ,
274fca180e3SMatthew Dillonand
275fca180e3SMatthew Dillon.Em head
276fca180e3SMatthew Dillonfields correct is tricky, so by default,
277fca180e3SMatthew Dillonthey will be calculated for you;
278fca180e3SMatthew Dillonyou can specify them if you choose to though.
279fca180e3SMatthew Dillon.Pp
280fca180e3SMatthew DillonAfter all the slices are processed,
281fca180e3SMatthew Dillonyou are given the option to change the
282fca180e3SMatthew Dillon.Em active
283fca180e3SMatthew Dillonslice.
284fca180e3SMatthew DillonFinally, when all the new data for sector 0 has been accumulated,
285fca180e3SMatthew Dillonyou are asked to confirm whether you really want to rewrite it.
286fca180e3SMatthew Dillon.Pp
287fca180e3SMatthew DillonThe difference between the
288fca180e3SMatthew Dillon.Fl u
289fca180e3SMatthew Dillonand
290fca180e3SMatthew Dillon.Fl i
291fca180e3SMatthew Dillonflags is that
292fca180e3SMatthew Dillonthe
293fca180e3SMatthew Dillon.Fl u
294fca180e3SMatthew Dillonflag just edits (updates) the fields as they appear on the disk,
295fca180e3SMatthew Dillonwhile the
296fca180e3SMatthew Dillon.Fl i
297fca180e3SMatthew Dillonflag is used to
298fca180e3SMatthew Dillon.Dq initialize
299fca180e3SMatthew Dillonsector 0;
300fca180e3SMatthew Dillonit will set up the last BIOS slice to use the whole disk for
301fca180e3SMatthew Dillon.Dx
302fca180e3SMatthew Dillonand make it active.
303fca180e3SMatthew Dillon.Sh NOTES
304fca180e3SMatthew DillonThe automatic calculation of starting cylinder etc.\& uses
305fca180e3SMatthew Dillona set of figures that represent what the BIOS thinks the
306fca180e3SMatthew Dillongeometry of the drive is.
307fca180e3SMatthew DillonThese figures are taken from the in-core disklabel by default,
308fca180e3SMatthew Dillonbut
309fca180e3SMatthew Dillon.Nm
310fca180e3SMatthew Dilloninitially gives you an opportunity to change them.
311fca180e3SMatthew DillonThis allows you to create a bootblock that can work with drives
312fca180e3SMatthew Dillonthat use geometry translation under the BIOS.
313fca180e3SMatthew Dillon.Pp
314fca180e3SMatthew DillonIf you hand craft your disk layout,
315fca180e3SMatthew Dillonplease make sure that the
316fca180e3SMatthew Dillon.Dx
317fca180e3SMatthew Dillonslice starts on a cylinder boundary.
318fca180e3SMatthew DillonA number of decisions made later may assume this.
319fca180e3SMatthew Dillon(This might not be necessary later.)
320fca180e3SMatthew Dillon.Pp
321fca180e3SMatthew DillonEditing an existing slice will most likely result in the loss of
322fca180e3SMatthew Dillonall data in that slice.
323fca180e3SMatthew Dillon.Pp
324fca180e3SMatthew DillonYou should run
325fca180e3SMatthew Dillon.Nm
326fca180e3SMatthew Dilloninteractively once or twice to see how it works.
327fca180e3SMatthew DillonThis is completely safe as long as you answer the last question
328fca180e3SMatthew Dillonin the negative.
329fca180e3SMatthew DillonThere are subtleties that
330fca180e3SMatthew Dillon.Nm
331fca180e3SMatthew Dillondetects that are not fully explained in this manual page.
332fca180e3SMatthew Dillon.Sh CONFIGURATION FILE
333fca180e3SMatthew DillonWhen the
334fca180e3SMatthew Dillon.Fl f
335fca180e3SMatthew Dillonoption is given, a disk's slice table can be written using values
336fca180e3SMatthew Dillonfrom a
337fca180e3SMatthew Dillon.Ar configfile .
338fca180e3SMatthew DillonThe syntax of this file is very simple;
339fca180e3SMatthew Dilloneach line is either a comment or a specification, as follows:
340fca180e3SMatthew Dillon.Bl -tag -width Ds
341fca180e3SMatthew Dillon.It Xo
342fca180e3SMatthew Dillon.Ic #
343fca180e3SMatthew Dillon.Ar comment ...
344fca180e3SMatthew Dillon.Xc
345fca180e3SMatthew DillonLines beginning with a
346fca180e3SMatthew Dillon.Sq #
347fca180e3SMatthew Dillonare comments and are ignored.
348fca180e3SMatthew Dillon.It Xo
349fca180e3SMatthew Dillon.Ic g
350fca180e3SMatthew Dillon.Ar spec1
351fca180e3SMatthew Dillon.Ar spec2
352fca180e3SMatthew Dillon.Ar spec3
353fca180e3SMatthew Dillon.Xc
354fca180e3SMatthew DillonSet the BIOS geometry used in slice calculations.
355fca180e3SMatthew DillonThere must be
356fca180e3SMatthew Dillonthree values specified, with a letter preceding each number:
357fca180e3SMatthew Dillon.Bl -tag -width Ds
358fca180e3SMatthew Dillon.Sm off
359fca180e3SMatthew Dillon.It Cm c Ar num
360fca180e3SMatthew Dillon.Sm on
361fca180e3SMatthew DillonSet the number of cylinders to
362fca180e3SMatthew Dillon.Ar num .
363fca180e3SMatthew Dillon.Sm off
364fca180e3SMatthew Dillon.It Cm h Ar num
365fca180e3SMatthew Dillon.Sm on
366fca180e3SMatthew DillonSet the number of heads to
367fca180e3SMatthew Dillon.Ar num .
368fca180e3SMatthew Dillon.Sm off
369fca180e3SMatthew Dillon.It Cm s Ar num
370fca180e3SMatthew Dillon.Sm on
371fca180e3SMatthew DillonSet the number of sectors/track to
372fca180e3SMatthew Dillon.Ar num .
373fca180e3SMatthew Dillon.El
374fca180e3SMatthew Dillon.Pp
375fca180e3SMatthew DillonThese specs can occur in any order, as the leading letter determines
376fca180e3SMatthew Dillonwhich value is which; however, all three must be specified.
377fca180e3SMatthew Dillon.Pp
378fca180e3SMatthew DillonThis line must occur before any lines that specify slice
379fca180e3SMatthew Dilloninformation.
380fca180e3SMatthew Dillon.Pp
381fca180e3SMatthew DillonIt is an error if the following is not true:
382fca180e3SMatthew Dillon.Bd -literal -offset indent
383fca180e3SMatthew Dillon1 \(<= number of cylinders
384fca180e3SMatthew Dillon1 \(<= number of heads \(<= 256
385fca180e3SMatthew Dillon1 \(<= number of sectors/track < 64
386fca180e3SMatthew Dillon.Ed
387fca180e3SMatthew Dillon.Pp
388fca180e3SMatthew DillonThe number of cylinders should be less than or equal to 1024, but this
389fca180e3SMatthew Dillonis not enforced, although a warning will be printed.
390fca180e3SMatthew DillonNote that a bootable
391fca180e3SMatthew Dillon.Dx
392fca180e3SMatthew Dillonslice (the
393fca180e3SMatthew Dillon.Dq Pa /
394fca180e3SMatthew Dillonfile system) must lie completely within the
395fca180e3SMatthew Dillonfirst 1024 cylinders, if
396fca180e3SMatthew Dillon.Dq packet
397fca180e3SMatthew Dillonmode isn't used, see
398fca180e3SMatthew Dillon.Xr boot0cfg 8 ;
399fca180e3SMatthew Dillonif this is not true, booting may fail.
400fca180e3SMatthew DillonNon-bootable slices do not have this restriction.
401fca180e3SMatthew Dillon.Pp
402fca180e3SMatthew DillonExample (all of these are equivalent), for a disk with 1019 cylinders,
403fca180e3SMatthew Dillon39 heads, and 63 sectors:
404fca180e3SMatthew Dillon.Bd -literal -offset indent
405fca180e3SMatthew Dillong       c1019   h39     s63
406fca180e3SMatthew Dillong       h39     c1019   s63
407fca180e3SMatthew Dillong       s63     h39     c1019
408fca180e3SMatthew Dillon.Ed
409fca180e3SMatthew Dillon.It Xo
410fca180e3SMatthew Dillon.Ic p
411fca180e3SMatthew Dillon.Ar slice
412fca180e3SMatthew Dillon.Ar type
413fca180e3SMatthew Dillon.Ar start
414fca180e3SMatthew Dillon.Ar length
415fca180e3SMatthew Dillon.Xc
416fca180e3SMatthew DillonSet the slice given by
417fca180e3SMatthew Dillon.Ar slice
418fca180e3SMatthew Dillon(1-4) to type
419fca180e3SMatthew Dillon.Ar type ,
420fca180e3SMatthew Dillonstarting at sector
421fca180e3SMatthew Dillon.Ar start
422fca180e3SMatthew Dillonfor
423fca180e3SMatthew Dillon.Ar length
424fca180e3SMatthew Dillonsectors.
425fca180e3SMatthew Dillon.Pp
426fca180e3SMatthew DillonOnly those slices explicitly mentioned by these lines are modified;
427fca180e3SMatthew Dillonany slice not referenced by a
428fca180e3SMatthew Dillon.Cm p
429fca180e3SMatthew Dillonline will not be modified.
430fca180e3SMatthew DillonHowever, if an invalid slice table is present, or the
431fca180e3SMatthew Dillon.Fl i
432fca180e3SMatthew Dillonoption is specified, all existing slice entries will be cleared
433fca180e3SMatthew Dillon(marked as unused), and these
434fca180e3SMatthew Dillon.Cm p
435fca180e3SMatthew Dillonlines will have to be used to
436fca180e3SMatthew Dillonexplicitly set slice information.
437fca180e3SMatthew DillonIf multiple slices need to be
438fca180e3SMatthew Dillonset, multiple
439fca180e3SMatthew Dillon.Cm p
440fca180e3SMatthew Dillonlines must be specified; one for each slice.
441fca180e3SMatthew Dillon.Pp
442fca180e3SMatthew DillonThese slice lines must occur after any geometry specification lines,
443fca180e3SMatthew Dillonif one is present.
444fca180e3SMatthew Dillon.Pp
445fca180e3SMatthew DillonThe
446fca180e3SMatthew Dillon.Ar type
4474db76ef7SAaron LIis 108 for
448fca180e3SMatthew Dillon.Dx
449fca180e3SMatthew Dillonslices.
450fca180e3SMatthew DillonSpecifying a slice type of zero is
451fca180e3SMatthew Dillonthe same as clearing the slice and marking it as unused; however,
452fca180e3SMatthew Dillondummy values (such as
453fca180e3SMatthew Dillon.Sq 0 )
454fca180e3SMatthew Dillonmust still be specified for
455fca180e3SMatthew Dillon.Ar start
456fca180e3SMatthew Dillonand
457fca180e3SMatthew Dillon.Ar length .
458fca180e3SMatthew Dillon.Pp
459fca180e3SMatthew DillonNote: the start offset will be rounded upwards to a head boundary if
460fca180e3SMatthew Dillonnecessary, and the end offset will be rounded downwards to a cylinder
461fca180e3SMatthew Dillonboundary if necessary.
462fca180e3SMatthew Dillon.Pp
463fca180e3SMatthew DillonExample: to clear slice 4 and mark it as unused:
464fca180e3SMatthew Dillon.Bd -literal -offset indent
465fca180e3SMatthew Dillonp       4       0       0       0
466fca180e3SMatthew Dillon.Ed
467fca180e3SMatthew Dillon.Pp
468fca180e3SMatthew DillonExample: to set slice 1 to a
469fca180e3SMatthew Dillon.Dx
470fca180e3SMatthew Dillonslice, starting at sector 1
471fca180e3SMatthew Dillonfor 2503871 sectors (note: these numbers will be rounded upwards and
472fca180e3SMatthew Dillondownwards to correspond to head and cylinder boundaries):
473fca180e3SMatthew Dillon.Bd -literal -offset indent
4744db76ef7SAaron LIp       1       108     1       2503871
475fca180e3SMatthew Dillon.Ed
476fca180e3SMatthew Dillon.It Xo
477fca180e3SMatthew Dillon.Ic a
478fca180e3SMatthew Dillon.Ar slice
479fca180e3SMatthew Dillon.Xc
480fca180e3SMatthew DillonMake
481fca180e3SMatthew Dillon.Ar slice
482fca180e3SMatthew Dillonthe active slice.
483fca180e3SMatthew DillonCan occur anywhere in the config file, but only
484fca180e3SMatthew Dillonone must be present.
485fca180e3SMatthew DillonIf no
486fca180e3SMatthew Dillon.Cm a
487fca180e3SMatthew Dillonline is present, all slices of the disk are made inactive.
488fca180e3SMatthew Dillon.Pp
489fca180e3SMatthew DillonExample: to make slice 1 the active slice:
490fca180e3SMatthew Dillon.Bd -literal -offset indent
491fca180e3SMatthew Dillona       1
492fca180e3SMatthew Dillon.Ed
493fca180e3SMatthew Dillon.El
494fca180e3SMatthew Dillon.Sh FILES
495fca180e3SMatthew Dillon.Bl -tag -width /boot/mbr -compact
496fca180e3SMatthew Dillon.It Pa /boot/mbr
497fca180e3SMatthew DillonThe default boot code
498fca180e3SMatthew Dillon.El
499fca180e3SMatthew Dillon.Sh COMPATIBILITY
500fca180e3SMatthew DillonDue to the use of 32 bit to store the number of sectors in the MBR,
501fca180e3SMatthew Dillon.Nm
502fca180e3SMatthew Dilloncan at most use 2^32 - 1 sectors.
503fca180e3SMatthew DillonFor the prevalent sector size of 512B this means a maximum of 2TB.
504fca180e3SMatthew DillonLarger disks should be partitioned using
505fca180e3SMatthew Dillon.Xr gpt 8 .
506fca180e3SMatthew Dillon.Pp
507fca180e3SMatthew DillonThe MBR that
508fca180e3SMatthew Dillon.Nm
509fca180e3SMatthew Dillonmanipulates, is used by many different OSs, but the exact requirements seems to differ,
510fca180e3SMatthew Dillonit can be a hassle to get multiple OSs to recognize the same MBR.
511fca180e3SMatthew DillonSome OSs will require that slices are located at cylinder boundaries.
512fca180e3SMatthew Dillon.Sh SEE ALSO
513fca180e3SMatthew Dillon.Xr boot0cfg 8 ,
514fca180e3SMatthew Dillon.Xr disklabel 8 ,
515fca180e3SMatthew Dillon.Xr gpt 8 ,
516fca180e3SMatthew Dillon.Xr newfs 8
5170b674f74SSascha Wildner.Sh HISTORY
5180b674f74SSascha WildnerA version of
5190b674f74SSascha Wildner.Nm
5200b674f74SSascha Wildnerfirst appeared in the Mach Operating System.
5210b674f74SSascha WildnerIt was subsequently ported to
5220b674f74SSascha Wildner.Bx 386 .
5230b674f74SSascha Wildner.Sh AUTHORS
5240b674f74SSascha Wildner.An -nosplit
5250b674f74SSascha Wildner.Nm
5260b674f74SSascha Wildnerfor Mach Operating System was written by
5270b674f74SSascha Wildner.An Robert Baron Aq Mt rvb@cs.cmu.edu .
5280b674f74SSascha WildnerIt was ported to
5290b674f74SSascha Wildner.Bx 386
5300b674f74SSascha Wildnerby
5310b674f74SSascha Wildner.An Julian Elischer Aq Mt julian@tfs.com .
532fca180e3SMatthew Dillon.Sh BUGS
533fca180e3SMatthew DillonOnly slices s1-s4
534fca180e3SMatthew Dillon.Pq primary DOS partitions
535fca180e3SMatthew Dilloncan be changed by
536fca180e3SMatthew Dillon.Nm ,
537fca180e3SMatthew Dillons5-s30
538fca180e3SMatthew Dillon.Pq slices in extended DOS partitions
539fca180e3SMatthew Dilloncan't be changed by
540fca180e3SMatthew Dillon.Nm .
541fca180e3SMatthew Dillon.Pp
542fca180e3SMatthew DillonThe default boot code will not necessarily handle all slice types
543fca180e3SMatthew Dilloncorrectly, in particular those introduced since MS-DOS 6.x.
544fca180e3SMatthew Dillon.Pp
545fca180e3SMatthew DillonThe entire program should be made more user-friendly.
546fca180e3SMatthew Dillon.Pp
547fca180e3SMatthew DillonMost users new to
548fca180e3SMatthew Dillon.Dx
549fca180e3SMatthew Dillondo not understand the difference between
550fca180e3SMatthew Dillon.Ar slice
551fca180e3SMatthew Dillonand
552fca180e3SMatthew Dillon.Ar partition
553fca180e3SMatthew Dilloncausing difficulty to adjust.
554fca180e3SMatthew Dillon.Pp
555fca180e3SMatthew DillonYou cannot use this command to completely dedicate a disk to
556fca180e3SMatthew Dillon.Dx .
557fca180e3SMatthew DillonThe
558fca180e3SMatthew Dillon.Xr disklabel 8
559fca180e3SMatthew Dilloncommand must be used for this.
560