xref: /dragonfly/sbin/disklabel64/disklabel64.8 (revision 6a3cbbc2)
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. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"	@(#)disklabel.8	8.2 (Berkeley) 4/19/94
32.\" $FreeBSD: src/sbin/disklabel/disklabel.8,v 1.15.2.22 2003/04/17 17:56:34 trhodes Exp $
33.\"
34.Dd July 21, 2018
35.Dt DISKLABEL64 8
36.Os
37.Sh NAME
38.Nm disklabel64
39.Nd read and write 64 bit disk pack label
40.Sh SYNOPSIS
41.Nm
42.Op Fl r
43.Ar disk
44.Nm
45.Fl w
46.Op Fl r
47.Op Fl n
48.Ar disk
49.Op Ar disktype Ns / Ns Cm auto Op Ar packid
50.Nm
51.Fl e
52.Op Fl r
53.Op Fl n
54.Ar disk
55.Nm
56.Fl R
57.Op Fl r
58.Op Fl n
59.Ar disk Ar protofile
60.Nm
61.Op Fl NW
62.Ar disk
63.Pp
64.Nm
65.Fl B
66.Oo
67.Fl b Ar boot1
68.Fl s Ar boot2
69.Oc
70.Ar disk
71.Oo Ar disktype Ns / Ns Cm auto Oc
72.Nm
73.Fl w
74.Fl B
75.Op Fl n
76.Oo
77.Fl b Ar boot1
78.Fl s Ar boot2
79.Oc
80.Ar disk
81.Op Ar disktype Ns / Ns Cm auto Op Ar packid
82.Nm
83.Fl R
84.Fl B
85.Op Fl n
86.Oo
87.Fl b Ar boot1
88.Fl s Ar boot2
89.Oc
90.Ar disk Ar protofile
91.Oo Ar disktype Ns / Ns Cm auto Oc
92.Sh DESCRIPTION
93The
94.Nm
95utility
96installs, examines or modifies a 64 bit label on a disk drive or pack.
97When writing
98the label, it can be used to change the drive identification, the disk
99partitions on the drive, or to replace a damaged label.
100There are several forms
101of the command that read (display), install or edit the label on a disk.
102In
103addition,
104.Nm
105can install bootstrap code.
106.Ss Raw or in-core label
107The disk label resides close to or at the beginning of each disk slice.
108For faster access, the kernel maintains a copy in core at all times.
109By
110default, most forms of the
111.Nm
112command access the in-core copy of the label.
113To access the raw (on-disk)
114copy, use the
115.Fl r
116option.
117This option allows a label to be installed on a disk without kernel
118support for a label, such as when labels are first installed on a system; it
119must be used when first installing a label on a disk.
120The specific effect of
121.Fl r
122is described under each command.
123.Ss Disk device name
124All
125.Nm
126forms require a disk device name, which should always be the raw
127device name representing the disk or slice.
128.Dx
129uses the following scheme for slice numbering:
130If the disk doesn't use GPT (typically laid out by
131.Xr gpt 8 ) ,
132but e.g.\& MBR (typically laid out by
133.Xr fdisk 8 ) ,
134then slice 0, e.g.\&
135.Pa da0s0 ,
136represents the entire disk regardless of any DOS partitioning.
137Slice 0 is called the compatibility slice,
138and slice 1 and onward, e.g.\&
139.Pa da0s1 ,
140represents a
141.Bx
142slice.
143If the disk does use GPT, then all slices are
144.Bx
145slices, slice 0 isn't special, it is just the first slice on the disk.
146You do not have to include the
147.Pa /dev/
148path prefix when specifying the device.
149The
150.Nm
151utility will automatically prepend it.
152.Ss Reading the disk label
153To examine the label on a disk drive, use
154.Nm
155without options:
156.Pp
157.Nm
158.Op Fl r
159.Ar disk
160.Pp
161.Ar disk
162represents the raw disk in question, and may be in the form
163.Pa da0s1
164or
165.Pa /dev/da0s1 .
166It will display all of the parameters associated with the drive and its
167partition layout.
168Unless the
169.Fl r
170flag is given,
171the kernel's in-core copy of the label is displayed;
172if the disk has no label, or the partition types on the disk are incorrect,
173the kernel may have constructed or modified the label.
174If the
175.Fl r
176flag is given,
177.Nm
178reads the label from the raw disk and displays it.
179Both versions are usually
180identical except in the case where a label has not yet been initialized or
181is corrupt.
182.Ss Writing a standard label
183To write a standard label, use the form
184.Pp
185.Nm
186.Fl w
187.Op Fl r
188.Op Fl n
189.Ar disk
190.Op Ar disktype Ns / Ns Cm auto Op Ar packid
191.Pp
192The required argument to
193.Nm
194is the drive to be labeled.
195The first optional argument is the drive type as described in the
196.Xr disktab 5
197file, from which the drive parameters and partitions are taken.
198If not specified, then the
199.Cm auto
200type is assumed to make a virgin label for the disk as described below.
201If
202different disks of the same physical type are to have different partitions, it
203will be necessary to have separate disktab entries describing each, or to edit
204the label after installation as described below.
205The optional argument is a
206pack identification string, up to 63 characters long.
207The pack id must be
208quoted if it contains blanks.
209.Pp
210If the
211.Fl n
212flag is given, no data will be written to the device, and instead the
213disklabel that would have been written will be printed to stdout.
214.Pp
215If the
216.Fl r
217flag is given, the disk sectors containing the label and bootstrap
218will be written directly.
219A side-effect of this is that any existing bootstrap code will be overwritten
220and the disk rendered unbootable.
221See the boot options below for a method of
222writing the label and the bootstrap at the same time.
223If
224.Fl r
225is not specified,
226the existing label will be updated via the in-core copy and any bootstrap
227code will be unaffected.
228If the disk does not already have a label, the
229.Fl r
230flag must be used.
231In either case, the kernel's in-core label is replaced.
232.Pp
233For a virgin disk that is not known to
234.Xr disktab 5 ,
235.Ar disktype
236can be specified as
237.Cm auto .
238In this case, the driver is requested to produce a virgin label for the
239disk.
240This might or might not be successful, depending on whether the
241driver for the disk is able to get the required data without reading
242anything from the disk at all.
243It will likely succeed for all SCSI
244disks, most IDE disks, and vnode devices.
245Writing a label to the
246disk is the only supported operation.
247.Pp
248For most harddisks, a label based on percentages for most partitions (and
249one partition with a size of
250.Ql * )
251will produce a reasonable configuration.
252.Pp
253PC-based systems have special requirements in order for the BIOS to properly
254recognize a
255.Dx
256disklabel.
257Older systems may require what is known as a
258.Dq dangerously dedicated
259disklabel, which creates a fake DOS partition to work around problems older
260BIOSes have with modern disk geometries.
261On newer systems you generally want
262to create a normal DOS partition using
263.Ar fdisk
264and then create a
265.Dx
266disklabel within that slice.
267This is described
268later on in this page.
269.Pp
270Installing a new disklabel does not in of itself allow your system to boot
271a kernel using that label.
272You must also install boot blocks, which is
273described later on in this manual page.
274.Ss Editing an existing disk label
275To edit an existing disk label, use the form
276.Pp
277.Nm
278.Fl e
279.Op Fl r
280.Op Fl n
281.Ar disk
282.Pp
283This command reads the label from the in-core kernel copy, or directly from the
284disk if the
285.Fl r
286flag is also specified.
287The label is written to a file in ASCII and then
288supplied to an editor for changes.
289If no editor is specified in an
290.Ev EDITOR
291environment variable,
292.Xr vi 1
293is used.
294When the editor terminates, the label file is used to rewrite the disk label.
295Existing bootstrap code is unchanged regardless of whether
296.Fl r
297was specified.
298If
299.Fl n
300is specified, no data will be written to the device, and instead the
301disklabel that would have been written will be printed to stdout.
302This is
303useful to see how a partitioning scheme will work out for a specific disk.
304.Ss Restoring a disk label from a file
305To restore a disk label from a file, use the form
306.Pp
307.Nm
308.Fl R
309.Op Fl r
310.Op Fl n
311.Ar disk Ar protofile
312.Pp
313.Nm
314is capable of restoring a disk label that was previously saved in a file
315in ASCII format.
316The prototype file used to create the label should be in the same format
317as that produced when reading or editing a label.
318Comments are delimited by
319.Ql #
320and newline.
321As when writing a new label, any existing bootstrap code will be
322clobbered if
323.Fl r
324is specified and will be unaffected otherwise.
325See the boot options below for a
326method of restoring the label and writing the bootstrap at the same time.
327If
328.Fl n
329is used, no data will be written to the device, and instead the
330disklabel that would have been written will be printed to stdout.
331This is
332useful to see how a partitioning scheme will work out for a specific disk.
333.Ss Enabling and disabling writing to the disk label area
334By default, it is not possible to write to the disk label area at the beginning
335of a disk.
336The disk driver arranges for
337.Xr write 2
338and similar system calls
339to return
340.Er EROFS
341on any attempt to do so.
342If you need
343to write to this area (for example, to obliterate the label), use the form
344.Pp
345.Nm
346.Fl W
347.Ar disk
348.Pp
349To disallow writing to the label area after previously allowing it,
350use the command
351.Pp
352.Nm
353.Fl N
354.Ar disk
355.Ss Installing bootstraps
356The final three forms of
357.Nm
358are used to install bootstrap code, which allows boot from a
359.Xr HAMMER 5 ,
360.Xr HAMMER2 5 ,
361or
362.Xr UFS 5
363file system.
364If you are creating a
365.Dq dangerously-dedicated
366slice for compatibility with older PC systems,
367you generally want to specify the compatibility slice, such as
368.Pa da0s0 .
369If you are creating a label within an existing DOS slice,
370you should specify
371the slice name such as
372.Pa da0s1 .
373Making a slice bootable can be tricky.
374If you are using a normal DOS
375slice you typically install (or leave) a standard MBR on the base disk and
376then install the
377.Dx
378bootblocks in the slice.
379.Pp
380.Nm
381.Fl B
382.Oo
383.Fl b Ar boot1
384.Fl s Ar boot2
385.Oc
386.Ar disk
387.Oo Ar disktype Ns / Ns Cm auto Oc
388.Pp
389This form installs the bootstrap only.
390It does not change the disk label.
391You should never use this command on the compatibility slice unless you
392intend to create a
393.Dq dangerously-dedicated
394disk, such as
395.Ar da0s0 .
396This command is typically run on a
397.Bx
398slice such as
399.Ar da0s1 .
400.Pp
401.Nm
402.Fl w
403.Fl B
404.Op Fl n
405.Oo
406.Fl b Ar boot1
407.Fl s Ar boot2
408.Oc
409.Ar disk
410.Op Ar disktype Ns / Ns Cm auto Op Ar packid
411.Pp
412This form corresponds to the
413.Dq write label
414command described above.
415In addition to writing a new volume label, it also installs the bootstrap.
416If run on the compatibility slice this command will create a
417.Dq dangerously-dedicated
418label.
419This command is normally run on a
420.Bx
421slice rather than the compatibility slice.
422If
423.Fl n
424is used, no data will be written to the device, and instead the
425disklabel that would have been written will be printed to stdout.
426.Pp
427.Nm
428.Fl R
429.Fl B
430.Op Fl n
431.Oo
432.Fl b Ar boot1
433.Fl s Ar boot2
434.Oc
435.Ar disk Ar protofile
436.Oo Ar disktype Ns / Ns Cm auto Oc
437.Pp
438This form corresponds to the
439.Dq restore label
440command described above.
441In addition to restoring the volume label, it also installs the bootstrap.
442If run on the compatibility slice this command will create a
443.Dq dangerously-dedicated
444label.
445This command is normally run on a
446.Bx
447slice rather than the compatibility
448slice.
449.Pp
450The bootstrap commands always access the disk directly,
451so it is not necessary to specify the
452.Fl r
453flag.
454If
455.Fl n
456is used, no data will be written to the device, and instead the
457disklabel that would have been written will be printed to stdout.
458.Pp
459The bootstrap code is comprised of two boot programs.
460Specify the name of the
461boot programs to be installed in one of these ways:
462.Bl -enum
463.It
464Specify the names explicitly with the
465.Fl b
466and
467.Fl s
468flags.
469.Fl b
470indicates the primary boot program and
471.Fl s
472the secondary boot program.
473The boot programs are normally located in
474.Pa /boot .
475.It
476If the
477.Fl b
478and
479.Fl s
480flags are not specified, but
481.Ar disktype
482was specified, the names of the programs are taken from the
483.Dq b0
484and
485.Dq b1
486parameters of the
487.Xr disktab 5
488entry for the disk if the disktab entry exists and includes those parameters.
489.It
490Otherwise, the default boot image names are used:
491.Pa /boot/boot1_64
492and
493.Pa /boot/boot2_64
494for the standard stage1 and stage2 boot images.
495.El
496.Ss Initializing/Formatting a bootable disk from scratch
497To initialize a disk from scratch the following sequence is recommended.
498Please note that this will wipe everything that was previously on the disk,
499including any
500.No non- Ns Dx
501slices.
502.Bl -enum
503.It
504Use
505.Xr gpt 8
506or
507.Xr fdisk 8
508to initialize the hard disk, and create a GPT or MBR slice table,
509referred to as the
510.Dq "partition table"
511in
512.Tn DOS .
513.It
514Use
515.Nm
516or
517.Xr disklabel32 8
518to define partitions on
519.Dx
520slices created in the previous step.
521.It
522Finally use
523.Xr newfs_hammer 8 ,
524.Xr newfs_hammer2 8 ,
525or
526.Xr newfs 8
527to create file systems on new partitions.
528.El
529.Pp
530A typical partitioning scheme would be to have an
531.Ql a
532partition of approximately 1 GB for
533.Pa /boot
534to hold the current, old (and backup) kernels and modules, a
535.Ql b
536partition for swap (suggested to be at least the same size as the
537physical memory),
538and finally a
539.Ql d
540partition for the root file system (usually all remaining space).
541Your mileage may vary.
542.Pp
543.Dl "gpt create da0"
544.Dl "gpt add da0"
545.Dl "disklabel64 -B -r -w da0s0"
546.Dl "disklabel64 -e da0s0"
547.Sh ALIGNMENT
548When a virgin disklabel64 is laid down a
549.Dx 2.5
550or later kernel will align the partition start offset relative to the
551physical drive instead of relative to the slice start.
552This overcomes the issue of fdisk creating a badly aligned slice by default.
553The kernel will use a 1MiB (1024 * 1024 byte) alignment.
554The purpose of this alignment is to match swap and cluster operations
555against the physical block size of the underlying device.
556.Pp
557Even though nearly all devices still report a logical sector size of 512,
558newer hard drives are starting to use larger physical sector sizes
559and, in particular, solid state drives (SSDs) use a physical block size
560of 64K (SLC) or 128K (MLC).  We choose a 1 megabyte alignment to cover our
561bases down the road.  64-bit disklabels are not designed to be put on
562ultra-tiny storage devices.
563.Pp
564It is worth noting that aligning cluster operations is particularly
565important for SSDs and doubly so when
566.Xr swapcache 8
567is used with a SSD.
568Swapcache is able to use large bulk writes which greatly reduces the degree
569of write magnification on SSD media and it is possible to get upwards of
5705x more endurance out of the device than the vendor spec sheet indicates.
571.Sh FILES
572.Bl -tag -width ".Pa /boot/boot2_64" -compact
573.It Pa /boot/boot1_64
574Default stage1 boot image.
575.It Pa /boot/boot2_64
576Default stage2 boot image.
577.It Pa /etc/disktab
578Disk description file.
579.El
580.Sh SAVED FILE FORMAT
581The
582.Nm
583utility uses an
584.Tn ASCII
585version of the label when examining, editing, or restoring a disk label.
586An example shows as below:
587.Bd -literal -offset 4n
588# /dev/ad0s1:
589#
590# Calculated informational fields for the slice:
591#
592# boot space:    1012224 bytes
593# data space:  156286976 blocks	# 152624.00 MB (160037863424 bytes)
594#
595# NOTE: The partition data base and stop are physically
596#       aligned instead of slice-relative aligned.
597#
598# All byte equivalent offsets must be aligned.
599#
600diskid: 5dc53a64-c5e5-11e7-8aec-011d0988acd3
601label:
602boot2 data base:      0x000000001000
603partitions data base: 0x0000000f8200
604partitions data stop: 0x0025430f8200
605backup label:         0x002543157200
606total size:           0x002543158200	# 152625.34 MB
607alignment: 4096
608display block size: 1024	# for partition display and edit only
609
61016 partitions:
611#          size     offset    fstype   fsuuid
612  a:    1048576          0    4.2BSD	#    1024.000MB
613  b:   16777216    1048576      swap	#   16384.000MB
614  d:  138461184   17825792    HAMMER	#  135216.000MB
615  a-stor_uuid: 7f1ff0ee-c5ec-11e7-8aec-011d0988acd3
616  b-stor_uuid: 7f1ff0fc-c5ec-11e7-8aec-011d0988acd3
617  d-stor_uuid: 7f1ff108-c5ec-11e7-8aec-011d0988acd3
618.Ed
619.Pp
620Lines starting with a
621.Ql #
622mark are comments.
623The specifications which can be changed are:
624.Bl -inset
625.It Ar label
626is an optional label, set by the
627.Ar packid
628option when writing a label.
629.It Ar "the partition table"
630is the
631.Ux
632partition table, not the
633.Tn DOS
634partition table described in
635.Xr fdisk 8 .
636.El
637.Pp
638The partition table can have up to 16 entries.
639It contains the following information:
640.Bl -tag -width indent
641.It Ar #
642The partition identifier is a single letter in the range
643.Ql a
644to
645.Ql p .
646.It Ar size
647The size of the partition in sectors,
648.Cm K
649(kilobytes - 1024),
650.Cm M
651(megabytes - 1024*1024),
652.Cm G
653(gigabytes - 1024*1024*1024),
654.Cm T
655(terabytes - 1024*1024*1024*1024),
656.Cm %
657(percentage of free space
658.Em after
659removing any fixed-size partitions),
660.Cm *
661(all remaining free space
662.Em after
663fixed-size and percentage partitions).
664Lowercase versions of
665.Cm K , M , G ,
666and
667.Cm T
668are allowed.
669Size and type should be specified without any spaces between them.
670.Pp
671Example: 2097152, 1G, 1024M and 1048576K are all the same size
672(assuming 512-byte sectors).
673.It Ar offset
674The offset of the start of the partition from the beginning of the
675drive in sectors, or
676.Cm *
677to have
678.Nm
679calculate the correct offset to use (the end of the previous partition plus
680one.
681.It Ar fstype
682The name of the filesystem type for the partition (case insensitive).
683For
684.Xr UFS 5
685file systems, use type
686.Cm 4.2BSD .
687For
688.Xr HAMMER 5
689file systems, use type
690.Cm HAMMER .
691For
692.Xr hammer2 8
693file systems, use type
694.Cm HAMMER2 .
695For
696.Xr ccd 4
697partitions, use type
698.Cm ccd .
699For Vinum drives, use type
700.Cm vinum .
701Other common types are
702.Cm swap
703and
704.Cm unused .
705The
706.Nm
707utility
708also knows about a number of other partition types,
709none of which are in current use.
710(See
711.Dv fstypenames
712in
713.In sys/dtype.h
714for more details).
715.El
716.Pp
717The remainder of the line is a comment and shows the size of
718the partition in MB.
719.Sh EXAMPLES
720.Dl "disklabel64 da0s1"
721.Pp
722Display the in-core label for the first slice of the
723.Pa da0
724disk, as obtained via
725.Pa /dev/da0s1 .
726(If the disk is
727.Dq dangerously-dedicated ,
728the compatibility slice name should be specified, such as
729.Pa da0s0 . )
730.Pp
731.Dl "disklabel64 da0s1 > savedlabel"
732.Pp
733Save the in-core label for
734.Pa da0s1
735into the file
736.Pa savedlabel .
737This file can be used with the
738.Fl R
739option to restore the label at a later date.
740.Pp
741.Dl "disklabel64 -e -r da0s1"
742.Pp
743Read the on-disk label for
744.Pa da0s1 ,
745edit it, and reinstall in-core as well as on-disk.
746Existing bootstrap code is unaffected.
747.Pp
748.Dl "disklabel64 -e -r -n da0s1"
749.Pp
750Read the on-disk label for
751.Pa da0s1 ,
752edit it, and display what the new label would be.
753It does
754.Em not
755install the new label either in-core or on-disk.
756.Pp
757.Dl "disklabel64 -r -w da0s1"
758.Pp
759Try to auto-detect the required information from
760.Pa da0s1 ,
761and write a new label to the disk.
762Use another
763.Nm Fl e
764command to edit the partitioning information.
765.Pp
766.Dl "disklabel64 -R da0s1 savedlabel"
767.Pp
768Restore the on-disk and in-core label for
769.Pa da0s1
770from information in
771.Pa savedlabel .
772Existing bootstrap code is unaffected.
773.Pp
774.Dl "disklabel64 -R -n da0s1 label_layout"
775.Pp
776Display what the label would be for
777.Pa da0s1
778using the partition layout in
779.Pa label_layout .
780This is useful for determining how much space would be allotted for various
781partitions with a labelling scheme using
782.Cm % Ns -based
783or
784.Cm *
785partition sizes.
786.Pp
787.Dl "disklabel64 -B da0s1"
788.Pp
789Install a new bootstrap on
790.Pa da0s1 .
791The boot code comes from
792.Pa /boot/boot1_64
793and possibly
794.Pa /boot/boot2_64 .
795On-disk and in-core labels are unchanged.
796.Pp
797.Dl "disklabel64 -w -B /dev/da0s1 -b newboot1 -s newboot2"
798.Pp
799Install a new label and bootstrap, with bootstrap code comes from the files
800.Pa newboot1
801and
802.Pa newboot2 .
803.Pp
804.Dl "dd if=/dev/zero of=/dev/da0 bs=512 count=32"
805.Dl "fdisk -BI da0"
806.Dl "dd if=/dev/zero of=/dev/da0s1 bs=512 count=32"
807.Dl "disklabel64 -w -B da0s1"
808.Dl "disklabel64 -e da0s1"
809.Pp
810Completely wipe any prior information on the disk, creating a new bootable
811disk with a DOS partition table containing one
812.Dq whole-disk
813slice.
814Then
815initialize the slice, then edit it to your needs.
816The
817.Pa dd
818commands are optional, but may be necessary for some BIOSes to properly
819recognize the disk.
820.Pp
821.Dl "disklabel64 -W da0s1"
822.Dl "dd if=/dev/zero of=/dev/da0s1 bs=512 count=32"
823.Dl "disklabel32 -r -w da0s1"
824.Dl "disklabel32 -N da0s1"
825.Pp
826Completely wipe any prior information on the slice,
827and install the old 32-bit label.
828The wiping is needed because both
829.Nm disklabel32
830and
831.Nm ,
832as a safety measure,
833won't do any operations if label with other format is already installed.
834.Pp
835This is an example disklabel that uses some of the new partition size types
836such as
837.Cm % , M , G , T ,
838and
839.Cm * ,
840which could be used as a source file for:
841.Pp
842.Dl "disklabel64 -R ad0s1 new_label_file"
843.Bd -literal -offset 4n
844# /dev/ad0s1:
845#
846# Calculated informational fields for the slice:
847#
848# boot space:    1012224 bytes
849# data space:  156286976 blocks	# 152624.00 MB (160037863424 bytes)
850#
851# NOTE: The partition data base and stop are physically
852#       aligned instead of slice-relative aligned.
853#
854# All byte equivalent offsets must be aligned.
855#
856diskid: 5dc53a64-c5e5-11e7-8aec-011d0988acd3
857label:
858boot2 data base:      0x000000001000
859partitions data base: 0x0000000f8200
860partitions data stop: 0x0025430f8200
861backup label:         0x002543157200
862total size:           0x002543158200	# 152625.34 MB
863alignment: 4096
864display block size: 1024	# for partition display and edit only
865
86616 partitions:
867#          size     offset    fstype   fsuuid
868  a:      1024M          0    4.2BSD
869  b:         4G          *      swap
870  d:         2G          *    4.2BSD
871  e:      2048M          *    4.2BSD
872  f:         4G          *    4.2BSD
873  g:         4G          *    4.2BSD
874  h:        50G          *    HAMMER
875  i:          *          *    HAMMER2
876  j:         5g          *       ccd
877  k:      5120m          *     vinum
878.Ed
879.Sh DIAGNOSTICS
880The kernel device drivers will not allow the size of a disk partition
881to be decreased or the offset of a partition to be changed while it is open.
882Some device drivers create a label containing only a single large partition
883if a disk is unlabeled; thus, the label must be written to the
884.Ql a
885partition of the disk while it is open.
886This sometimes requires the desired
887label to be set in two steps, the first one creating at least one other
888partition, and the second setting the label on the new partition while
889shrinking the
890.Ql a
891partition.
892.Sh SEE ALSO
893.Xr dd 1 ,
894.Xr uuid 3 ,
895.Xr ccd 4 ,
896.Xr disklabel64 5 ,
897.Xr disktab 5 ,
898.Xr boot0cfg 8 ,
899.Xr diskinfo 8 ,
900.Xr disklabel32 8 ,
901.Xr fdisk 8 ,
902.Xr gpt 8 ,
903.Xr hammer2 8 ,
904.Xr newfs 8 ,
905.Xr newfs_hammer 8 ,
906.Xr newfs_hammer2 8 ,
907.Xr vinum 8
908.Sh BUGS
909The
910.Nm
911utility
912does not perform all possible error checking.
913Warning
914.Em is
915given if partitions
916overlap; if an absolute offset does not match the expected offset; if a
917partition runs past the end of the device; and a number of other errors; but
918no warning is given if space remains unused.
919.Pp
920The
921.Xr disktab 5
922support is not implemented.
923