Fri Jan 27 10:12:05 2017 UTC ()
Fix spelling of simultaneous.


(abhinav)
diff -r1.86 -r1.87 src/sbin/fdisk/fdisk.8

cvs diff -r1.86 -r1.87 src/sbin/fdisk/fdisk.8 (switch to unified diff)

--- src/sbin/fdisk/fdisk.8 2016/09/11 03:35:08 1.86
+++ src/sbin/fdisk/fdisk.8 2017/01/27 10:12:05 1.87
@@ -1,678 +1,678 @@ @@ -1,678 +1,678 @@
1.\" $NetBSD: fdisk.8,v 1.86 2016/09/11 03:35:08 sevan Exp $ 1.\" $NetBSD: fdisk.8,v 1.87 2017/01/27 10:12:05 abhinav Exp $
2.\" 2.\"
3.Dd September 11, 2016 3.Dd September 11, 2016
4.Dt FDISK 8 4.Dt FDISK 8
5.Os 5.Os
6.Sh NAME 6.Sh NAME
7.Nm fdisk 7.Nm fdisk
8.Nd MS-DOS partition maintenance program 8.Nd MS-DOS partition maintenance program
9.Sh SYNOPSIS 9.Sh SYNOPSIS
10.Nm 10.Nm
11.Op Fl aBFfIiSuv 11.Op Fl aBFfIiSuv
12.Oo 12.Oo
13.Fl 0 | 1 | 2 | 3 | E Ar number 13.Fl 0 | 1 | 2 | 3 | E Ar number
14.Op Fl s Oo Ar id Oc Ns Oo / Ns Oo Ar start Oc Ns Oo / Ns Oo Ar size Oc Ns Oo / Ns Oo Ar bootmenu Oc Oc Oc Oc 14.Op Fl s Oo Ar id Oc Ns Oo / Ns Oo Ar start Oc Ns Oo / Ns Oo Ar size Oc Ns Oo / Ns Oo Ar bootmenu Oc Oc Oc Oc
15.Oc 15.Oc
16.Op Fl r Ar file | Fl w Ar file 16.Op Fl r Ar file | Fl w Ar file
17.Op Fl A Ar ptn_alignment Ns Bq Ar /ptn_0_offset 17.Op Fl A Ar ptn_alignment Ns Bq Ar /ptn_0_offset
18.Op Fl b Ar cylinders/heads/sectors 18.Op Fl b Ar cylinders/heads/sectors
19.Op Fl c Ar bootcode 19.Op Fl c Ar bootcode
20.Op Fl T Ar disktype 20.Op Fl T Ar disktype
21.Op Fl t Ar disktab 21.Op Fl t Ar disktab
22.Op Fl z Ar sectorsize 22.Op Fl z Ar sectorsize
23.Op Ar device 23.Op Ar device
24.Nm 24.Nm
25.Fl l 25.Fl l
26.Sh DESCRIPTION 26.Sh DESCRIPTION
27The 27The
28.Nm 28.Nm
29program is used to display or update the 29program is used to display or update the
30.Em "master boot record" 30.Em "master boot record"
31or 31or
32.Em MBR 32.Em MBR
33in the first sector (sector 0) 33in the first sector (sector 0)
34of a disk that uses the MBR style of partitioning. 34of a disk that uses the MBR style of partitioning.
35The following 35The following
36.Nx 36.Nx
37ports use this style of disk partitioning: 37ports use this style of disk partitioning:
38amd64, arc, bebox, cobalt, hpcarm, hpcmips, hpcsh, i386, macppc, 38amd64, arc, bebox, cobalt, hpcarm, hpcmips, hpcsh, i386, macppc,
39mvmeppc, netwinder, ofppc, playstation2, and prep. 39mvmeppc, netwinder, ofppc, playstation2, and prep.
40.Pp 40.Pp
41The MBR contains bootable code, a partition table, 41The MBR contains bootable code, a partition table,
42an indication of which partition is 42an indication of which partition is
43.Sq active , 43.Sq active ,
44and (optionally, depending on the boot code) a menu 44and (optionally, depending on the boot code) a menu
45for selecting a partition to be booted. 45for selecting a partition to be booted.
46There can be at most 4 partitions defined in sector 0, 46There can be at most 4 partitions defined in sector 0,
47one of which can be an extended 47one of which can be an extended
48partition which can be split into any number of sub-partitions (then called 48partition which can be split into any number of sub-partitions (then called
49logical partitions). 49logical partitions).
50.Pp 50.Pp
51The boot code in the MBR is usually invoked by the BIOS or firmware, 51The boot code in the MBR is usually invoked by the BIOS or firmware,
52and the MBR passes control to the next stage boot code 52and the MBR passes control to the next stage boot code
53stored in the first sector of the partition to be booted 53stored in the first sector of the partition to be booted
54(the 54(the
55.Em "partition boot record" 55.Em "partition boot record"
56or 56or
57.Em PBR ) . 57.Em PBR ) .
58.Pp 58.Pp
59After booting, 59After booting,
60.Nx 60.Nx
61does not use the partitioning done by 61does not use the partitioning done by
62.Nm , 62.Nm ,
63instead it uses a 63instead it uses a
64.Nx 64.Nx
65disklabel saved in sector 1 of the 65disklabel saved in sector 1 of the
66.Nx 66.Nx
67partition. 67partition.
68See 68See
69.Xr mbrlabel 8 69.Xr mbrlabel 8
70for a way of using information from the MBR 70for a way of using information from the MBR
71to construct a 71to construct a
72.Nx 72.Nx
73disklabel. 73disklabel.
74.Pp 74.Pp
75The standard MBR boot code will only boot the 75The standard MBR boot code will only boot the
76.Sq active 76.Sq active
77partition. 77partition.
78However, 78However,
79.Nx 79.Nx
80contains additional boot programs which allow the user to 80contains additional boot programs which allow the user to
81interactively select which of the partitions to boot. 81interactively select which of the partitions to boot.
82The 82The
83.Sq mbr_ext 83.Sq mbr_ext
84code will also boot 84code will also boot
85.Nx 85.Nx
86from an extended partition but will not work on old systems that do not 86from an extended partition but will not work on old systems that do not
87support LBA reads, the 87support LBA reads, the
88.Sq mbr_com0 88.Sq mbr_com0
89and 89and
90.Sq mbr_com0_9600 90.Sq mbr_com0_9600
91will read and write from a serial port. 91will read and write from a serial port.
92At the start the 92At the start the
93.Nm 93.Nm
94program will determine whether the disk sector 0 is valid as a boot sector. 94program will determine whether the disk sector 0 is valid as a boot sector.
95(This is determined by checking the magic number.) 95(This is determined by checking the magic number.)
96If not, 96If not,
97.Nm 97.Nm
98will initialise the boot code as well as the partition table. 98will initialise the boot code as well as the partition table.
99During this, all four partitions will be marked empty. 99During this, all four partitions will be marked empty.
100.Pp 100.Pp
101The flags 101The flags
102.Fl a , 102.Fl a ,
103.Fl i 103.Fl i
104or 104or
105.Fl u 105.Fl u
106are used to indicate that the partition data is to be updated. 106are used to indicate that the partition data is to be updated.
107The 107The
108.Nm 108.Nm
109program will enter an interactive conversational mode. 109program will enter an interactive conversational mode.
110This mode is designed not to change any data unless you explicitly tell it to; 110This mode is designed not to change any data unless you explicitly tell it to;
111.Nm 111.Nm
112selects defaults for its questions to guarantee that behaviour. 112selects defaults for its questions to guarantee that behaviour.
113.Pp 113.Pp
114If partition data is going to be updated and the disk carries GUID Partition 114If partition data is going to be updated and the disk carries GUID Partition
115Tables, 115Tables,
116.Nm 116.Nm
117will remove both primary and backup GPT headers from the disk. 117will remove both primary and backup GPT headers from the disk.
118See 118See
119.Xr gpt 8 119.Xr gpt 8
120for information on how to manipulate GUID Partition Tables. 120for information on how to manipulate GUID Partition Tables.
121.Pp 121.Pp
122.Nm 122.Nm
123will calculate the correct 123will calculate the correct
124.Em cylinder , 124.Em cylinder ,
125.Em head , 125.Em head ,
126and 126and
127.Em sector 127.Em sector
128values for any partition you edit. 128values for any partition you edit.
129If you specify 129If you specify
130.Fl v 130.Fl v
131you will be asked whether you want to specify them yourself. 131you will be asked whether you want to specify them yourself.
132.Pp 132.Pp
133Finally, when all the data for the first sector has been accumulated, 133Finally, when all the data for the first sector has been accumulated,
134.Nm 134.Nm
135will ask if you really want to write the new partition table. 135will ask if you really want to write the new partition table.
136Only if you reply affirmatively to this question will 136Only if you reply affirmatively to this question will
137.Nm 137.Nm
138write anything to the disk. 138write anything to the disk.
139.Pp 139.Pp
140Available options: 140Available options:
141.Bl -tag -width Ds 141.Bl -tag -width Ds
142.It Fl 0 142.It Fl 0
143Specify partition slot 0 to be printed or updated. 143Specify partition slot 0 to be printed or updated.
144.It Fl 1 144.It Fl 1
145Specify partition slot 1 to be printed or updated. 145Specify partition slot 1 to be printed or updated.
146.It Fl 2 146.It Fl 2
147Specify partition slot 2 to be printed or updated. 147Specify partition slot 2 to be printed or updated.
148.It Fl 3 148.It Fl 3
149Specify partition slot 3 to be printed or updated. 149Specify partition slot 3 to be printed or updated.
150.It Fl A Ar ptn_alignment Ns Bq Ar /ptn_0_offset 150.It Fl A Ar ptn_alignment Ns Bq Ar /ptn_0_offset
151Specify the alignment for all partitions and optionally the offset for the 151Specify the alignment for all partitions and optionally the offset for the
152first partition of the disk and of logical partitions. 152first partition of the disk and of logical partitions.
153If 153If
154.Ar ptn_alignment 154.Ar ptn_alignment
155is specified and 155is specified and
156.Ar ptn_0_offset 156.Ar ptn_0_offset
157is not specified, then the offset is set to the alignment. 157is not specified, then the offset is set to the alignment.
158If 158If
159.Fl A 159.Fl A
160is not specified, then the alignment of the first partition is inspected. 160is not specified, then the alignment of the first partition is inspected.
161If it ends on a 2048 sector boundary, then the alignment is set to 2048, 161If it ends on a 2048 sector boundary, then the alignment is set to 2048,
162if the start is a power of 2 less than, or equal to 2048 then the offset 162if the start is a power of 2 less than, or equal to 2048 then the offset
163is set to the start sector. 163is set to the start sector.
164If the first partition is not defined then the alignment and offset for disks 164If the first partition is not defined then the alignment and offset for disks
165larger than 128GB is set to 2048 (1MB). 165larger than 128GB is set to 2048 (1MB).
166In all other cases the alignment default to a cylinder 166In all other cases the alignment default to a cylinder
167and the offset to a track (both using the BIOS geometry). 167and the offset to a track (both using the BIOS geometry).
168The 1MB alignment is the same as that used by recent windows versions. 168The 1MB alignment is the same as that used by recent windows versions.
169.It Fl a 169.It Fl a
170Change the active partition. 170Change the active partition.
171In interactive mode this question will be asked after the partitions 171In interactive mode this question will be asked after the partitions
172have been processed. 172have been processed.
173.It Fl B 173.It Fl B
174On an i386 or amd64 system, interactively update the boot selector settings. 174On an i386 or amd64 system, interactively update the boot selector settings.
175(The boot selector permits the user to interactively select the boot 175(The boot selector permits the user to interactively select the boot
176partition, and thus which operating system is run, at system boot time; see 176partition, and thus which operating system is run, at system boot time; see
177.Xr mbr 8 177.Xr mbr 8
178for more information.) 178for more information.)
179.It Fl b Ar cylinders/heads/sectors 179.It Fl b Ar cylinders/heads/sectors
180Specify the BIOS geometry parameters for 180Specify the BIOS geometry parameters for
181.Ar cylinders , 181.Ar cylinders ,
182.Ar heads , 182.Ar heads ,
183and 183and
184.Ar sectors . 184.Ar sectors .
185It is used only in conjunction with the 185It is used only in conjunction with the
186.Fl u 186.Fl u
187flag. 187flag.
188If not specified the BIOS geometry will be obtained using sysctl (i386 and 188If not specified the BIOS geometry will be obtained using sysctl (i386 and
189amd64) or by solving the simultaenous equations from the existing partition 189amd64) or by solving the simultaneous equations from the existing partition
190information. 190information.
191If that fails then either the geometry from the disklabel or 63 sectors and 191If that fails then either the geometry from the disklabel or 63 sectors and
19216 heads is used. 19216 heads is used.
193For modern disks larger than about 8GB, and where the BIOS is configured 193For modern disks larger than about 8GB, and where the BIOS is configured
194to use LBA-Assisted translation, a setting of 194to use LBA-Assisted translation, a setting of
195.Fl b Ar 1023/255/63 195.Fl b Ar 1023/255/63
196is likely to work. 196is likely to work.
197.\" see http://web.inter.nl.net/hcc/J.Steunebrink/bioslim.htm#LBA 197.\" see http://web.inter.nl.net/hcc/J.Steunebrink/bioslim.htm#LBA
198.\" for a table of C/H/S values used in LBA-Assisted translation mode 198.\" for a table of C/H/S values used in LBA-Assisted translation mode
199.It Fl c Ar bootcode 199.It Fl c Ar bootcode
200Specify the filename that 200Specify the filename that
201.Nm 201.Nm
202should read the bootcode from. 202should read the bootcode from.
203If the name of a directory is specified, then 203If the name of a directory is specified, then
204.Nm 204.Nm
205will look for files with the default names in that directory. 205will look for files with the default names in that directory.
206The default is to read from 206The default is to read from
207.Pa /usr/mdec/mbr , 207.Pa /usr/mdec/mbr ,
208.Pa /usr/mdec/mbr_bootsel 208.Pa /usr/mdec/mbr_bootsel
209or 209or
210.Pa /usr/mdec/mbr_ext 210.Pa /usr/mdec/mbr_ext
211depending on whether 211depending on whether
212.Ar bootmenu 212.Ar bootmenu
213was specified for any partitions 213was specified for any partitions
214on an i386 machine, and leave the bootcode empty for other 214on an i386 machine, and leave the bootcode empty for other
215machines. 215machines.
216.It Fl E Ar number 216.It Fl E Ar number
217Specify logical partition 217Specify logical partition
218.Ar number 218.Ar number
219to be printed or updated. 219to be printed or updated.
220If the specified logical partition does not exist on updating partition data 220If the specified logical partition does not exist on updating partition data
221an additional logical partition will be created. 221an additional logical partition will be created.
222.It Fl F 222.It Fl F
223Indicate that 223Indicate that
224.Ar device 224.Ar device
225is a regular file. 225is a regular file.
226Unless the geometry of 226Unless the geometry of
227.Ar device 227.Ar device
228is told to 228is told to
229.Nm 229.Nm
230by 230by
231.Fl T Ar disktype , 231.Fl T Ar disktype ,
232.Nm 232.Nm
233will count the 512-byte sectors in 233will count the 512-byte sectors in
234.Ar device 234.Ar device
235and produce a fake geometry. 235and produce a fake geometry.
236If 236If
237.Ar device 237.Ar device
238is a regular file, 238is a regular file,
239.Fl F 239.Fl F
240will be used implicitly. 240will be used implicitly.
241.It Fl f 241.It Fl f
242Run 242Run
243.Nm 243.Nm
244in a non-interactive mode. 244in a non-interactive mode.
245In this mode, you can only change the disk parameters by using the 245In this mode, you can only change the disk parameters by using the
246.Fl b 246.Fl b
247flag. 247flag.
248This is provided only so scripts or other programs may use 248This is provided only so scripts or other programs may use
249.Nm 249.Nm
250as part of an automatic installation process. 250as part of an automatic installation process.
251.Pp 251.Pp
252Using the 252Using the
253.Fl f 253.Fl f
254flag with 254flag with
255.Fl u 255.Fl u
256makes it impossible to specify the starting and ending 256makes it impossible to specify the starting and ending
257.Ar cylinder , 257.Ar cylinder ,
258.Ar head , 258.Ar head ,
259and 259and
260.Ar sector 260.Ar sector
261fields 261fields
262.Pq only Ar start No and Ar size No can be specified by Fl s No option . 262.Pq only Ar start No and Ar size No can be specified by Fl s No option .
263They will be automatically computed using the BIOS geometry. 263They will be automatically computed using the BIOS geometry.
264.It Fl I 264.It Fl I
265Ignore errors from overlapping partitions. 265Ignore errors from overlapping partitions.
266Some devices (cameras CHDK) require overlapping partitions to support 266Some devices (cameras CHDK) require overlapping partitions to support
267bigger than 4GB cards. 267bigger than 4GB cards.
268The 268The
269.Fl I 269.Fl I
270flag ignores overlapping error checks and does not fix them, allowing these 270flag ignores overlapping error checks and does not fix them, allowing these
271incorrect configurations to be used. 271incorrect configurations to be used.
272.It Fl i 272.It Fl i
273Explicitly request initialisation of the master boot code 273Explicitly request initialisation of the master boot code
274(similar to what 274(similar to what
275.Ic fdisk /mbr 275.Ic fdisk /mbr
276does under 276does under
277.Tn MS-DOS ) , 277.Tn MS-DOS ) ,
278even if the magic number in the first sector is ok. 278even if the magic number in the first sector is ok.
279The partition table is left alone by this (but see above). 279The partition table is left alone by this (but see above).
280.It Fl l 280.It Fl l
281Lists known 281Lists known
282.Em sysid 282.Em sysid
283values and exit. 283values and exit.
284.It Fl r Ar file 284.It Fl r Ar file
285Read the boot record from file 285Read the boot record from file
286.Ar file 286.Ar file
287instead of the specified disk. 287instead of the specified disk.
288The geometry information used is still that of the disk volume. 288The geometry information used is still that of the disk volume.
289Any changes are written back to the file. 289Any changes are written back to the file.
290.It Fl S 290.It Fl S
291When used with no other flags print a series of 291When used with no other flags print a series of
292.Pa /bin/sh 292.Pa /bin/sh
293commands for setting variables to the partition information. 293commands for setting variables to the partition information.
294This could be used by installation scripts. 294This could be used by installation scripts.
295.It Fl s Oo Ar id Oc Ns Oo / Ns Oo Ar start Oc Ns Oo / Ns Oo Ar size Oc Ns Oo / Ns Oo Ar bootmenu Oc Oc Oc Oc 295.It Fl s Oo Ar id Oc Ns Oo / Ns Oo Ar start Oc Ns Oo / Ns Oo Ar size Oc Ns Oo / Ns Oo Ar bootmenu Oc Oc Oc Oc
296Specify the partition 296Specify the partition
297.Ar id , 297.Ar id ,
298.Ar start , 298.Ar start ,
299.Ar size , 299.Ar size ,
300and 300and
301.Ar bootmenu . 301.Ar bootmenu .
302If the optional arguments are not provided, they stay as before or 302If the optional arguments are not provided, they stay as before or
303use the same defaults as the interactive mode, if new. 303use the same defaults as the interactive mode, if new.
304This flag requires the use of a partition selection flag 304This flag requires the use of a partition selection flag
305.Pq Fl 0 , 1 , 2 , 3 , No or Fl E Ar number . 305.Pq Fl 0 , 1 , 2 , 3 , No or Fl E Ar number .
306.It Fl T Ar disktype 306.It Fl T Ar disktype
307Use the disklabel 307Use the disklabel
308.Ar disktype 308.Ar disktype
309instead of the disklabel on 309instead of the disklabel on
310.Ar device . 310.Ar device .
311.It Fl t Ar disktab 311.It Fl t Ar disktab
312Read 312Read
313.Ar disktype 313.Ar disktype
314from the named 314from the named
315.Xr disktab 5 315.Xr disktab 5
316file instead of from 316file instead of from
317.Pa /etc/disktab . 317.Pa /etc/disktab .
318.It Fl u 318.It Fl u
319Update partition data, including 319Update partition data, including
320.Em id , start , No and Em size . 320.Em id , start , No and Em size .
321Unless 321Unless
322.Fl f 322.Fl f
323option 323option
324.Pq non-interactive mode 324.Pq non-interactive mode
325is specified, 325is specified,
326.Nm 326.Nm
327will display the partitions and interactively ask which one you want to edit. 327will display the partitions and interactively ask which one you want to edit.
328.Nm 328.Nm
329will step through each field showing the old value and asking for a new one. 329will step through each field showing the old value and asking for a new one.
330The 330The
331.Em start 331.Em start
332and 332and
333.Em size 333.Em size
334can be specified in blocks (NN), 334can be specified in blocks (NN),
335cylinders (NNc or NNcyl), 335cylinders (NNc or NNcyl),
336megabytes (NNm or NNMB), 336megabytes (NNm or NNMB),
337or gigabytes (NNg or NNGB), values in megabytes and gigabytes 337or gigabytes (NNg or NNGB), values in megabytes and gigabytes
338will be rounded to the nearest cylinder boundary. 338will be rounded to the nearest cylinder boundary.
339The 339The
340.Em size 340.Em size
341may be specified as 341may be specified as
342.Em $ 342.Em $
343in which case the partition will extend to the end of the available free space. 343in which case the partition will extend to the end of the available free space.
344.Pp 344.Pp
345In a non-interactive mode 345In a non-interactive mode
346.Pq specified by Fl f No option , 346.Pq specified by Fl f No option ,
347partition data should be specified by 347partition data should be specified by
348.Fl s 348.Fl s
349option. 349option.
350A partition selection option 350A partition selection option
351.Pq Fl 0 , 1 , 2 , 3 , No or Fl E Ar number 351.Pq Fl 0 , 1 , 2 , 3 , No or Fl E Ar number
352should also be specified to select a partition slot to be updated. 352should also be specified to select a partition slot to be updated.
353.Pp 353.Pp
354.Nm 354.Nm
355will not allow you to create partitions which overlap. 355will not allow you to create partitions which overlap.
356If 356If
357.Fl u 357.Fl u
358and 358and
359.Fl s 359.Fl s
360are specified in a non-interactive mode 360are specified in a non-interactive mode
361then the details of the specified partition will be changed. 361then the details of the specified partition will be changed.
362Any other partitions which overlap the requested part of the disk will be 362Any other partitions which overlap the requested part of the disk will be
363silently deleted. 363silently deleted.
364.Pp 364.Pp
365If 365If
366.Em bootmenu 366.Em bootmenu
367is specified for any partition 367is specified for any partition
368.Nm 368.Nm
369will determine whether the installed boot code supports the bootselect code, 369will determine whether the installed boot code supports the bootselect code,
370if it does not you will be asked whether you want to install the required 370if it does not you will be asked whether you want to install the required
371boot code. 371boot code.
372To remove a 372To remove a
373.Em bootmenu 373.Em bootmenu
374label, simply press 374label, simply press
375.Aq space 375.Aq space
376followed by 376followed by
377.Aq return . 377.Aq return .
378.It Fl v 378.It Fl v
379Be more verbose, specifying 379Be more verbose, specifying
380.Fl v 380.Fl v
381more than once may increase the amount of output. 381more than once may increase the amount of output.
382.Pp 382.Pp
383Using 383Using
384.Fl v 384.Fl v
385with 385with
386.Fl u 386.Fl u
387allows the user to change more parameters than normally permitted. 387allows the user to change more parameters than normally permitted.
388.It Fl w Ar file 388.It Fl w Ar file
389Write the modified partition table to file 389Write the modified partition table to file
390.Ar file 390.Ar file
391instead of the disk. 391instead of the disk.
392.It Fl z Ar sectorsize 392.It Fl z Ar sectorsize
393Specify a sector size other than 512, for devices that only 393Specify a sector size other than 512, for devices that only
394support larger sector sizes. 394support larger sector sizes.
395The sector size needs to be a power of two greater than 512. 395The sector size needs to be a power of two greater than 512.
396.El 396.El
397.Pp 397.Pp
398When called with no arguments, it prints the partition table. 398When called with no arguments, it prints the partition table.
399An example follows: 399An example follows:
400.Bd -literal 400.Bd -literal
401 Disk: /dev/rwd0d 401 Disk: /dev/rwd0d
402 NetBSD disklabel disk geometry: 402 NetBSD disklabel disk geometry:
403 cylinders: 16383, heads: 16, sectors/track: 63 (1008 sectors/cylinder) 403 cylinders: 16383, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
404 total sectors: 40032696 404 total sectors: 40032696
405 405
406 BIOS disk geometry: 406 BIOS disk geometry:
407 cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder) 407 cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
408 total sectors: 40032696 408 total sectors: 40032696
409 409
410 Partition table: 410 Partition table:
411 0: NetBSD (sysid 169) 411 0: NetBSD (sysid 169)
412 bootmenu: net 1.5. 412 bootmenu: net 1.5.
413 start 4209030, size 8289540 (4048 MB, Cyls 262-778), Active 413 start 4209030, size 8289540 (4048 MB, Cyls 262-778), Active
414 1: Primary DOS with 32 bit FAT (sysid 11) 414 1: Primary DOS with 32 bit FAT (sysid 11)
415 bootmenu: win98 415 bootmenu: win98
416 start 63, size 4208967 (2055 MB, Cyls 0-262) 416 start 63, size 4208967 (2055 MB, Cyls 0-262)
417 2: NetBSD (sysid 169) 417 2: NetBSD (sysid 169)
418 bootmenu: current 418 bootmenu: current
419 start 32515560, size 7517136 (3670 MB, Cyls 2024-2491/234/40) 419 start 32515560, size 7517136 (3670 MB, Cyls 2024-2491/234/40)
420 3: Ext. partition - LBA (sysid 15) 420 3: Ext. partition - LBA (sysid 15)
421 start 12498570, size 20016990 (9774 MB, Cyls 778-2024) 421 start 12498570, size 20016990 (9774 MB, Cyls 778-2024)
422 Extended partition table: 422 Extended partition table:
423 E0: NetBSD (sysid 169) 423 E0: NetBSD (sysid 169)
424 bootmenu: test 424 bootmenu: test
425 start 12498633, size 12305727 (6009 MB, Cyls 778-1544) 425 start 12498633, size 12305727 (6009 MB, Cyls 778-1544)
426 E1: Primary DOS with 32 bit FAT (sysid 11) 426 E1: Primary DOS with 32 bit FAT (sysid 11)
427 start 24804423, size 4096512 (2000 MB, Cyls 1544-1799) 427 start 24804423, size 4096512 (2000 MB, Cyls 1544-1799)
428 E2: Primary DOS with 32 bit FAT (sysid 11) 428 E2: Primary DOS with 32 bit FAT (sysid 11)
429 start 28900998, size 3614562 (1765 MB, Cyls 1799-2024) 429 start 28900998, size 3614562 (1765 MB, Cyls 1799-2024)
430 Bootselector enabled, infinite timeout. 430 Bootselector enabled, infinite timeout.
431 First active partition: 0 431 First active partition: 0
432.Ed 432.Ed
433.Pp 433.Pp
434This example disk is divided into four partitions, the last of which is 434This example disk is divided into four partitions, the last of which is
435an extended partition. 435an extended partition.
436The logical partitions of the extended partition are also shown. 436The logical partitions of the extended partition are also shown.
437In this case there is no free space in either the disk or in the extended 437In this case there is no free space in either the disk or in the extended
438partition. 438partition.
439.Pp 439.Pp
440The various fields in each partition entry are: 440The various fields in each partition entry are:
441.Bd -filled -offset 4n -compact 441.Bd -filled -offset 4n -compact
442.Em ptn_number : id_name 442.Em ptn_number : id_name
443(sysid 443(sysid
444.Em id_number ) 444.Em id_number )
445.Ed 445.Ed
446.Bd -filled -offset 8n -compact 446.Bd -filled -offset 8n -compact
447bootmenu: 447bootmenu:
448.Em bootmenu 448.Em bootmenu
449.br 449.br
450start 450start
451.Em start , 451.Em start ,
452size 452size
453.Em size ( MB 453.Em size ( MB
454MB, Cyls 454MB, Cyls
455.Em first Ns No - Ns Em next ) 455.Em first Ns No - Ns Em next )
456.Op , Active 456.Op , Active
457.Ed 457.Ed
458.Bl -tag -width "bootmenu" 458.Bl -tag -width "bootmenu"
459.It Em ptn_number 459.It Em ptn_number
460is the number of the partition. 460is the number of the partition.
461.It Em id_name 461.It Em id_name
462is the name of the filesystem type or operating system that uses this partition. 462is the name of the filesystem type or operating system that uses this partition.
463.It Em id_number 463.It Em id_number
464is the number that identifies the partition type. 464is the number that identifies the partition type.
465169 decimal is used for 465169 decimal is used for
466.Nx 466.Nx
467partitions, 467partitions,
46815 decimal to create an extended partition 46815 decimal to create an extended partition
469and 0 to mark a partition as unused. 469and 0 to mark a partition as unused.
470Use 470Use
471.Nm 471.Nm
472.Fl l 472.Fl l
473to list the known partition types. 473to list the known partition types.
474.It Em bootmenu 474.It Em bootmenu
475is the menu prompt output by the interactive boot code for this partition. 475is the menu prompt output by the interactive boot code for this partition.
476This line is omitted if the prompt is not defined. 476This line is omitted if the prompt is not defined.
477.It Em start , Em size 477.It Em start , Em size
478are the start address and size of the partition in sectors. 478are the start address and size of the partition in sectors.
479.It Em MB 479.It Em MB
480is the size of the partition in megabytes. 480is the size of the partition in megabytes.
481.It Em first , Em next 481.It Em first , Em next
482are the bounds of this partition displayed as cylinder/head/sector. 482are the bounds of this partition displayed as cylinder/head/sector.
483If the partition starts (or ends) on a cylinder boundary the head and 483If the partition starts (or ends) on a cylinder boundary the head and
484sector values are omitted. 484sector values are omitted.
485If 485If
486.Fl v 486.Fl v
487is not specified the start of logical partitions and the first partition 487is not specified the start of logical partitions and the first partition
488on the disk are rounded down to include the mandatory red tape in the 488on the disk are rounded down to include the mandatory red tape in the
489preceding track. 489preceding track.
490.It Active 490.It Active
491is output if this is the active partition. 491is output if this is the active partition.
492.El 492.El
493.Pp 493.Pp
494If the 494If the
495.Fl v 495.Fl v
496flag is specified, the beginning and end of each partition are also 496flag is specified, the beginning and end of each partition are also
497displayed as follows: 497displayed as follows:
498.Bd -filled -offset 4n -compact 498.Bd -filled -offset 4n -compact
499beg: cylinder 499beg: cylinder
500.Em cylinder , 500.Em cylinder ,
501head 501head
502.Em head , 502.Em head ,
503sector 503sector
504.Em sector 504.Em sector
505.br 505.br
506end: cylinder 506end: cylinder
507.Em cylinder , 507.Em cylinder ,
508head 508head
509.Em head , 509.Em head ,
510sector 510sector
511.Em sector 511.Em sector
512.Ed 512.Ed
513.Bl -tag -width "bootmenu" 513.Bl -tag -width "bootmenu"
514.It Em "cylinder" , Em "head" , Em "sector" 514.It Em "cylinder" , Em "head" , Em "sector"
515are the beginning or ending address of a partition. 515are the beginning or ending address of a partition.
516.Pp 516.Pp
517.Em "Note:" 517.Em "Note:"
518these numbers are read from the bootblock, so are the values calculated 518these numbers are read from the bootblock, so are the values calculated
519by a previous run of 519by a previous run of
520.Nm . 520.Nm .
521.El 521.El
522.Pp 522.Pp
523.Nm 523.Nm
524attempts to check whether each partition is bootable, 524attempts to check whether each partition is bootable,
525by checking the magic number and some other characteristics 525by checking the magic number and some other characteristics
526of the first sector of each partition (the PBR). 526of the first sector of each partition (the PBR).
527If the partition does not appear to be bootable, 527If the partition does not appear to be bootable,
528.Nm 528.Nm
529will print a line containing 529will print a line containing
530.Dq "PBR is not bootable" 530.Dq "PBR is not bootable"
531followed by an error message. 531followed by an error message.
532If the partition is bootable, and if the 532If the partition is bootable, and if the
533.Fl v 533.Fl v
534flag is specified, 534flag is specified,
535.Nm 535.Nm
536will print 536will print
537.Dq "PBR appears to be bootable" . 537.Dq "PBR appears to be bootable" .
538If the 538If the
539.Fl v 539.Fl v
540flag is specified more than once, 540flag is specified more than once,
541.Nm 541.Nm
542will print the heading 542will print the heading
543.Dq "Information from PBR:" 543.Dq "Information from PBR:"
544followed by one or more lines of information gleaned from the PBR; 544followed by one or more lines of information gleaned from the PBR;
545this additional information may be incorrect or misleading, 545this additional information may be incorrect or misleading,
546because different operating systems use different PBR formats. 546because different operating systems use different PBR formats.
547Note that, even if no errors are reported, an attempt to boot 547Note that, even if no errors are reported, an attempt to boot
548from the partition might fail. 548from the partition might fail.
549.Nx 549.Nx
550partitions may be made bootable using 550partitions may be made bootable using
551.Xr installboot 8 . 551.Xr installboot 8 .
552.Sh NOTES 552.Sh NOTES
553This program is only available (and useful) on systems with PC-platform-style 553This program is only available (and useful) on systems with PC-platform-style
554MBR partitioning. 554MBR partitioning.
555.Pp 555.Pp
556Traditionally the partition boundaries should be on cylinder boundaries 556Traditionally the partition boundaries should be on cylinder boundaries
557using the BIOS geometry, with the exception of the first partition, 557using the BIOS geometry, with the exception of the first partition,
558which traditionally begins in the second track of the first cylinder 558which traditionally begins in the second track of the first cylinder
559(cylinder 0, head 1, sector 1). 559(cylinder 0, head 1, sector 1).
560Although the BIOS geometry is typically different from the geometry 560Although the BIOS geometry is typically different from the geometry
561reported by the drive, neither will match the actual physical geometry 561reported by the drive, neither will match the actual physical geometry
562for modern disks (the actual geometry will vary across the disk). 562for modern disks (the actual geometry will vary across the disk).
563Keeping the partition boundaries on cylinder boundaries makes partitioning 563Keeping the partition boundaries on cylinder boundaries makes partitioning
564a driver easier as only relatively small numbers need be entered. 564a driver easier as only relatively small numbers need be entered.
565.Pp 565.Pp
566The automatic calculation of the starting cylinder and 566The automatic calculation of the starting cylinder and
567other parameters uses 567other parameters uses
568a set of figures that represent what the BIOS thinks is the 568a set of figures that represent what the BIOS thinks is the
569geometry of the drive. 569geometry of the drive.
570The default values should be correct for the system on which 570The default values should be correct for the system on which
571.Nm 571.Nm
572is run; however, if you move the disk to a different system, the 572is run; however, if you move the disk to a different system, the
573BIOS of that system might use a different geometry translation. 573BIOS of that system might use a different geometry translation.
574.Pp 574.Pp
575If you run the equivalent of 575If you run the equivalent of
576.Nm 576.Nm
577on a different operating system then the 577on a different operating system then the
578.Ar bootmenu 578.Ar bootmenu
579strings associated with extended partitions may be lost. 579strings associated with extended partitions may be lost.
580.Pp 580.Pp
581Editing an existing partition is risky, and may cause you to 581Editing an existing partition is risky, and may cause you to
582lose all the data in that partition. 582lose all the data in that partition.
583.Pp 583.Pp
584You should run this program interactively once or twice to see how it works. 584You should run this program interactively once or twice to see how it works.
585This is completely safe as long as you answer the last question in the negative. 585This is completely safe as long as you answer the last question in the negative.
586You can also specify 586You can also specify
587.Fl w Ar file 587.Fl w Ar file
588to write the output to a file and later specify 588to write the output to a file and later specify
589.Fl r Ar file 589.Fl r Ar file
590to read back the updated information. 590to read back the updated information.
591This can be done without having write access to the disk volume. 591This can be done without having write access to the disk volume.
592.Sh FILES 592.Sh FILES
593.Bl -tag -width /usr/mdec/mbrxxxxxxxx -compact 593.Bl -tag -width /usr/mdec/mbrxxxxxxxx -compact
594.It Pa /usr/mdec/mbr 594.It Pa /usr/mdec/mbr
595Default location of i386 bootcode 595Default location of i386 bootcode
596.It Pa /usr/mdec/mbr_bootsel 596.It Pa /usr/mdec/mbr_bootsel
597Default location of i386 bootselect code 597Default location of i386 bootselect code
598.It Pa /usr/mdec/mbr_ext 598.It Pa /usr/mdec/mbr_ext
599Default location of i386 bootselect for extended partitions (i.e., NetBSD on 599Default location of i386 bootselect for extended partitions (i.e., NetBSD on
600logical partitions) 600logical partitions)
601.El 601.El
602.Sh EXAMPLES 602.Sh EXAMPLES
603Update MBR partition data of 603Update MBR partition data of
604.Pa /dev/rwd0d 604.Pa /dev/rwd0d
605in interactive mode: 605in interactive mode:
606.Pp 606.Pp
607.Dl Ic fdisk -u /dev/rwd0d 607.Dl Ic fdisk -u /dev/rwd0d
608.Pp 608.Pp
609Change active MBR partition of 609Change active MBR partition of
610.Pa /dev/rwd0d 610.Pa /dev/rwd0d
611in interactive mode: 611in interactive mode:
612.Pp 612.Pp
613.Dl Ic fdisk -a /dev/rwd0d 613.Dl Ic fdisk -a /dev/rwd0d
614.Pp 614.Pp
615Install MBR bootcode 615Install MBR bootcode
616.Pa /usr/mdec/mbr_bootsel 616.Pa /usr/mdec/mbr_bootsel
617into 617into
618.Pa /dev/rwd0d : 618.Pa /dev/rwd0d :
619.Pp 619.Pp
620.Dl Ic fdisk -c /usr/mdec/mbr_bootsel /dev/rwd0d 620.Dl Ic fdisk -c /usr/mdec/mbr_bootsel /dev/rwd0d
621.Pp 621.Pp
622Set MBR partition data for slot 0 of 622Set MBR partition data for slot 0 of
623.Pa /dev/rwd0d 623.Pa /dev/rwd0d
624specifying values without prompt: 624specifying values without prompt:
625.Pp 625.Pp
626.Dl Ic fdisk -f -u -0 -s 169/63/2097089 /dev/rwd0d 626.Dl Ic fdisk -f -u -0 -s 169/63/2097089 /dev/rwd0d
627.Pp 627.Pp
628Make partition slot 0 of 628Make partition slot 0 of
629.Pa /dev/rwd0d 629.Pa /dev/rwd0d
630active without prompt: 630active without prompt:
631.Pp 631.Pp
632.Dl Ic fdisk -f -a -0 /dev/rwd0d 632.Dl Ic fdisk -f -a -0 /dev/rwd0d
633.Pp 633.Pp
634Initialize and create MBR partition data using bootcode 634Initialize and create MBR partition data using bootcode
635.Pa destdir/usr/mdec/mbr 635.Pa destdir/usr/mdec/mbr
636without prompt against 1GB disk image file 636without prompt against 1GB disk image file
637.Pa diskimg : 637.Pa diskimg :
638.Pp 638.Pp
639.Dl Ic fdisk -f -i -b 130/255/63 -c destdir/usr/mdec/mbr -F diskimg 639.Dl Ic fdisk -f -i -b 130/255/63 -c destdir/usr/mdec/mbr -F diskimg
640.Pp 640.Pp
641Create MBR partition data for slot 0 which has an active 641Create MBR partition data for slot 0 which has an active
642.Nx 642.Nx
643partition using whole disk without prompt against 1GB disk image file 643partition using whole disk without prompt against 1GB disk image file
644.Pa diskimg : 644.Pa diskimg :
645.Pp 645.Pp
646.Dl Ic fdisk -f -a -u -0 -s 169/63/2097089 -F diskimg 646.Dl Ic fdisk -f -a -u -0 -s 169/63/2097089 -F diskimg
647.Sh SEE ALSO 647.Sh SEE ALSO
648.Xr disktab 5 , 648.Xr disktab 5 ,
649.Xr boot 8 , 649.Xr boot 8 ,
650.Xr disklabel 8 , 650.Xr disklabel 8 ,
651.Xr gpt 8 , 651.Xr gpt 8 ,
652.Xr installboot 8 , 652.Xr installboot 8 ,
653.Xr mbr 8 , 653.Xr mbr 8 ,
654.Xr mbrlabel 8 654.Xr mbrlabel 8
655.Sh HISTORY 655.Sh HISTORY
656A version of 656A version of
657.Nm 657.Nm
658first appeared in the Mach Operating System. 658first appeared in the Mach Operating System.
659It was subsequently ported to 659It was subsequently ported to
660.Bx 386 . 660.Bx 386 .
661.Sh AUTHORS 661.Sh AUTHORS
662.An -nosplit 662.An -nosplit
663.Nm 663.Nm
664for Mach Operating System was written by 664for Mach Operating System was written by
665.An Robert Baron Aq Mt rvb@cs.cmu.edu . 665.An Robert Baron Aq Mt rvb@cs.cmu.edu .
666It was ported to 666It was ported to
667.Bx 386 667.Bx 386
668by 668by
669.An Julian Elischer Aq Mt julian@tfs.com . 669.An Julian Elischer Aq Mt julian@tfs.com .
670.Sh BUGS 670.Sh BUGS
671The word 671The word
672.Sq partition 672.Sq partition
673is used to mean both an MBR partition and a 673is used to mean both an MBR partition and a
674.Nx 674.Nx
675partition, sometimes in the same sentence. 675partition, sometimes in the same sentence.
676.Pp 676.Pp
677There are subtleties that the program detects that are not explained in 677There are subtleties that the program detects that are not explained in
678this manual page. 678this manual page.