xref: /freebsd/lib/geom/part/gpart.8 (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1.\" Copyright (c) 2007, 2008 Marcel Moolenaar
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd September 2, 2024
26.Dt GPART 8
27.Os
28.Sh NAME
29.Nm gpart
30.Nd "control utility for the disk partitioning GEOM class"
31.Sh SYNOPSIS
32.\" ==== ADD ====
33.Nm
34.Cm add
35.Fl t Ar type
36.Op Fl a Ar alignment
37.Op Fl b Ar start
38.Op Fl s Ar size
39.Op Fl i Ar index
40.Op Fl l Ar label
41.Op Fl f Ar flags
42.Ar geom
43.\" ==== BACKUP ====
44.Nm
45.Cm backup
46.Ar geom
47.\" ==== BOOTCODE ====
48.Nm
49.Cm bootcode
50.Op Fl N
51.Op Fl b Ar bootcode
52.Op Fl p Ar partcode Fl i Ar index
53.Op Fl f Ar flags
54.Ar geom
55.\" ==== COMMIT ====
56.Nm
57.Cm commit
58.Ar geom
59.\" ==== CREATE ====
60.Nm
61.Cm create
62.Fl s Ar scheme
63.Op Fl n Ar entries
64.Op Fl f Ar flags
65.Ar provider
66.\" ==== DELETE ====
67.Nm
68.Cm delete
69.Fl i Ar index
70.Op Fl f Ar flags
71.Ar geom
72.\" ==== DESTROY ====
73.Nm
74.Cm destroy
75.Op Fl F
76.Op Fl f Ar flags
77.Ar geom
78.\" ==== MODIFY ====
79.Nm
80.Cm modify
81.Fl i Ar index
82.Op Fl l Ar label
83.Op Fl t Ar type
84.Op Fl f Ar flags
85.Ar geom
86.\" ==== RECOVER ====
87.Nm
88.Cm recover
89.Op Fl f Ar flags
90.Ar geom
91.\" ==== RESIZE ====
92.Nm
93.Cm resize
94.Fl i Ar index
95.Op Fl a Ar alignment
96.Op Fl s Ar size
97.Op Fl f Ar flags
98.Ar geom
99.\" ==== RESTORE ====
100.Nm
101.Cm restore
102.Op Fl lF
103.Op Fl f Ar flags
104.Ar provider
105.Op Ar ...
106.\" ==== SET ====
107.Nm
108.Cm set
109.Fl a Ar attrib
110.Fl i Ar index
111.Op Fl f Ar flags
112.Ar geom
113.\" ==== SHOW ====
114.Nm
115.Cm show
116.Op Fl l | r
117.Op Fl p
118.Op Ar geom ...
119.\" ==== UNDO ====
120.Nm
121.Cm undo
122.Ar geom
123.\" ==== UNSET ====
124.Nm
125.Cm unset
126.Fl a Ar attrib
127.Fl i Ar index
128.Op Fl f Ar flags
129.Ar geom
130.\"
131.Nm
132.Cm list
133.Nm
134.Cm status
135.Nm
136.Cm load
137.Nm
138.Cm unload
139.Sh DESCRIPTION
140The
141.Nm
142utility is used to partition GEOM providers, normally disks.
143The first argument is the action to be taken:
144.Bl -tag -width ".Cm bootcode"
145.\" ==== ADD ====
146.It Cm add
147Add a new partition to the partitioning scheme given by
148.Ar geom .
149The partition type must be specified with
150.Fl t Ar type .
151The partition's location, size, and other attributes will be calculated
152automatically if the corresponding options are not specified.
153.Pp
154The
155.Cm add
156command accepts these options:
157.Bl -tag -width 12n
158.It Fl a Ar alignment
159If specified, then the
160.Nm
161utility tries to align
162.Ar start
163offset and partition
164.Ar size
165to be multiple of
166.Ar alignment
167value.
168.It Fl b Ar start
169The logical block address where the partition will begin.
170An SI unit suffix is allowed.
171.It Fl f Ar flags
172Additional operational flags.
173See the section entitled
174.Sx "OPERATIONAL FLAGS"
175below for a discussion
176about its use.
177.It Fl i Ar index
178The index in the partition table at which the new partition is to be
179placed.
180The index determines the name of the device special file used
181to represent the partition.
182.It Fl l Ar label
183The label attached to the partition.
184This option is only valid when used on partitioning schemes that support
185partition labels.
186.It Fl s Ar size
187Create a partition of size
188.Ar size .
189An SI unit suffix is allowed.
190.It Fl t Ar type
191Create a partition of type
192.Ar type .
193Partition types are discussed below in the section entitled
194.Sx "PARTITION TYPES" .
195.El
196.\" ==== BACKUP ====
197.It Cm backup
198Dump a partition table to standard output in a special format used by the
199.Cm restore
200action.
201.\" ==== BOOTCODE ====
202.It Cm bootcode
203Embed bootstrap code into the partitioning scheme's metadata on the
204.Ar geom
205(using
206.Fl b Ar bootcode )
207or write bootstrap code into a partition (using
208.Fl p Ar partcode
209and
210.Fl i Ar index ) .
211.Pp
212The
213.Cm bootcode
214command accepts these options:
215.Bl -tag -width 10n
216.It Fl N
217Do not preserve the Volume Serial Number for MBR.
218MBR bootcode contains Volume Serial Number by default, and
219.Nm
220tries to preserve it when installing new bootstrap code.
221This option skips preservation to help with some versions of
222.Xr boot0cfg 8
223that do not support Volume Serial Number.
224.It Fl b Ar bootcode
225Embed bootstrap code from the file
226.Ar bootcode
227into the partitioning scheme's metadata for
228.Ar geom .
229Not all partitioning schemes have embedded bootstrap code, so the
230.Fl b Ar bootcode
231option is scheme-specific in nature (see the section entitled
232.Sx BOOTSTRAPPING
233below).
234The
235.Ar bootcode
236file must match the partitioning scheme's requirements for file content
237and size.
238.It Fl f Ar flags
239Additional operational flags.
240See the section entitled
241.Sx "OPERATIONAL FLAGS"
242below for a discussion
243about its use.
244.It Fl i Ar index
245Specify the target partition for
246.Fl p Ar partcode .
247.It Fl p Ar partcode
248Write the bootstrap code from the file
249.Ar partcode
250into the
251.Ar geom
252partition specified by
253.Fl i Ar index .
254The size of the file must be smaller than the size of the partition.
255.El
256.\" ==== COMMIT ====
257.It Cm commit
258Commit any pending changes for geom
259.Ar geom .
260All actions are committed by default and will not result in
261pending changes.
262Actions can be modified with the
263.Fl f Ar flags
264option so that they are not committed, but become pending.
265Pending changes are reflected by the geom and the
266.Nm
267utility, but they are not actually written to disk.
268The
269.Cm commit
270action will write all pending changes to disk.
271.\" ==== CREATE ====
272.It Cm create
273Create a new partitioning scheme on a provider given by
274.Ar provider .
275The scheme to use must be specified with the
276.Fl s Ar scheme
277option.
278.Pp
279The
280.Cm create
281command accepts these options:
282.Bl -tag -width 10n
283.It Fl f Ar flags
284Additional operational flags.
285See the section entitled
286.Sx "OPERATIONAL FLAGS"
287below for a discussion
288about its use.
289.It Fl n Ar entries
290The number of entries in the partition table.
291Every partitioning scheme has a minimum and maximum number of entries.
292This option allows tables to be created with a number of entries
293that is within the limits.
294Some schemes have a maximum equal to the minimum and some schemes have
295a maximum large enough to be considered unlimited.
296By default, partition tables are created with the minimum number of
297entries.
298.It Fl s Ar scheme
299Specify the partitioning scheme to use.
300The kernel must have support for a particular scheme before
301that scheme can be used to partition a disk.
302.El
303.\" ==== DELETE ====
304.It Cm delete
305Delete a partition from geom
306.Ar geom
307and further identified by the
308.Fl i Ar index
309option.
310The partition cannot be actively used by the kernel.
311.Pp
312The
313.Cm delete
314command accepts these options:
315.Bl -tag -width 10n
316.It Fl f Ar flags
317Additional operational flags.
318See the section entitled
319.Sx "OPERATIONAL FLAGS"
320below for a discussion
321about its use.
322.It Fl i Ar index
323Specifies the index of the partition to be deleted.
324.El
325.\" ==== DESTROY ====
326.It Cm destroy
327Destroy the partitioning scheme as implemented by geom
328.Ar geom .
329.Pp
330The
331.Cm destroy
332command accepts these options:
333.Bl -tag -width 10n
334.It Fl F
335Forced destroying of the partition table even if it is not empty.
336.It Fl f Ar flags
337Additional operational flags.
338See the section entitled
339.Sx "OPERATIONAL FLAGS"
340below for a discussion
341about its use.
342.El
343.\" ==== MODIFY ====
344.It Cm modify
345Modify a partition from geom
346.Ar geom
347and further identified by the
348.Fl i Ar index
349option.
350Only the type and/or label of the partition can be modified.
351Not all partitioning schemes support labels and it is invalid to
352try to change a partition label in such cases.
353.Pp
354The
355.Cm modify
356command accepts these options:
357.Bl -tag -width 10n
358.It Fl f Ar flags
359Additional operational flags.
360See the section entitled
361.Sx "OPERATIONAL FLAGS"
362below for a discussion
363about its use.
364.It Fl i Ar index
365Specifies the index of the partition to be modified.
366.It Fl l Ar label
367Change the partition label to
368.Ar label .
369.It Fl t Ar type
370Change the partition type to
371.Ar type .
372.El
373.\" ==== RECOVER ====
374.It Cm recover
375Recover a corrupt partition's scheme metadata on the geom
376.Ar geom .
377See the section entitled
378.Sx RECOVERING
379below for the additional information.
380.Pp
381The
382.Cm recover
383command accepts these options:
384.Bl -tag -width 10n
385.It Fl f Ar flags
386Additional operational flags.
387See the section entitled
388.Sx "OPERATIONAL FLAGS"
389below for a discussion
390about its use.
391.El
392.\" ==== RESIZE ====
393.It Cm resize
394Resize a partition from geom
395.Ar geom
396and further identified by the
397.Fl i Ar index
398option.
399If the new size is not specified it is automatically calculated
400to be the maximum available from
401.Ar geom .
402.Pp
403The
404.Cm resize
405command accepts these options:
406.Bl -tag -width 12n
407.It Fl a Ar alignment
408If specified, then the
409.Nm
410utility tries to align partition
411.Ar size
412to be a multiple of the
413.Ar alignment
414value.
415.It Fl f Ar flags
416Additional operational flags.
417See the section entitled
418.Sx "OPERATIONAL FLAGS"
419below for a discussion
420about its use.
421.It Fl i Ar index
422Specifies the index of the partition to be resized.
423.It Fl s Ar size
424Specifies the new size of the partition, in logical blocks.
425An SI unit suffix is allowed.
426.El
427.\" ==== RESTORE ====
428.It Cm restore
429Restore the partition table from a backup previously created by the
430.Cm backup
431action and read from standard input.
432Only the partition table is restored.
433This action does not affect the content of partitions.
434After restoring the partition table and writing bootcode if needed,
435user data must be restored from backup.
436.Pp
437The
438.Cm restore
439command accepts these options:
440.Bl -tag -width 10n
441.It Fl F
442Destroy partition table on the given
443.Ar provider
444before doing restore.
445.It Fl f Ar flags
446Additional operational flags.
447See the section entitled
448.Sx "OPERATIONAL FLAGS"
449below for a discussion
450about its use.
451.It Fl l
452Restore partition labels for partitioning schemes that support them.
453.El
454.\" ==== SET ====
455.It Cm set
456Set the named attribute on the partition entry.
457See the section entitled
458.Sx ATTRIBUTES
459below for a list of available attributes.
460.Pp
461The
462.Cm set
463command accepts these options:
464.Bl -tag -width 10n
465.It Fl a Ar attrib
466Specifies the attribute to set.
467.It Fl f Ar flags
468Additional operational flags.
469See the section entitled
470.Sx "OPERATIONAL FLAGS"
471below for a discussion
472about its use.
473.It Fl i Ar index
474Specifies the index of the partition on which the attribute will be set.
475.El
476.\" ==== SHOW ====
477.It Cm show
478Show current partition information for the specified geoms, or all
479geoms if none are specified.
480The default output includes the logical starting block of each
481partition, the partition size in blocks, the partition index number,
482the partition type, and a human readable partition size.
483Block sizes and locations are based on the device's Sectorsize
484as shown by
485.Cm gpart list .
486.Pp
487The
488.Cm show
489command accepts these options:
490.Bl -tag -width 10n
491.It Fl l
492For partitioning schemes that support partition labels, print them
493instead of partition type.
494.It Fl p
495Show provider names instead of partition indexes.
496.It Fl r
497Show raw partition type instead of symbolic name.
498.El
499.\" ==== UNDO ====
500.It Cm undo
501Revert any pending changes for geom
502.Ar geom .
503This action is the opposite of the
504.Cm commit
505action and can be used to undo any changes that have not been committed.
506.\" ==== UNSET ====
507.It Cm unset
508Clear the named attribute on the partition entry.
509See the section entitled
510.Sx ATTRIBUTES
511below for a list of available attributes.
512.Pp
513The
514.Cm unset
515command accepts these options:
516.Bl -tag -width 10n
517.It Fl a Ar attrib
518Specifies the attribute to clear.
519.It Fl f Ar flags
520Additional operational flags.
521See the section entitled
522.Sx "OPERATIONAL FLAGS"
523below for a discussion
524about its use.
525.It Fl i Ar index
526Specifies the index of the partition on which the attribute will be cleared.
527.El
528.It Cm list
529See
530.Xr geom 8 .
531.It Cm status
532See
533.Xr geom 8 .
534.It Cm load
535See
536.Xr geom 8 .
537.It Cm unload
538See
539.Xr geom 8 .
540.El
541.Sh PARTITIONING SCHEMES
542Several partitioning schemes are supported by the
543.Nm
544utility:
545.Bl -tag -width ".Cm BSD64"
546.It Cm APM
547Apple Partition Map, used by PowerPC(R) Macintosh(R) computers.
548Requires the
549.Cd GEOM_PART_APM
550kernel option.
551.It Cm BSD
552Traditional BSD
553.Xr disklabel 8 ,
554usually used to subdivide MBR partitions.
555.Po
556This scheme can also be used as the sole partitioning method, without
557an MBR.
558Partition editing tools from other operating systems often do not
559understand the bare disklabel partition layout, so this is sometimes
560called
561.Dq dangerously dedicated .
562.Pc
563Requires the
564.Cm GEOM_PART_BSD
565kernel option.
566.It Cm BSD64
56764-bit implementation of BSD disklabel used in
568.Dx
569to subdivide MBR
570or GPT partitions.
571Requires the
572.Cm GEOM_PART_BSD64
573kernel option.
574.It Cm LDM
575The Logical Disk Manager is an implementation of volume manager for
576Microsoft Windows NT.
577Requires the
578.Cd GEOM_PART_LDM
579kernel option.
580.It Cm GPT
581GUID Partition Table is used on Intel-based Macintosh computers and
582gradually replacing MBR on most PCs and other systems.
583Requires the
584.Cm GEOM_PART_GPT
585kernel option.
586.It Cm MBR
587Master Boot Record is used on PCs and removable media.
588Requires the
589.Cm GEOM_PART_MBR
590kernel option.
591The
592.Cm GEOM_PART_EBR
593option adds support for the Extended Boot Record (EBR),
594which is used to define a logical partition.
595The
596.Cm GEOM_PART_EBR_COMPAT
597option enables backward compatibility for partition names
598in the EBR scheme.
599It also prevents any type of actions on such partitions.
600.El
601.Pp
602See
603.Xr glabel 8
604for additional information on labelization of devices and partitions.
605.Sh PARTITION TYPES
606Partition types are identified on disk by particular strings or magic
607values.
608The
609.Nm
610utility uses symbolic names for common partition types so the user
611does not need to know these values or other details of the partitioning
612scheme in question.
613The
614.Nm
615utility also allows the user to specify scheme-specific partition types
616for partition types that do not have symbolic names.
617Symbolic names currently understood and used by
618.Fx
619are:
620.Bl -tag -width ".Cm dragonfly-disklabel64"
621.It Cm apple-boot
622The system partition dedicated to storing boot loaders on some Apple
623systems.
624The scheme-specific types are
625.Qq Li "!171"
626for MBR,
627.Qq Li "!Apple_Bootstrap"
628for APM, and
629.Qq Li "!426f6f74-0000-11aa-aa11-00306543ecac"
630for GPT.
631.It Cm bios-boot
632The system partition dedicated to second stage of the boot loader program.
633Usually it is used by the GRUB 2 loader for GPT partitioning schemes.
634The scheme-specific type is
635.Qq Li "!21686148-6449-6E6F-744E-656564454649" .
636.It Cm efi
637The system partition for computers that use the Extensible Firmware
638Interface (EFI).
639The scheme-specific types are
640.Qq Li "!239"
641for MBR, and
642.Qq Li "!c12a7328-f81f-11d2-ba4b-00a0c93ec93b"
643for GPT.
644.It Cm freebsd
645A
646.Fx
647partition subdivided into filesystems with a
648.Bx
649disklabel.
650This is a legacy partition type and should not be used for the APM
651or GPT schemes.
652The scheme-specific types are
653.Qq Li "!165"
654for MBR,
655.Qq Li "!FreeBSD"
656for APM, and
657.Qq Li "!516e7cb4-6ecf-11d6-8ff8-00022d09712b"
658for GPT.
659.It Cm freebsd-boot
660A
661.Fx
662partition dedicated to bootstrap code.
663The scheme-specific type is
664.Qq Li "!83bd6b9d-7f41-11dc-be0b-001560b84f0f"
665for GPT.
666.It Cm freebsd-swap
667A
668.Fx
669partition dedicated to swap space.
670The scheme-specific types are
671.Qq Li "!FreeBSD-swap"
672for APM, and
673.Qq Li "!516e7cb5-6ecf-11d6-8ff8-00022d09712b"
674for GPT.
675.It Cm freebsd-ufs
676A
677.Fx
678partition that contains a UFS or UFS2 filesystem.
679The scheme-specific types are
680.Qq Li "!FreeBSD-UFS"
681for APM, and
682.Qq Li "!516e7cb6-6ecf-11d6-8ff8-00022d09712b"
683for GPT.
684.It Cm freebsd-vinum
685A
686.Fx
687partition that contains a Vinum volume.
688The scheme-specific types are
689.Qq Li "!FreeBSD-Vinum"
690for APM, and
691.Qq Li "!516e7cb8-6ecf-11d6-8ff8-00022d09712b"
692for GPT.
693.It Cm freebsd-zfs
694A
695.Fx
696partition that contains a ZFS volume.
697The scheme-specific types are
698.Qq Li "!FreeBSD-ZFS"
699for APM, and
700.Qq Li "!516e7cba-6ecf-11d6-8ff8-00022d09712b"
701for GPT.
702.El
703.Pp
704Other symbolic names that can be used with the
705.Nm
706utility are:
707.Bl -tag -width ".Cm dragonfly-disklabel64"
708.It Cm apple-apfs
709An Apple macOS partition used for the Apple file system, APFS.
710.It Cm apple-core-storage
711An Apple Mac OS X partition used by logical volume manager known as
712Core Storage.
713The scheme-specific type is
714.Qq Li "!53746f72-6167-11aa-aa11-00306543ecac"
715for GPT.
716.It Cm apple-hfs
717An Apple Mac OS X partition that contains a HFS or HFS+ filesystem.
718The scheme-specific types are
719.Qq Li "!175"
720for MBR,
721.Qq Li "!Apple_HFS"
722for APM and
723.Qq Li "!48465300-0000-11aa-aa11-00306543ecac"
724for GPT.
725.It Cm apple-label
726An Apple Mac OS X partition dedicated to partition metadata that descibes
727disk device.
728The scheme-specific type is
729.Qq Li "!4c616265-6c00-11aa-aa11-00306543ecac"
730for GPT.
731.It Cm apple-raid
732An Apple Mac OS X partition used in a software RAID configuration.
733The scheme-specific type is
734.Qq Li "!52414944-0000-11aa-aa11-00306543ecac"
735for GPT.
736.It Cm apple-raid-offline
737An Apple Mac OS X partition used in a software RAID configuration.
738The scheme-specific type is
739.Qq Li "!52414944-5f4f-11aa-aa11-00306543ecac"
740for GPT.
741.It Cm apple-tv-recovery
742An Apple Mac OS X partition used by Apple TV.
743The scheme-specific type is
744.Qq Li "!5265636f-7665-11aa-aa11-00306543ecac"
745for GPT.
746.It Cm apple-ufs
747An Apple Mac OS X partition that contains a UFS filesystem.
748The scheme-specific types are
749.Qq Li "!168"
750for MBR,
751.Qq Li "!Apple_UNIX_SVR2"
752for APM and
753.Qq Li "!55465300-0000-11aa-aa11-00306543ecac"
754for GPT.
755.It Cm apple-zfs
756An Apple Mac OS X partition that contains a ZFS volume.
757The scheme-specific type is
758.Qq Li "!6a898cc3-1dd2-11b2-99a6-080020736631"
759for GPT.
760The same GUID is being used also for
761.Sy illumos/Solaris /usr partition .
762See
763.Sx CAVEATS
764section below.
765.It Cm dragonfly-label32
766A
767.Dx
768partition subdivided into filesystems with a
769.Bx
770disklabel.
771The scheme-specific type is
772.Qq Li "!9d087404-1ca5-11dc-8817-01301bb8a9f5"
773for GPT.
774.It Cm dragonfly-label64
775A
776.Dx
777partition subdivided into filesystems with a
778disklabel64.
779The scheme-specific type is
780.Qq Li "!3d48ce54-1d16-11dc-8696-01301bb8a9f5"
781for GPT.
782.It Cm dragonfly-legacy
783A legacy partition type used in
784.Dx .
785The scheme-specific type is
786.Qq Li "!bd215ab2-1d16-11dc-8696-01301bb8a9f5"
787for GPT.
788.It Cm dragonfly-ccd
789A
790.Dx
791partition used with Concatenated Disk driver.
792The scheme-specific type is
793.Qq Li "!dbd5211b-1ca5-11dc-8817-01301bb8a9f5"
794for GPT.
795.It Cm dragonfly-hammer
796A
797.Dx
798partition that contains a Hammer filesystem.
799The scheme-specific type is
800.Qq Li "!61dc63ac-6e38-11dc-8513-01301bb8a9f5"
801for GPT.
802.It Cm dragonfly-hammer2
803A
804.Dx
805partition that contains a Hammer2 filesystem.
806The scheme-specific type is
807.Qq Li "!5cbb9ad1-862d-11dc-a94d-01301bb8a9f5"
808for GPT.
809.It Cm dragonfly-swap
810A
811.Dx
812partition dedicated to swap space.
813The scheme-specific type is
814.Qq Li "!9d58fdbd-1ca5-11dc-8817-01301bb8a9f5"
815for GPT.
816.It Cm dragonfly-ufs
817A
818.Dx
819partition that contains an UFS1 filesystem.
820The scheme-specific type is
821.Qq Li "!9d94ce7c-1ca5-11dc-8817-01301bb8a9f5"
822for GPT.
823.It Cm dragonfly-vinum
824A
825.Dx
826partition used with Logical Volume Manager.
827The scheme-specific type is
828.Qq Li "!9dd4478f-1ca5-11dc-8817-01301bb8a9f5"
829for GPT.
830.It Cm ebr
831A partition subdivided into filesystems with a EBR.
832The scheme-specific type is
833.Qq Li "!5"
834for MBR.
835.It Cm fat16
836A partition that contains a FAT16 filesystem.
837The scheme-specific type is
838.Qq Li "!6"
839for MBR.
840.It Cm fat32
841A partition that contains a FAT32 filesystem.
842The scheme-specific type is
843.Qq Li "!11"
844for MBR.
845.It Cm fat32lba
846A partition that contains a FAT32 (LBA) filesystem.
847The scheme-specific type is
848.Qq Li "!12"
849for MBR.
850.It Cm hifive-fsbl
851A raw partition containing a HiFive first stage bootloader.
852The scheme-specific type is
853.Qq Li "!5b193300-fc78-40cd-8002-e86c45580b47"
854for GPT.
855.It Cm hifive-bbl
856A raw partition containing a HiFive second stage bootloader.
857The scheme-specific type is
858.Qq Li "!2e54b353-1271-4842-806f-e436d6af6985"
859for GPT.
860.It Cm linux-data
861A Linux partition that contains some filesystem with data.
862The scheme-specific types are
863.Qq Li "!131"
864for MBR and
865.Qq Li "!0fc63daf-8483-4772-8e79-3d69d8477de4"
866for GPT.
867.It Cm linux-lvm
868A Linux partition dedicated to Logical Volume Manager.
869The scheme-specific types are
870.Qq Li "!142"
871for MBR and
872.Qq Li "!e6d6d379-f507-44c2-a23c-238f2a3df928"
873for GPT.
874.It Cm linux-raid
875A Linux partition used in a software RAID configuration.
876The scheme-specific types are
877.Qq Li "!253"
878for MBR and
879.Qq Li "!a19d880f-05fc-4d3b-a006-743f0f84911e"
880for GPT.
881.It Cm linux-swap
882A Linux partition dedicated to swap space.
883The scheme-specific types are
884.Qq Li "!130"
885for MBR and
886.Qq Li "!0657fd6d-a4ab-43c4-84e5-0933c84b4f4f"
887for GPT.
888.It Cm mbr
889A partition that is sub-partitioned by a Master Boot Record (MBR).
890This type is known as
891.Qq Li "!024dee41-33e7-11d3-9d69-0008c781f39f"
892by GPT.
893.It Cm ms-basic-data
894A basic data partition (BDP) for Microsoft operating systems.
895In the GPT this type is the equivalent to partition types
896.Cm fat16 , fat32
897and
898.Cm ntfs
899in MBR.
900This type is used for GPT exFAT partitions.
901The scheme-specific type is
902.Qq Li "!ebd0a0a2-b9e5-4433-87c0-68b6b72699c7"
903for GPT.
904.It Cm ms-ldm-data
905A partition that contains Logical Disk Manager (LDM) volumes.
906The scheme-specific types are
907.Qq Li "!66"
908for MBR,
909.Qq Li "!af9b60a0-1431-4f62-bc68-3311714a69ad"
910for GPT.
911.It Cm ms-ldm-metadata
912A partition that contains Logical Disk Manager (LDM) database.
913The scheme-specific type is
914.Qq Li "!5808c8aa-7e8f-42e0-85d2-e1e90434cfb3"
915for GPT.
916.It Cm netbsd-ccd
917A
918.Nx
919partition used with Concatenated Disk driver.
920The scheme-specific type is
921.Qq Li "!2db519c4-b10f-11dc-b99b-0019d1879648"
922for GPT.
923.It Cm netbsd-cgd
924An encrypted
925.Nx
926partition.
927The scheme-specific type is
928.Qq Li "!2db519ec-b10f-11dc-b99b-0019d1879648"
929for GPT.
930.It Cm netbsd-ffs
931A
932.Nx
933partition that contains an UFS filesystem.
934The scheme-specific type is
935.Qq Li "!49f48d5a-b10e-11dc-b99b-0019d1879648"
936for GPT.
937.It Cm netbsd-lfs
938A
939.Nx
940partition that contains an LFS filesystem.
941The scheme-specific type is
942.Qq Li "!49f48d82-b10e-11dc-b99b-0019d1879648"
943for GPT.
944.It Cm netbsd-raid
945A
946.Nx
947partition used in a software RAID configuration.
948The scheme-specific type is
949.Qq Li "!49f48daa-b10e-11dc-b99b-0019d1879648"
950for GPT.
951.It Cm netbsd-swap
952A
953.Nx
954partition dedicated to swap space.
955The scheme-specific type is
956.Qq Li "!49f48d32-b10e-11dc-b99b-0019d1879648"
957for GPT.
958.It Cm ntfs
959A partition that contains a NTFS or exFAT filesystem.
960The scheme-specific type is
961.Qq Li "!7"
962for MBR.
963.It Cm prep-boot
964The system partition dedicated to storing boot loaders on some PowerPC systems,
965notably those made by IBM.
966The scheme-specific types are
967.Qq Li "!65"
968for MBR and
969.Qq Li "!9e1a2d38-c612-4316-aa26-8b49521e5a8b"
970for GPT.
971.It Cm solaris-boot
972A illumos/Solaris partition dedicated to boot loader.
973The scheme-specific type is
974.Qq Li "!6a82cb45-1dd2-11b2-99a6-080020736631"
975for GPT.
976.It Cm solaris-root
977A illumos/Solaris partition dedicated to root filesystem.
978The scheme-specific type is
979.Qq Li "!6a85cf4d-1dd2-11b2-99a6-080020736631"
980for GPT.
981.It Cm solaris-swap
982A illumos/Solaris partition dedicated to swap.
983The scheme-specific type is
984.Qq Li "!6a87c46f-1dd2-11b2-99a6-080020736631"
985for GPT.
986.It Cm solaris-backup
987A illumos/Solaris partition dedicated to backup.
988The scheme-specific type is
989.Qq Li "!6a8b642b-1dd2-11b2-99a6-080020736631"
990for GPT.
991.It Cm solaris-var
992A illumos/Solaris partition dedicated to /var filesystem.
993The scheme-specific type is
994.Qq Li "!6a8ef2e9-1dd2-11b2-99a6-080020736631"
995for GPT.
996.It Cm solaris-home
997A illumos/Solaris partition dedicated to /home filesystem.
998The scheme-specific type is
999.Qq Li "!6a90ba39-1dd2-11b2-99a6-080020736631"
1000for GPT.
1001.It Cm solaris-altsec
1002A illumos/Solaris partition dedicated to alternate sector.
1003The scheme-specific type is
1004.Qq Li "!6a9283a5-1dd2-11b2-99a6-080020736631"
1005for GPT.
1006.It Cm solaris-reserved
1007A illumos/Solaris partition dedicated to reserved space.
1008The scheme-specific type is
1009.Qq Li "!6a945a3b-1dd2-11b2-99a6-080020736631"
1010for GPT.
1011.It Cm u-boot-env
1012A raw partition dedicated to U-Boot for storing its environment.
1013The scheme-specific type is
1014.Qq Li "!3de21764-95bd-54bd-a5c3-4abe786f38a8"
1015for GPT.
1016.It Cm vmware-vmfs
1017A partition that contains a VMware File System (VMFS).
1018The scheme-specific types are
1019.Qq Li "!251"
1020for MBR and
1021.Qq Li "!aa31e02a-400f-11db-9590-000c2911d1b8"
1022for GPT.
1023.It Cm vmware-vmkdiag
1024A partition that contains a VMware diagostic filesystem.
1025The scheme-specific types are
1026.Qq Li "!252"
1027for MBR and
1028.Qq Li "!9d275380-40ad-11db-bf97-000c2911d1b8"
1029for GPT.
1030.It Cm vmware-reserved
1031A VMware reserved partition.
1032The scheme-specific type is
1033.Qq Li "!9198effc-31c0-11db-8f-78-000c2911d1b8"
1034for GPT.
1035.It Cm vmware-vsanhdr
1036A partition claimed by VMware VSAN.
1037The scheme-specific type is
1038.Qq Li "!381cfccc-7288-11e0-92ee-000c2911d0b2"
1039for GPT.
1040.El
1041.Sh ATTRIBUTES
1042The scheme-specific attributes for EBR:
1043.Bl -tag -width ".Cm active"
1044.It Cm active
1045.El
1046.Pp
1047The scheme-specific attributes for GPT:
1048.Bl -tag -width ".Cm bootfailed"
1049.It Cm bootme
1050When set, the
1051.Nm gptboot
1052stage 1 boot loader will try to boot the system from this partition.
1053Multiple partitions can be marked with the
1054.Cm bootme
1055attribute.
1056See
1057.Xr gptboot 8
1058for more details.
1059.It Cm bootonce
1060Setting this attribute automatically sets the
1061.Cm bootme
1062attribute.
1063When set, the
1064.Nm gptboot
1065stage 1 boot loader will try to boot the system from this partition only once.
1066Multiple partitions can be marked with the
1067.Cm bootonce
1068and
1069.Cm bootme
1070attribute pairs.
1071See
1072.Xr gptboot 8
1073for more details.
1074.It Cm bootfailed
1075This attribute should not be manually managed.
1076It is managed by the
1077.Nm gptboot
1078stage 1 boot loader and the
1079.Pa /etc/rc.d/gptboot
1080start-up script.
1081See
1082.Xr gptboot 8
1083for more details.
1084.It Cm lenovofix
1085Setting this attribute overwrites the Protective MBR with a new one where
1086the 0xee partition is the second, rather than the first record.
1087This resolves a BIOS compatibility issue with some Lenovo models including the
1088X220, T420, and T520, allowing them to boot from GPT partitioned disks
1089without using EFI.
1090.El
1091.Pp
1092The scheme-specific attributes for MBR:
1093.Bl -tag -width ".Cm active"
1094.It Cm active
1095.El
1096.Sh BOOTSTRAPPING
1097.Fx
1098supports several partitioning schemes and each scheme uses different
1099bootstrap code.
1100The bootstrap code is located in a specific disk area for each partitioning
1101scheme, and may vary in size for different schemes.
1102.Pp
1103Bootstrap code can be separated into two types.
1104The first type is embedded in the partitioning scheme's metadata, while the
1105second type is located on a specific partition.
1106Embedding bootstrap code should only be done with the
1107.Cm gpart bootcode
1108command with the
1109.Fl b Ar bootcode
1110option.
1111The GEOM PART class knows how to safely embed bootstrap code into
1112specific partitioning scheme metadata without causing any damage.
1113.Pp
1114The Master Boot Record (MBR) uses a 512-byte bootstrap code image, embedded
1115into the partition table's metadata area.
1116There are two variants of this bootstrap code:
1117.Pa /boot/mbr
1118and
1119.Pa /boot/boot0 .
1120.Pa /boot/mbr
1121searches for a partition with the
1122.Cm active
1123attribute (see the
1124.Sx ATTRIBUTES
1125section) in the partition table.
1126Then it runs next bootstrap stage.
1127The
1128.Pa /boot/boot0
1129image contains a boot manager with some additional interactive functions
1130for multi-booting from a user-selected partition.
1131.Pp
1132A BSD disklabel is usually created inside an MBR partition (slice)
1133with type
1134.Cm freebsd
1135(see the
1136.Sx "PARTITION TYPES"
1137section).
1138It uses 8 KB size bootstrap code image
1139.Pa /boot/boot ,
1140embedded into the partition table's metadata area.
1141.Pp
1142Both types of bootstrap code are used to boot from the GUID Partition Table.
1143First, a protective MBR is embedded into the first disk sector from the
1144.Pa /boot/pmbr
1145image.
1146It searches through the GPT for a
1147.Cm freebsd-boot
1148partition (see the
1149.Sx "PARTITION TYPES"
1150section) and runs the next bootstrap stage from it.
1151The
1152.Cm freebsd-boot
1153partition should be smaller than 545 KB.
1154It can be located either before or after other
1155.Fx
1156partitions on the disk.
1157There are two variants of bootstrap code to write to this partition:
1158.Pa /boot/gptboot
1159and
1160.Pa /boot/gptzfsboot .
1161.Pp
1162.Pa /boot/gptboot
1163is used to boot from UFS partitions.
1164.Cm gptboot
1165searches through
1166.Cm freebsd-ufs
1167partitions in the GPT and selects one to boot based on the
1168.Cm bootonce
1169and
1170.Cm bootme
1171attributes.
1172If neither attribute is found,
1173.Pa /boot/gptboot
1174boots from the first
1175.Cm freebsd-ufs
1176partition.
1177.Pa /boot/loader
1178.Pq the third bootstrap stage
1179is loaded from the first partition that matches these conditions.
1180See
1181.Xr gptboot 8
1182for more information.
1183.Pp
1184.Pa /boot/gptzfsboot
1185is used to boot from ZFS.
1186It searches through the GPT for
1187.Cm freebsd-zfs
1188partitions, trying to detect ZFS pools.
1189After all pools are detected,
1190.Pa /boot/loader
1191is started from the first one found set as bootable.
1192.Pp
1193The APM scheme also does not support embedding bootstrap code.
1194Instead, the 800 KBytes bootstrap code image
1195.Pa /boot/boot1.hfs
1196should be written with the
1197.Cm gpart bootcode
1198command to a partition of type
1199.Cm apple-boot ,
1200which should also be 800 KB in size.
1201.Sh OPERATIONAL FLAGS
1202Actions other than the
1203.Cm commit
1204and
1205.Cm undo
1206actions take an optional
1207.Fl f Ar flags
1208option.
1209This option is used to specify action-specific operational flags.
1210By default, the
1211.Nm
1212utility defines the
1213.Ql C
1214flag so that the action is immediately
1215committed.
1216The user can specify
1217.Dq Fl f Cm x
1218to have the action result in a pending change that can later, with
1219other pending changes, be committed as a single compound change with
1220the
1221.Cm commit
1222action or reverted with the
1223.Cm undo
1224action.
1225.Sh RECOVERING
1226The GEOM PART class supports recovering of partition tables only for GPT.
1227The GPT primary metadata is stored at the beginning of the device.
1228For redundancy, a secondary
1229.Pq backup
1230copy of the metadata is stored at the end of the device.
1231As a result of having two copies, some corruption of metadata is not
1232fatal to the working of GPT.
1233When the kernel detects corrupt metadata, it marks this table as corrupt
1234and reports the problem.
1235.Cm destroy
1236and
1237.Cm recover
1238are the only operations allowed on corrupt tables.
1239.Pp
1240If one GPT header appears to be corrupt but the other copy remains intact,
1241the kernel will log the following:
1242.Bd -literal -offset indent
1243GEOM: provider: the primary GPT table is corrupt or invalid.
1244GEOM: provider: using the secondary instead -- recovery strongly advised.
1245.Ed
1246.Pp
1247or
1248.Bd -literal -offset indent
1249GEOM: provider: the secondary GPT table is corrupt or invalid.
1250GEOM: provider: using the primary only -- recovery suggested.
1251.Ed
1252.Pp
1253Also
1254.Nm
1255commands such as
1256.Cm show , status
1257and
1258.Cm list
1259will report about corrupt tables.
1260.Pp
1261If the size of the device has changed (e.g.,\& volume expansion) the
1262secondary GPT header will no longer be located in the last sector.
1263This is not a metadata corruption, but it is dangerous because any
1264corruption of the primary GPT will lead to loss of the partition table.
1265This problem is reported by the kernel with the message:
1266.Bd -literal -offset indent
1267GEOM: provider: the secondary GPT header is not in the last LBA.
1268.Ed
1269.Pp
1270This situation can be recovered with the
1271.Cm recover
1272command.
1273This command reconstructs the corrupt metadata using known valid
1274metadata and relocates the secondary GPT to the end of the device.
1275.Pp
1276.Em NOTE :
1277The GEOM PART class can detect the same partition table visible through
1278different GEOM providers, and some of them will be marked as corrupt.
1279Be careful when choosing a provider for recovery.
1280If you choose incorrectly you can destroy the metadata of another GEOM class,
1281e.g.,\& GEOM MIRROR or GEOM LABEL.
1282.Sh SYSCTL VARIABLES
1283The following
1284.Xr sysctl 8
1285variables can be used to control the behavior of the
1286.Nm PART
1287GEOM class.
1288The default value is shown next to each variable.
1289.Bl -tag -width indent
1290.It Va kern.geom.part.allow_nesting : No 0
1291By default, some schemes (currently BSD and BSD64) do not permit
1292further nested partitioning.
1293This variable overrides this restriction and allows arbitrary nesting (except
1294within partitions created at offset 0).
1295Some schemes have their own separate checks, for which see below.
1296.It Va kern.geom.part.auto_resize : No 1
1297This variable controls automatic resize behavior of the
1298.Nm PART
1299GEOM class.
1300When this variable is enable and new size of provider is detected, the schema
1301metadata is resized but all changes are not saved to disk, until
1302.Cm gpart commit
1303is run to confirm changes.
1304This behavior is also reported with diagnostic message:
1305.Sy "GEOM_PART: (provider) was automatically resized."
1306.Sy "Use `gpart commit (provider)` to save changes or `gpart undo (provider)`"
1307.Sy "to revert them."
1308.It Va kern.geom.part.check_integrity : No 1
1309This variable controls the behaviour of metadata integrity checks.
1310When integrity checks are enabled, the
1311.Nm PART
1312GEOM class verifies all generic partition parameters obtained from the
1313disk metadata.
1314If some inconsistency is detected, the partition table will be
1315rejected with a diagnostic message:
1316.Sy "GEOM_PART: Integrity check failed (provider, scheme)" .
1317.It Va kern.geom.part.gpt.allow_nesting : No 0
1318By default the GPT scheme is allowed only at the outermost nesting level.
1319This variable allows this restriction to be removed.
1320.It Va kern.geom.part.ldm.debug : No 0
1321Debug level of the Logical Disk Manager (LDM) module.
1322This can be set to a number between 0 and 2 inclusive.
1323If set to 0 minimal debug information is printed,
1324and if set to 2 the maximum amount of debug information is printed.
1325.It Va kern.geom.part.ldm.show_mirrors : No 0
1326This variable controls how the Logical Disk Manager (LDM) module handles
1327mirrored volumes.
1328By default mirrored volumes are shown as partitions with type
1329.Cm ms-ldm-data
1330(see the
1331.Sx "PARTITION TYPES"
1332section).
1333If this variable set to 1 each component of the mirrored volume will be
1334present as independent partition.
1335.Em NOTE :
1336This may break a mirrored volume and lead to data damage.
1337.It Va kern.geom.part.mbr.enforce_chs : No 0
1338Specify how the Master Boot Record (MBR) module does alignment.
1339If this variable is set to a non-zero value, the module will automatically
1340recalculate the user-specified offset and size for alignment with the CHS
1341geometry.
1342Otherwise the values will be left unchanged.
1343.It Va kern.geom.part.separator : No ""
1344Specify an optional separator that will be inserted between the GEOM name
1345and partition name.
1346This variable is a
1347.Xr loader 8
1348tunable.
1349Note that setting this variable may break software which assumes a particular
1350naming scheme.
1351.El
1352.Sh EXIT STATUS
1353Exit status is 0 on success, and 1 if the command fails.
1354.Sh EXAMPLES
1355The examples below assume that the disk's logical block size is 512
1356bytes, regardless of its physical block size.
1357.Ss GPT
1358In this example, we will format
1359.Pa ada0
1360with the GPT scheme and create boot, swap and root partitions.
1361First, we need to create the partition table:
1362.Bd -literal -offset indent
1363/sbin/gpart create -s GPT ada0
1364.Ed
1365.Pp
1366Next, we install a protective MBR with the first-stage bootstrap code.
1367The protective MBR lists a single, bootable partition spanning the
1368entire disk, thus allowing non-GPT-aware BIOSes to boot from the disk
1369and preventing tools which do not understand the GPT scheme from
1370considering the disk to be unformatted.
1371.Bd -literal -offset indent
1372/sbin/gpart bootcode -b /boot/pmbr ada0
1373.Ed
1374.Pp
1375We then create a dedicated
1376.Cm freebsd-boot
1377partition to hold the second-stage boot loader, which will load the
1378.Fx
1379kernel and modules from a UFS or ZFS filesystem.
1380This partition must be larger than the bootstrap code
1381.Po
1382either
1383.Pa /boot/gptboot
1384for UFS or
1385.Pa /boot/gptzfsboot
1386for ZFS
1387.Pc ,
1388but smaller than 545 kB since the first-stage loader will load the
1389entire partition into memory during boot, regardless of how much data
1390it actually contains.
1391We create a 472-block (236 kB) boot partition at offset 40, which is
1392the size of the partition table (34 blocks or 17 kB) rounded up to the
1393nearest 4 kB boundary.
1394.Bd -literal -offset indent
1395/sbin/gpart add -b 40 -s 472 -t freebsd-boot ada0
1396/sbin/gpart bootcode -p /boot/gptboot -i 1 ada0
1397.Ed
1398.Pp
1399We now create a 4 GB swap partition at the first available offset,
1400which is 40 + 472 = 512 blocks (256 kB).
1401.Bd -literal -offset indent
1402/sbin/gpart add -s 4G -t freebsd-swap ada0
1403.Ed
1404.Pp
1405Aligning the swap partition and all subsequent partitions on a 256 kB
1406boundary ensures optimal performance on a wide range of media, from
1407plain old disks with 512-byte blocks, through modern
1408.Dq advanced format
1409disks with 4096-byte physical blocks, to RAID volumes with stripe
1410sizes of up to 256 kB.
1411.Pp
1412Finally, we create and format an 8 GB
1413.Cm freebsd-ufs
1414partition for the root filesystem, leaving the rest of the device free
1415for additional filesystems:
1416.Bd -literal -offset indent
1417/sbin/gpart add -s 8G -t freebsd-ufs ada0
1418/sbin/newfs -Uj /dev/ada0p3
1419.Ed
1420.Ss MBR
1421In this example, we will format
1422.Pa ada0
1423with the MBR scheme and create a single partition which we subdivide
1424using a traditional
1425.Bx
1426disklabel.
1427.Pp
1428First, we create the partition table as well as a single partition 64 GB in
1429size and an alignment of 4 kB, then we mark that partition active (bootable)
1430and install the first-stage boot loader:
1431.Bd -literal -offset indent
1432/sbin/gpart create -s MBR ada0
1433/sbin/gpart add -t freebsd -s 64G -a 4k ada0
1434/sbin/gpart set -a active -i 1 ada0
1435/sbin/gpart bootcode -b /boot/boot0 ada0
1436.Ed
1437.Pp
1438Next, we create a disklabel in that partition
1439.Po
1440.Dq slice
1441in disklabel terminology
1442.Pc
1443with room for up to 20 partitions:
1444.Bd -literal -offset indent
1445/sbin/gpart create -s BSD -n 20 ada0s1
1446.Ed
1447.Pp
1448We then create an 8 GB root partition and a 4 GB swap partition:
1449.Bd -literal -offset indent
1450/sbin/gpart add -t freebsd-ufs -s 8G ada0s1
1451/sbin/gpart add -t freebsd-swap -s 4G ada0s1
1452.Ed
1453.Pp
1454Finally, we install the appropriate boot loader for the
1455.Bx
1456label:
1457.Bd -literal -offset indent
1458/sbin/gpart bootcode -b /boot/boot ada0s1
1459.Ed
1460.Ss Deleting Partitions and Destroying the Partitioning Scheme
1461If a
1462.Em "Device busy"
1463error is shown when trying to destroy a partition table, remember that
1464all of the partitions must be deleted first with the
1465.Cm delete
1466action.
1467In this example,
1468.Pa da0
1469has three partitions:
1470.Bd -literal -offset indent
1471/sbin/gpart delete -i 3 da0
1472/sbin/gpart delete -i 2 da0
1473/sbin/gpart delete -i 1 da0
1474/sbin/gpart destroy da0
1475.Ed
1476.Pp
1477Rather than deleting each partition and then destroying the partitioning
1478scheme, the
1479.Fl F
1480option can be given with
1481.Cm destroy
1482to delete all of the partitions before destroying the partitioning scheme.
1483This is equivalent to the previous example:
1484.Bd -literal -offset indent
1485/sbin/gpart destroy -F da0
1486.Ed
1487.Ss Backup and Restore
1488Create a backup of the partition table from
1489.Pa da0 :
1490.Bd -literal -offset indent
1491/sbin/gpart backup da0 > da0.backup
1492.Ed
1493.Pp
1494Restore the partition table from the backup to
1495.Pa da0 :
1496.Bd -literal -offset indent
1497/sbin/gpart restore -l da0 < /mnt/da0.backup
1498.Ed
1499.Pp
1500Clone the partition table from
1501.Pa ada0
1502to
1503.Pa ada1
1504and
1505.Pa ada2 :
1506.Bd -literal -offset indent
1507/sbin/gpart backup ada0 | /sbin/gpart restore -F ada1 ada2
1508.Ed
1509.Sh SEE ALSO
1510.Xr geom 4 ,
1511.Xr boot0cfg 8 ,
1512.Xr geom 8 ,
1513.Xr glabel 8 ,
1514.Xr gptboot 8
1515.Sh HISTORY
1516The
1517.Nm
1518utility appeared in
1519.Fx 7.0 .
1520.Sh AUTHORS
1521.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org
1522.Sh CAVEATS
1523Partition type
1524.Em apple-zfs
1525(6a898cc3-1dd2-11b2-99a6-080020736631) is also being used
1526on illumos/Solaris platforms for ZFS volumes.
1527