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