xref: /freebsd/sbin/bsdlabel/bsdlabel.8 (revision 4b2eaea43fec8e8792be611dea204071a10b655a)
1.\" Copyright (c) 1987, 1988, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Symmetric Computer Systems.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgment:
17.\"	This product includes software developed by the University of
18.\"	California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"	@(#)disklabel.8	8.2 (Berkeley) 4/19/94
36.\" $FreeBSD$
37.\"
38.Dd July 30, 1999
39.Dt DISKLABEL 8
40.Os
41.Sh NAME
42.Nm disklabel
43.Nd read and write disk pack label
44.Sh SYNOPSIS
45.Nm
46.Op Fl r
47.Ar disk
48.Nm
49.Fl w
50.Op Fl r
51.Op Fl n
52.Ar disk Ar disktype/auto
53.Oo Ar packid Oc
54.Nm
55.Fl e
56.Op Fl r
57.Op Fl n
58.Ar disk
59.Nm
60.Fl R
61.Op Fl r
62.Op Fl n
63.Ar disk Ar protofile
64.Pp
65.Nm
66.Fl B
67.Oo
68.Fl b Ar boot
69.Oc
70.Ar disk
71.Oo Ar disktype/auto Oc
72.Nm
73.Fl w
74.Fl B
75.Op Fl n
76.Oo
77.Fl b Ar boot
78.Oc
79.Ar disk Ar disktype/auto
80.Oo Ar packid Oc
81.Nm
82.Fl R
83.Fl B
84.Op Fl n
85.Oo
86.Fl b Ar boot
87.Oc
88.Ar disk Ar protofile
89.Oo Ar disktype/auto Oc
90.Sh DESCRIPTION
91The
92.Nm
93utility
94installs, examines or modifies the label on a disk drive or pack.  When writing
95the label, it can be used to change the drive identification, the disk
96partitions on the drive, or to replace a damaged label.  There are several forms
97of the command that read (display), install or edit the label on a disk.  In
98addition,
99.Nm
100can install bootstrap code.
101.Ss Raw or in-core label
102.Pp
103The disk label resides close to or at the beginning of each disk slice.
104For faster access, the kernel maintains a copy in core at all times.  By
105default, most
106.Nm
107access the in-core copy of the label.  To access the raw (on-disk) copy, use the
108.Fl r
109option.  This option allows a label to be installed on a disk without kernel
110support for a label, such as when labels are first installed on a system; it
111must be used when first installing a label on a disk.  The specific effect of
112.Fl r
113is described under each command.
114.Pp
115.Ss Disk device name
116.Pp
117All
118.Nm
119forms require a disk device name, which should always be the raw
120device name representing the disk or slice.  For example
121.Pa da0
122represents the entire disk regardless of any DOS partitioning,
123and
124.Pa da0s1
125represents a slice.  Some devices, most notably
126.Ar ccd ,
127require that the
128.Dq whole-disk
129(or
130.Dq c )
131partition be specified.  For example
132.Pa ccd0c .
133You do not have to include the
134.Pa /dev/
135path prefix when specifying the device.
136The
137.Nm
138utility will automatically prepend it.
139.Ss Reading the disk label
140.Pp
141To examine the label on a disk drive, use
142.Nm
143without options:
144.Pp
145.Nm
146.Op Fl r
147.Ar disk
148.Pp
149.Ar disk
150represents the raw disk in question, and may be in the form
151.Pa da0
152or
153.Pa /dev/da0c .
154It will display all of the parameters associated with the drive and its
155partition layout.  Unless the
156.Fl r
157flag is given,
158the kernel's in-core copy of the label is displayed;
159if the disk has no label, or the partition types on the disk are incorrect,
160the kernel may have constructed or modified the label.
161If the
162.Fl r
163flag is given,
164.Nm
165reads the label from the raw disk and displays it.  Both versions are usually
166identical except in the case where a label has not yet been initialized or
167is corrupt.
168.Ss Writing a standard label
169.Pp
170To write a standard label, use the form
171.Pp
172.Nm
173.Fl w
174.Op Fl r
175.Op Fl n
176.Ar disk Ar disktype/auto
177.Oo Ar packid Oc
178.Pp
179.Nm
180.Fl w
181.Op Fl r
182.Op Fl n
183.Ar disk
184auto
185.Pp
186The required arguments to
187.Nm
188are the drive to be labeled and the drive type as described in the
189.Xr disktab 5
190file.  The drive parameters and partitions are taken from that file.  If
191different disks of the same physical type are to have different partitions, it
192will be necessary to have separate disktab entries describing each, or to edit
193the label after installation as described below.  The optional argument is a
194pack identification string, up to 16 characters long.  The pack id must be
195quoted if it contains blanks.
196.Pp
197If the
198.Fl n
199flag is given, no data will be written to the device, and instead the
200disklabel that would have been written will be printed to stdout.
201.Pp
202If the
203.Fl r
204flag is given, the disk sectors containing the label and bootstrap
205will be written directly.
206A side-effect of this is that any existing bootstrap code will be overwritten
207and the disk rendered unbootable.  See the boot options below for a method of
208writing the label and the bootstrap at the same time.
209If
210.Fl r
211is not specified,
212the existing label will be updated via the in-core copy and any bootstrap
213code will be unaffected.
214If the disk does not already have a label, the
215.Fl r
216flag must be used.
217In either case, the kernel's in-core label is replaced.
218.Pp
219For a virgin disk that is not known to
220.Xr disktab 5 ,
221.Ar disktype
222can be specified as
223.Dq auto .
224In this case, the driver is requested to produce a virgin label for the
225disk.  This might or might not be successful, depending on whether the
226driver for the disk is able to get the required data without reading
227anything from the disk at all.  It will likely succeed for all SCSI
228disks, most IDE disks, and vnode devices.  Writing a label to the
229disk is the only supported operation, and the
230.Ar disk
231itself must be provided as the canonical name, i.e. not as a full
232path name.
233.Pp
234For most harddisks, a label based on percentages for most partitions (and
235one partition with a size of
236.Ql * )
237will produce a reasonable configuration.
238.Pp
239PC-based systems have special requirements in order for the BIOS to properly
240recognize a
241.Fx
242disklabel.  Older systems may require what is known as a
243.Dq dangerously dedicated
244disklabel, which creates a fake DOS partition to work around problems older
245BIOSes have with modern disk geometries.
246On newer systems you generally want
247to create a normal DOS partition using
248.Ar fdisk
249and then create a
250.Fx
251disklabel within that slice.  This is described
252later on in this page.
253.Pp
254Installing a new disklabel does not in of itself allow your system to boot
255a kernel using that label.  You must also install boot blocks, which is
256described later on in this manual page.
257.Ss Editing an existing disk label
258.Pp
259To edit an existing disk label, use the form
260.Pp
261.Nm
262.Fl e
263.Op Fl r
264.Op Fl n
265.Ar disk
266.Pp
267This command reads the label from the in-core kernel copy, or directly from the
268disk if the
269.Fl r
270flag is also specified.  The label is written to a file in ASCII and then
271supplied to an editor for changes.  If no editor is specified in an
272.Ev EDITOR
273environment variable,
274.Xr vi 1
275is used.  When the editor terminates, the label file is used to rewrite the disk
276label.  Existing bootstrap code is unchanged regardless of whether
277.Fl r
278was specified.  If
279.Fl n
280is specified, no data will be written to the device, and instead the
281disklabel that would have been written will be printed to stdout.  This is
282useful to see how a partitioning scheme will work out for a specific disk.
283.Ss Restoring a disk label from a file
284.Pp
285To restore a disk label from a file, use the form
286.Pp
287.Nm
288.Fl R
289.Op Fl r
290.Op Fl n
291.Ar disk Ar protofile
292.Pp
293.Nm
294is capable of restoring a disk label that was previously saved in a file in ASCII format.
295The prototype file used to create the label should be in the same format as that
296produced when reading or editing a label.  Comments are delimited by
297.Ar \&#
298and newline.  As when writing a new label, any existing bootstrap code will be
299clobbered if
300.Fl r
301is specified and will be unaffected otherwise.  See the boot options below for a
302method of restoring the label and writing the bootstrap at the same time.
303If
304.Fl n
305is used, no data will be written to the device, and instead the
306disklabel that would have been written will be printed to stdout.  This is
307useful to see how a partitioning scheme will work out for a specific disk.
308.Ss Installing bootstraps
309.Pp
310The final three forms of
311.Nm
312are used to install bootstrap code.  If you are creating a
313.Dq dangerously-dedicated
314slice for compatibility with older PC systems,
315you generally want to specify the raw disk name such as
316.Pa da0 .
317If you are creating a label within an existing DOS slice,
318you should specify
319the partition name such as
320.Pa da0s1a .
321Making a slice bootable can be tricky.  If you are using a normal DOS
322slice you typically install (or leave) a standard MBR on the base disk and
323then install the
324.Fx
325bootblocks in the slice.
326.Pp
327.Nm
328.Fl B
329.Oo
330.Fl b Ar boot
331.Oc
332.Ar disk
333.Oo Ar disktype Oc
334.Pp
335This form installs the bootstrap only.  It does not change the disk label.
336You should never use this command on a base disk unless you intend to create a
337.Dq dangerously-dedicated
338disk, such as
339.Ar da0 .
340This command is typically run on a slice such as
341.Ar da0s1 .
342.Pp
343.Nm
344.Fl w
345.Fl B
346.Op Fl n
347.Oo
348.Fl b Ar boot
349.Oc
350.Ar disk Ar disktype
351.Oo Ar packid Oc
352.Pp
353This form corresponds to the
354.Dq write label
355command described above.
356In addition to writing a new volume label, it also installs the bootstrap.
357If run on a base disk this command will create a
358.Dq dangerously-dedicated
359label.  This command is normally run on a slice rather than a base disk.
360If
361.Fl n
362is used, no data will be written to the device, and instead the
363disklabel that would have been written will be printed to stdout.
364.Pp
365.Nm
366.Fl R
367.Fl B
368.Op Fl n
369.Oo
370.Fl b Ar boot
371.Oc
372.Ar disk Ar protofile
373.Oo Ar disktype Oc
374.Pp
375This form corresponds to the
376.Dq restore label
377command described above.
378In addition to restoring the volume label, it also installs the bootstrap.
379If run on a base disk this command will create a
380.Dq dangerously-dedicated
381label.  This command is normally run on a slice rather than a base disk.
382.Pp
383The bootstrap commands always access the disk directly, so it is not necessary
384to specify the
385.Fl r
386flag.  If
387.Fl n
388is used, no data will be written to the device, and instead the
389disklabel that would have been written will be printed to stdout.
390.Pp
391The bootstrap code is comprised of two boot programs.  Specify the name of the
392boot programs to be installed in one of these ways:
393.Bl -enum
394.It
395Specify the names explicitly with the
396.Fl b
397and
398.Fl s
399flags.
400.Fl b
401indicates the primary boot program and
402.Fl s
403the secondary boot program.  The boot programs are located in
404.Pa /boot .
405.It
406If the
407.Fl b
408and
409.Fl s
410flags are not specified, but
411.Ar disktype
412was specified, the names of the programs are taken from the
413.Dq b0
414and
415.Dq b1
416parameters of the
417.Xr disktab 5
418entry for the disk if the disktab entry exists and includes those parameters.
419.It
420Otherwise, the default boot image name are used:
421.Pa /boot/boot .
422.El
423.Ss Initializing/Formatting a bootable disk from scratch
424.Pp
425To initialize a disk from scratch the following sequence is recommended.
426Please note that this will wipe everything that was previously on the disk,
427including any
428.No non- Ns Fx
429slices.
430.Bl -enum
431.It
432Use
433.Xr fdisk 8
434to initialize the hard disk, and create a slice table, referred to
435as the partition table in DOS.
436Here you will define disk slices for your system.
437.It
438Use
439.Nm
440to define and write partitions and mount points.
441You are not required to define the mount points here though,
442they can be defined later using
443.Xr mount 8 .
444.It
445Finally use
446.Xr newfs 8
447to create a file system on the new partition.
448A typical partitioning scheme would be to have an
449.Dq a
450partition
451of approximately 128MB to hold the root file system, a
452.Dq b
453partition for
454swap, a
455.Dq d
456partition for /var (usually 128MB), an
457.Dq e
458partition
459for /var/tmp (usually 128MB), an
460.Dq f
461partition for /usr (usually around 2G),
462and finally a
463.Dq g
464partition for /home (usually all remaining space).
465Your mileage may vary.
466.El
467.Pp
468.Nm fdisk Fl BI Ar da0
469.Pp
470.Nm
471.Fl w
472.Fl B
473.Ar da0s1
474auto
475.Pp
476.Pp
477.Nm
478.Fl e
479.Ar da0s1
480.Sh FILES
481.Bl -tag -width Pa -compact
482.It Pa /etc/disktab
483.It Pa /boot/
484.It Pa /boot/boot<n>
485.El
486.Sh SAVED FILE FORMAT
487The
488.Nm
489utility
490uses an ASCII version of the label when examining, editing or restoring a disk
491label.  The format is:
492.Bd -literal -offset 4n
493# /dev/da1c:
494type: SCSI
495disk: da0s1
496label:
497flags:
498bytes/sector: 512
499sectors/track: 51
500tracks/cylinder: 19
501sectors/cylinder: 969
502cylinders: 1211
503sectors/unit: 1173930
504rpm: 3600
505interleave: 1
506trackskew: 0
507cylinderskew: 0
508headswitch: 0           # milliseconds
509track-to-track seek: 0  # milliseconds
510drivedata: 0
511
5128 partitions:
513#        size   offset    fstype   [fsize bsize bps/cpg]
514  a:    81920        0    4.2BSD     1024  8192    16   # (Cyl.    0 - 84*)
515  b:   160000    81920      swap                        # (Cyl.   84* - 218*)
516  c:  1173930        0    unused        0     0         # (Cyl.    0 - 1211*)
517  h:   962010   211920     vinum                        # (Cyl.  218*- 1211*)
518.Ed
519.Pp
520Lines starting with a # mark are comments.  Most of the other specifications are
521no longer used.  The ones which must still be set correctly are:
522.Pp
523.Bl -hang -width 20n
524.It Nm label
525is an optional label, set by the
526.Ar packid
527option when writing a label.
528.It Nm flags
529Flags may be
530.Ar removable ,
531.Ar ecc
532or
533.Ar badsect .
534.Ar removable
535is set for removable media drives, but no current
536.Fx
537driver evaluates this
538flag.
539.Ar ecc
540is no longer supported;
541.Ar badsect
542specifies that the drive can perform bad sector remapping.
543.It Nm sectors/unit
544describes the total size of the disk.  This value must be correct.
545.It Nm the partition table
546This is the
547.Ux
548partition table, not the Microsoft partition table described in
549.Xr fdisk 8 .
550.El
551.Pp
552The partition table can have up to 8 entries.  It contains the following
553information:
554.Bl -hang -width 10n
555.It identifier
556The partition identifier is a single letter in the range
557.Dq a
558to
559.Dq h .
560By convention, partition
561.Dq c
562is reserved to describe the entire disk.
563.It size
564is the size of the partition in sectors,
565.Cm K
566(kilobytes - 1024),
567.Cm M
568(megabytes - 1024*1024),
569.Cm G
570(gigabytes - 1024*1024*1024),
571.Cm %
572(percentage of free space AFTER removing any fixed-size partitions other
573than partition
574.Dq c) ,
575or
576.Cm *
577(all remaining free space AFTER fixed-size and percentage
578partitions).  For partition
579.Dq c ,
580a size of
581.Cm *
582indicates the entire disk.  Lowercase versions of
583.Cm K , M ,
584and
585.Cm G
586are allowed.
587Size and type should be specifed without any spaces between them.
588.Pp
589Example: 2097152, 1g, 1024m and 1048576k are all the same size
590(assuming 512-byte sectors).
591.It offset
592is the offset of the start of the partition from the beginning of the
593drive in sectors, or
594.Cm *
595to have
596.Nm
597calculate the correct offset to use (the end of the previous partition plus
598one, ignoring partition
599.Dq c .
600For partition
601.Dq c ,
602.Cm *
603will be interpreted as an offset of 0.
604.It fstype
605describes the purpose of the partition.  The example shows all currently used
606partition types.
607For UFS file systems and ccd partitions, use type
608.Cm 4.2BSD .
609For Vinum drives, use type
610.Cm vinum .
611Other common types are
612.Cm unused
613and
614.Cm swap .
615By convention, partition
616.Dq c
617represents the entire slice and should be of type
618.Cm unused ,
619though
620.Nm
621does not enforce this convention.
622The
623.Nm
624utility
625also knows about a number of other partition types, none of which are in current
626use.
627See the definitions starting with
628.Dv FS_UNUSED
629in
630.Pa /usr/include/sys/disklabel.h
631for more details.
632.It fsize
633For
634.Cm 4.2BSD
635and LFS file systems only, the fragment size.  Defaults to 1024 for
636partitions smaller than 1 GB, 4096 for partitions 1GB or larger.
637.It bsize
638For
639.Cm 4.2BSD
640and LFS file systems only, the block size.  Defaults to 8192 for
641partitions smaller than 1 GB, 16384 for partitions 1GB or larger.
642.It bps/cpg
643For
644.Cm 4.2BSD
645file systems, the number of cylinders in a cylinder group.  For LFS file
646systems, the segment shift value.  Defaults to 16 for
647partitions smaller than 1 GB, 64 for partitions 1GB or larger.
648.El
649.Pp
650The remainder of the line is a comment and shows the cylinder allocations based
651on the obsolete (but possibly correct) geometry information about the drive.
652The asterisk (*) indicates that the partition does not begin or end exactly on a
653cylinder boundary.
654.Sh EXAMPLES
655.Dl disklabel da0
656.Pp
657Display the in-core label for
658.Pa da0s1
659as obtained via
660.Pa /dev/da0s1 .
661When reading a label,
662.Fx
663will allow you to specify the base disk name
664even if the label resides on a slice.  However, to be proper you should
665specify the base disk name only if you are using a
666.Dq dangerously-dedicated
667label.  Normally you specify the slice.
668.Pp
669.Dl disklabel da0s1 > savedlabel
670.Pp
671Save the in-core label for
672.Pa da0s1
673into the file
674.Pa savedlabel .
675This file can be used with the
676.Fl R
677flag to restore the label at a later date.
678.Pp
679.Dl disklabel -w -r /dev/da0s1 da2212 foo
680.Pp
681Create a label for
682.Pa da0s1
683based on information for
684.Dq da2212
685found in
686.Pa /etc/disktab .
687Any existing bootstrap code will be clobbered.
688.Pp
689.Dl disklabel -e -r da0s1
690.Pp
691Read the on-disk label for
692.Pa da0s1 ,
693edit it and reinstall in-core as well as on-disk.  Existing bootstrap code is
694unaffected.
695.Pp
696.Dl disklabel -e -r -n da0s1
697.Pp
698Read the on-disk label for
699.Pa da0s1 ,
700edit it, and display what the new label would be (in sectors).  It does
701NOT install the new label either in-core or on-disk.
702.Pp
703.Dl disklabel -r -w da0s1 auto
704.Pp
705Try to auto-detect the required information from
706.Pa da0s1 ,
707and write a new label to the disk.  Use another disklabel -e command to edit the
708partitioning and file system information.
709.Pp
710.Dl disklabel -R da0s1 savedlabel
711.Pp
712Restore the on-disk and in-core label for
713.Pa da0s1
714from information in
715.Pa savedlabel .
716Existing bootstrap code is unaffected.
717.Pp
718.Dl disklabel -R -n da0s1 label_layout
719.Pp
720Display what the label would be for
721.Pa da0s1
722using the partition layout in
723.Pa label_layout .
724This is useful for determining how much space would be alloted for various
725partitions with a labelling scheme using
726.Cm % Ns -based
727or
728.Cm *
729partition sizes.
730.Pp
731.Dl disklabel -B da0s1
732.Pp
733Install a new bootstrap on
734.Pa da0s1 .
735The boot code comes from
736.Pa /boot/boot .
737On-disk and in-core labels are unchanged.
738.Pp
739.Dl disklabel -w -B /dev/da0s1 -b newboot da2212
740.Pp
741Install a new label and bootstrap.
742The label is derived from disktab information for
743.Dq da2212
744and installed both in-core and on-disk.
745The bootstrap code comes from the files
746.Pa /boot/newboot
747.Pp
748.Dl dd if=/dev/zero of=/dev/da0 bs=512 count=32
749.Dl fdisk -BI da0
750.Dl dd if=/dev/zero of=/dev/da0s1 bs=512 count=32
751.Dl disklabel -w -B da0s1 auto
752.Dl disklabel -e da0s1
753.Pp
754Completely wipe any prior information on the disk, creating a new bootable
755disk with a DOS partition table containing one
756.Dq whole-disk
757slice.  Then
758initialize the slice, then edit it to your needs.  The
759.Pa dd
760commands are optional, but may be necessary for some BIOSes to properly
761recognize the disk.
762.Pp
763This is an example disklabel that uses some of the new partition size types
764such as
765.Cm % , M , G ,
766and
767.Cm * ,
768which could be used as a source file for
769.Pp
770.Dl disklabel -R ad0s1c new_label_file
771.Bd -literal -offset 4n
772# /dev/ad0s1c:
773type: ESDI
774disk: ad0s1
775label:
776flags:
777bytes/sector: 512
778sectors/track: 63
779tracks/cylinder: 16
780sectors/cylinder: 1008
781cylinders: 40633
782sectors/unit: 40959009
783rpm: 3600
784interleave: 1
785trackskew: 0
786cylinderskew: 0
787headswitch: 0		# milliseconds
788track-to-track seek: 0	# milliseconds
789drivedata: 0
790
7918 partitions:
792#        size   offset    fstype   [fsize bsize bps/cpg]
793  a:   400M        0    4.2BSD     4096 16384    75 	# (Cyl.    0 - 812*)
794  b:     1G        *      swap
795  c:      *        *    unused
796  e: 204800        *    4.2BSD
797  f:     5g        *    4.2BSD
798  g:      *        *    4.2BSD
799.Ed
800.Sh SEE ALSO
801.Xr ccd 4 ,
802.Xr disklabel 5 ,
803.Xr disktab 5 ,
804.Xr boot0cfg 8 ,
805.Xr fdisk 8 ,
806.Xr vinum 8
807.Sh DIAGNOSTICS
808The kernel device drivers will not allow the size of a disk partition
809to be decreased or the offset of a partition to be changed while it is open.
810Some device drivers create a label containing only a single large partition
811if a disk is unlabeled; thus, the label must be written to the
812.Dq a
813partition of the disk while it is open.  This sometimes requires the desired
814label to be set in two steps, the first one creating at least one other
815partition, and the second setting the label on the new partition while shrinking
816the
817.Dq a
818partition.
819.Pp
820On some machines the bootstrap code may not fit entirely in the area
821allocated for it by some file systems.
822As a result, it may not be possible to have file systems on some partitions
823of a
824.Dq bootable
825disk.
826When installing bootstrap code,
827.Nm
828checks for these cases.
829If the installed boot code would overlap a partition of type FS_UNUSED
830it is marked as type FS_BOOT.
831The
832.Xr newfs 8
833utility will disallow creation of file systems on FS_BOOT partitions.
834Conversely, if a partition has a type other than FS_UNUSED or FS_BOOT,
835.Nm
836will not install bootstrap code that overlaps it.
837.Sh BUGS
838When a disk name is given without a full pathname,
839the constructed device name uses the
840.Dq c
841partition.
842.Pp
843For the i386 architecture, the primary bootstrap sector contains
844an embedded
845.Em fdisk
846table.
847The
848.Nm
849utility takes care to not clobber it when installing a bootstrap only
850.Pq Fl B ,
851or when editing an existing label
852.Pq Fl e ,
853but it unconditionally writes the primary bootstrap program onto
854the disk for
855.Fl w
856or
857.Fl R ,
858thus replacing the
859.Em fdisk
860table by the dummy one in the bootstrap program.  This is only of
861concern if the disk is fully dedicated, so that the
862.Bx
863disklabel
864starts at absolute block 0 on the disk.
865.Pp
866The
867.Nm
868utility
869does not perform all possible error checking.  Warning *is* given if partitions
870overlap; if an absolute offset does not match the expected offset; if the
871.Dq c
872partition does not start at 0 or does not cover the entire slice; if a
873partition runs past the end of the device; and a number of other errors; but
874no warning is given if space remains unused.
875