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