2008-06-06 05:14:16 +00:00
|
|
|
.\" Copyright (c) 2007, 2008 Marcel Moolenaar
|
2007-05-15 20:25:18 +00:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2016-07-25 11:25:33 +00:00
|
|
|
.Dd July 25, 2016
|
2007-05-15 20:25:18 +00:00
|
|
|
.Dt GPART 8
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm gpart
|
|
|
|
.Nd "control utility for the disk partitioning GEOM class"
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.\" ==== ADD ====
|
|
|
|
.Nm
|
|
|
|
.Cm add
|
|
|
|
.Fl t Ar type
|
2011-05-03 07:33:39 +00:00
|
|
|
.Op Fl a Ar alignment
|
2010-07-23 11:00:43 +00:00
|
|
|
.Op Fl b Ar start
|
|
|
|
.Op Fl s Ar size
|
2007-05-15 20:25:18 +00:00
|
|
|
.Op Fl i Ar index
|
|
|
|
.Op Fl l Ar label
|
|
|
|
.Op Fl f Ar flags
|
|
|
|
.Ar geom
|
2010-11-20 16:03:53 +00:00
|
|
|
.\" ==== BACKUP ====
|
|
|
|
.Nm
|
|
|
|
.Cm backup
|
|
|
|
.Ar geom
|
2008-06-06 05:14:16 +00:00
|
|
|
.\" ==== BOOTCODE ====
|
|
|
|
.Nm
|
|
|
|
.Cm bootcode
|
2008-06-07 00:14:06 +00:00
|
|
|
.Op Fl b Ar bootcode
|
|
|
|
.Op Fl p Ar partcode Fl i Ar index
|
2008-06-06 05:14:16 +00:00
|
|
|
.Op Fl f Ar flags
|
|
|
|
.Ar geom
|
2007-05-15 20:25:18 +00:00
|
|
|
.\" ==== COMMIT ====
|
|
|
|
.Nm
|
|
|
|
.Cm commit
|
|
|
|
.Ar geom
|
|
|
|
.\" ==== CREATE ====
|
|
|
|
.Nm
|
|
|
|
.Cm create
|
|
|
|
.Fl s Ar scheme
|
|
|
|
.Op Fl n Ar entries
|
|
|
|
.Op Fl f Ar flags
|
|
|
|
.Ar provider
|
|
|
|
.\" ==== DELETE ====
|
|
|
|
.Nm
|
|
|
|
.Cm delete
|
|
|
|
.Fl i Ar index
|
|
|
|
.Op Fl f Ar flags
|
|
|
|
.Ar geom
|
|
|
|
.\" ==== DESTROY ====
|
|
|
|
.Nm
|
|
|
|
.Cm destroy
|
2010-09-24 08:40:43 +00:00
|
|
|
.Op Fl F
|
2007-05-15 20:25:18 +00:00
|
|
|
.Op Fl f Ar flags
|
|
|
|
.Ar geom
|
|
|
|
.\" ==== MODIFY ====
|
|
|
|
.Nm
|
|
|
|
.Cm modify
|
|
|
|
.Fl i Ar index
|
|
|
|
.Op Fl l Ar label
|
|
|
|
.Op Fl t Ar type
|
|
|
|
.Op Fl f Ar flags
|
|
|
|
.Ar geom
|
2010-10-25 16:23:35 +00:00
|
|
|
.\" ==== RECOVER ====
|
|
|
|
.Nm
|
|
|
|
.Cm recover
|
|
|
|
.Op Fl f Ar flags
|
|
|
|
.Ar geom
|
2010-04-23 03:14:04 +00:00
|
|
|
.\" ==== RESIZE ====
|
|
|
|
.Nm
|
|
|
|
.Cm resize
|
|
|
|
.Fl i Ar index
|
2011-05-03 07:33:39 +00:00
|
|
|
.Op Fl a Ar alignment
|
2010-04-23 03:14:04 +00:00
|
|
|
.Op Fl s Ar size
|
|
|
|
.Op Fl f Ar flags
|
|
|
|
.Ar geom
|
2010-11-20 16:03:53 +00:00
|
|
|
.\" ==== RESTORE ====
|
|
|
|
.Nm
|
|
|
|
.Cm restore
|
2010-11-22 10:08:33 +00:00
|
|
|
.Op Fl lF
|
2010-11-20 16:03:53 +00:00
|
|
|
.Op Fl f Ar flags
|
|
|
|
.Ar provider
|
|
|
|
.Op Ar ...
|
2008-06-18 01:46:32 +00:00
|
|
|
.\" ==== SET ====
|
|
|
|
.Nm
|
|
|
|
.Cm set
|
|
|
|
.Fl a Ar attrib
|
|
|
|
.Fl i Ar index
|
|
|
|
.Op Fl f Ar flags
|
|
|
|
.Ar geom
|
2007-10-21 00:04:23 +00:00
|
|
|
.\" ==== SHOW ====
|
|
|
|
.Nm
|
|
|
|
.Cm show
|
2011-06-03 10:39:36 +00:00
|
|
|
.Op Fl l | r
|
2011-05-27 14:30:13 +00:00
|
|
|
.Op Fl p
|
2007-10-21 00:04:23 +00:00
|
|
|
.Op Ar geom ...
|
2007-05-15 20:25:18 +00:00
|
|
|
.\" ==== UNDO ====
|
|
|
|
.Nm
|
|
|
|
.Cm undo
|
|
|
|
.Ar geom
|
2008-06-18 01:46:32 +00:00
|
|
|
.\" ==== UNSET ====
|
|
|
|
.Nm
|
2009-10-19 15:50:59 +00:00
|
|
|
.Cm unset
|
2008-06-18 01:46:32 +00:00
|
|
|
.Fl a Ar attrib
|
|
|
|
.Fl i Ar index
|
|
|
|
.Op Fl f Ar flags
|
|
|
|
.Ar geom
|
2007-05-15 20:25:18 +00:00
|
|
|
.\"
|
2014-08-03 21:54:22 +00:00
|
|
|
.Nm
|
|
|
|
.Cm list
|
|
|
|
.Nm
|
|
|
|
.Cm status
|
|
|
|
.Nm
|
|
|
|
.Cm load
|
|
|
|
.Nm
|
|
|
|
.Cm unload
|
2007-05-15 20:25:18 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is used to partition GEOM providers, normally disks.
|
2011-11-21 00:02:49 +00:00
|
|
|
The first argument is the action to be taken:
|
2009-10-19 15:50:59 +00:00
|
|
|
.Bl -tag -width ".Cm bootcode"
|
2007-05-15 20:25:18 +00:00
|
|
|
.\" ==== ADD ====
|
|
|
|
.It Cm add
|
|
|
|
Add a new partition to the partitioning scheme given by
|
|
|
|
.Ar geom .
|
|
|
|
The partition begins on the logical block address given by the
|
|
|
|
.Fl b Ar start
|
|
|
|
option.
|
2010-07-23 11:00:43 +00:00
|
|
|
Its size is given by the
|
2007-05-15 20:25:18 +00:00
|
|
|
.Fl s Ar size
|
2011-06-03 10:39:36 +00:00
|
|
|
option.
|
|
|
|
SI unit suffixes are allowed.
|
|
|
|
One or both
|
2010-07-23 11:00:43 +00:00
|
|
|
.Fl b
|
|
|
|
and
|
|
|
|
.Fl s
|
2011-06-03 10:39:36 +00:00
|
|
|
options can be omitted.
|
|
|
|
If so they are automatically calculated.
|
2007-05-15 20:25:18 +00:00
|
|
|
The type of the partition is given by the
|
|
|
|
.Fl t Ar type
|
|
|
|
option.
|
2009-10-19 15:50:59 +00:00
|
|
|
Partition types are discussed below in the section entitled
|
|
|
|
.Sx "PARTITION TYPES" .
|
2007-05-15 20:25:18 +00:00
|
|
|
.Pp
|
2009-10-19 15:50:59 +00:00
|
|
|
Additional options include:
|
2011-05-03 07:33:39 +00:00
|
|
|
.Bl -tag -width 12n
|
|
|
|
.It Fl a Ar alignment
|
|
|
|
If specified, then
|
|
|
|
.Nm
|
|
|
|
utility tries to align
|
|
|
|
.Ar start
|
|
|
|
offset and partition
|
|
|
|
.Ar size
|
|
|
|
to be multiple of
|
|
|
|
.Ar alignment
|
|
|
|
value.
|
2007-05-15 20:25:18 +00:00
|
|
|
.It Fl i Ar index
|
|
|
|
The index in the partition table at which the new partition is to be
|
2009-10-19 15:50:59 +00:00
|
|
|
placed.
|
|
|
|
The index determines the name of the device special file used
|
2007-05-15 20:25:18 +00:00
|
|
|
to represent the partition.
|
|
|
|
.It Fl l Ar label
|
|
|
|
The label attached to the partition.
|
|
|
|
This option is only valid when used on partitioning schemes that support
|
|
|
|
partition labels.
|
|
|
|
.It Fl f Ar flags
|
|
|
|
Additional operational flags.
|
2009-10-19 15:50:59 +00:00
|
|
|
See the section entitled
|
|
|
|
.Sx "OPERATIONAL FLAGS"
|
|
|
|
below for a discussion
|
2007-05-15 20:25:18 +00:00
|
|
|
about its use.
|
|
|
|
.El
|
2010-11-20 16:03:53 +00:00
|
|
|
.\" ==== BACKUP ====
|
|
|
|
.It Cm backup
|
2011-11-21 00:02:49 +00:00
|
|
|
Dump a partition table to standard output in a special format used by the
|
2010-11-20 16:03:53 +00:00
|
|
|
.Cm restore
|
|
|
|
action.
|
2008-06-06 05:14:16 +00:00
|
|
|
.\" ==== BOOTCODE ====
|
|
|
|
.It Cm bootcode
|
2008-06-07 00:14:06 +00:00
|
|
|
Embed bootstrap code into the partitioning scheme's metadata on the
|
|
|
|
.Ar geom
|
|
|
|
(using
|
|
|
|
.Fl b Ar bootcode )
|
|
|
|
or write bootstrap code into a partition (using
|
|
|
|
.Fl p Ar partcode
|
|
|
|
and
|
|
|
|
.Fl i Ar index ) .
|
|
|
|
Not all partitioning schemes have embedded bootstrap code, so the
|
|
|
|
.Fl b Ar bootcode
|
2011-08-19 10:12:02 +00:00
|
|
|
option is scheme-specific in nature (see the section entitled
|
|
|
|
.Sx BOOTSTRAPPING
|
|
|
|
below).
|
2008-06-06 05:14:16 +00:00
|
|
|
The
|
|
|
|
.Fl b Ar bootcode
|
|
|
|
option specifies a file that contains the bootstrap code.
|
|
|
|
The contents and size of the file are determined by the partitioning
|
|
|
|
scheme.
|
2008-06-07 00:14:06 +00:00
|
|
|
The
|
|
|
|
.Fl p Ar partcode
|
|
|
|
option specifies a file that contains the bootstrap code intended to be
|
|
|
|
written to a partition.
|
|
|
|
The partition is specified by the
|
|
|
|
.Fl i Ar index
|
|
|
|
option.
|
|
|
|
The size of the file must be smaller than the size of the partition.
|
2008-06-18 01:46:32 +00:00
|
|
|
.Pp
|
2009-10-19 15:50:59 +00:00
|
|
|
Additional options include:
|
|
|
|
.Bl -tag -width 10n
|
2008-06-18 01:46:32 +00:00
|
|
|
.It Fl f Ar flags
|
|
|
|
Additional operational flags.
|
2009-10-19 15:50:59 +00:00
|
|
|
See the section entitled
|
|
|
|
.Sx "OPERATIONAL FLAGS"
|
|
|
|
below for a discussion
|
2008-06-18 01:46:32 +00:00
|
|
|
about its use.
|
|
|
|
.El
|
2007-05-15 20:25:18 +00:00
|
|
|
.\" ==== COMMIT ====
|
|
|
|
.It Cm commit
|
|
|
|
Commit any pending changes for geom
|
|
|
|
.Ar geom .
|
2011-11-21 00:02:49 +00:00
|
|
|
All actions are committed by default and will not result in
|
2007-05-15 20:25:18 +00:00
|
|
|
pending changes.
|
|
|
|
Actions can be modified with the
|
|
|
|
.Fl f Ar flags
|
2011-11-21 00:02:49 +00:00
|
|
|
option so that they are not committed, but become pending.
|
2007-05-15 20:25:18 +00:00
|
|
|
Pending changes are reflected by the geom and the
|
|
|
|
.Nm
|
|
|
|
utility, but they are not actually written to disk.
|
|
|
|
The
|
|
|
|
.Cm commit
|
2011-11-21 00:02:49 +00:00
|
|
|
action will write all pending changes to disk.
|
2007-05-15 20:25:18 +00:00
|
|
|
.\" ==== CREATE ====
|
|
|
|
.It Cm create
|
|
|
|
Create a new partitioning scheme on a provider given by
|
|
|
|
.Ar provider .
|
|
|
|
The
|
|
|
|
.Fl s Ar scheme
|
|
|
|
option determines the scheme to use.
|
2011-11-21 00:02:49 +00:00
|
|
|
The kernel must have support for a particular scheme before
|
2007-05-15 20:25:18 +00:00
|
|
|
that scheme can be used to partition a disk.
|
|
|
|
.Pp
|
2009-10-19 15:50:59 +00:00
|
|
|
Additional options include:
|
|
|
|
.Bl -tag -width 10n
|
2007-05-15 20:25:18 +00:00
|
|
|
.It Fl n Ar entries
|
|
|
|
The number of entries in the partition table.
|
2011-11-21 00:02:49 +00:00
|
|
|
Every partitioning scheme has a minimum and maximum number of entries.
|
|
|
|
This option allows tables to be created with a number of entries
|
|
|
|
that is within the limits.
|
2007-05-15 20:25:18 +00:00
|
|
|
Some schemes have a maximum equal to the minimum and some schemes have
|
|
|
|
a maximum large enough to be considered unlimited.
|
|
|
|
By default, partition tables are created with the minimum number of
|
|
|
|
entries.
|
|
|
|
.It Fl f Ar flags
|
|
|
|
Additional operational flags.
|
2009-10-19 15:50:59 +00:00
|
|
|
See the section entitled
|
|
|
|
.Sx "OPERATIONAL FLAGS"
|
|
|
|
below for a discussion
|
2007-05-15 20:25:18 +00:00
|
|
|
about its use.
|
|
|
|
.El
|
|
|
|
.\" ==== DELETE ====
|
|
|
|
.It Cm delete
|
|
|
|
Delete a partition from geom
|
|
|
|
.Ar geom
|
|
|
|
and further identified by the
|
|
|
|
.Fl i Ar index
|
|
|
|
option.
|
|
|
|
The partition cannot be actively used by the kernel.
|
|
|
|
.Pp
|
2009-10-19 15:50:59 +00:00
|
|
|
Additional options include:
|
|
|
|
.Bl -tag -width 10n
|
2007-05-15 20:25:18 +00:00
|
|
|
.It Fl f Ar flags
|
|
|
|
Additional operational flags.
|
2009-10-19 15:50:59 +00:00
|
|
|
See the section entitled
|
|
|
|
.Sx "OPERATIONAL FLAGS"
|
|
|
|
below for a discussion
|
2007-05-15 20:25:18 +00:00
|
|
|
about its use.
|
|
|
|
.El
|
|
|
|
.\" ==== DESTROY ====
|
|
|
|
.It Cm destroy
|
|
|
|
Destroy the partitioning scheme as implemented by geom
|
|
|
|
.Ar geom .
|
|
|
|
.Pp
|
2009-10-19 15:50:59 +00:00
|
|
|
Additional options include:
|
|
|
|
.Bl -tag -width 10n
|
2010-09-24 08:40:43 +00:00
|
|
|
.It Fl F
|
|
|
|
Forced destroying of the partition table even if it is not empty.
|
2007-05-15 20:25:18 +00:00
|
|
|
.It Fl f Ar flags
|
|
|
|
Additional operational flags.
|
2009-10-19 15:50:59 +00:00
|
|
|
See the section entitled
|
|
|
|
.Sx "OPERATIONAL FLAGS"
|
|
|
|
below for a discussion
|
2007-05-15 20:25:18 +00:00
|
|
|
about its use.
|
|
|
|
.El
|
|
|
|
.\" ==== MODIFY ====
|
|
|
|
.It Cm modify
|
|
|
|
Modify a partition from geom
|
|
|
|
.Ar geom
|
|
|
|
and further identified by the
|
|
|
|
.Fl i Ar index
|
|
|
|
option.
|
2011-10-16 14:30:28 +00:00
|
|
|
Only the type and/or label of the partition can be modified.
|
2007-05-15 20:25:18 +00:00
|
|
|
To change the type of a partition, specify the new type with the
|
|
|
|
.Fl t Ar type
|
|
|
|
option.
|
|
|
|
To change the label of a partition, specify the new label with the
|
|
|
|
.Fl l Ar label
|
|
|
|
option.
|
|
|
|
Not all partitioning schemes support labels and it is invalid to
|
|
|
|
try to change a partition label in such cases.
|
|
|
|
.Pp
|
2009-10-19 15:50:59 +00:00
|
|
|
Additional options include:
|
|
|
|
.Bl -tag -width 10n
|
2007-05-15 20:25:18 +00:00
|
|
|
.It Fl f Ar flags
|
|
|
|
Additional operational flags.
|
2009-10-19 15:50:59 +00:00
|
|
|
See the section entitled
|
|
|
|
.Sx "OPERATIONAL FLAGS"
|
|
|
|
below for a discussion
|
2007-05-15 20:25:18 +00:00
|
|
|
about its use.
|
|
|
|
.El
|
2010-10-25 16:23:35 +00:00
|
|
|
.\" ==== RECOVER ====
|
|
|
|
.It Cm recover
|
2011-11-21 00:02:49 +00:00
|
|
|
Recover a corrupt partition's scheme metadata on the geom
|
2010-10-25 16:23:35 +00:00
|
|
|
.Ar geom .
|
|
|
|
See the section entitled
|
2011-06-03 10:39:36 +00:00
|
|
|
.Sx RECOVERING
|
2010-10-25 16:23:35 +00:00
|
|
|
below for the additional information.
|
|
|
|
.Pp
|
|
|
|
Additional options include:
|
|
|
|
.Bl -tag -width 10n
|
|
|
|
.It Fl f Ar flags
|
|
|
|
Additional operational flags.
|
|
|
|
See the section entitled
|
|
|
|
.Sx "OPERATIONAL FLAGS"
|
|
|
|
below for a discussion
|
|
|
|
about its use.
|
|
|
|
.El
|
2010-04-23 03:14:04 +00:00
|
|
|
.\" ==== RESIZE ====
|
|
|
|
.It Cm resize
|
|
|
|
Resize a partition from geom
|
|
|
|
.Ar geom
|
|
|
|
and further identified by the
|
|
|
|
.Fl i Ar index
|
2010-06-03 13:04:56 +00:00
|
|
|
option.
|
|
|
|
New partition size is expressed in logical block
|
|
|
|
numbers and can be given by the
|
2010-04-23 03:14:04 +00:00
|
|
|
.Fl s Ar size
|
2010-06-03 13:04:56 +00:00
|
|
|
option.
|
|
|
|
If
|
2010-04-23 03:14:04 +00:00
|
|
|
.Fl s
|
2010-07-27 17:23:40 +00:00
|
|
|
option is omitted then new size is automatically calculated
|
2010-04-23 03:14:04 +00:00
|
|
|
to maximum available from given geom
|
|
|
|
.Ar geom .
|
|
|
|
.Pp
|
|
|
|
Additional options include:
|
2011-05-03 07:33:39 +00:00
|
|
|
.Bl -tag -width 12n
|
|
|
|
.It Fl a Ar alignment
|
|
|
|
If specified, then
|
|
|
|
.Nm
|
|
|
|
utility tries to align partition
|
|
|
|
.Ar size
|
|
|
|
to be multiple of
|
|
|
|
.Ar alignment
|
|
|
|
value.
|
2010-04-23 03:14:04 +00:00
|
|
|
.It Fl f Ar flags
|
|
|
|
Additional operational flags.
|
|
|
|
See the section entitled
|
|
|
|
.Sx "OPERATIONAL FLAGS"
|
|
|
|
below for a discussion
|
|
|
|
about its use.
|
|
|
|
.El
|
2010-11-20 16:03:53 +00:00
|
|
|
.\" ==== RESTORE ====
|
|
|
|
.It Cm restore
|
2012-01-09 04:27:32 +00:00
|
|
|
Restore the partition table from a backup previously created by the
|
2010-11-20 16:03:53 +00:00
|
|
|
.Cm backup
|
2012-01-09 04:27:32 +00:00
|
|
|
action and read from standard input.
|
|
|
|
Only the partition table is restored.
|
|
|
|
This action does not affect the content of partitions.
|
|
|
|
After restoring the partition table and writing bootcode if needed,
|
|
|
|
user data must be restored from backup.
|
2010-11-20 16:03:53 +00:00
|
|
|
.Pp
|
|
|
|
Additional options include:
|
|
|
|
.Bl -tag -width 10n
|
|
|
|
.It Fl F
|
|
|
|
Destroy partition table on the given
|
|
|
|
.Ar provider
|
|
|
|
before doing restore.
|
2010-11-22 10:08:33 +00:00
|
|
|
.It Fl l
|
|
|
|
Restore partition labels for partitioning schemes that support them.
|
2010-11-20 16:03:53 +00:00
|
|
|
.It Fl f Ar flags
|
|
|
|
Additional operational flags.
|
|
|
|
See the section entitled
|
|
|
|
.Sx "OPERATIONAL FLAGS"
|
|
|
|
below for a discussion
|
|
|
|
about its use.
|
|
|
|
.El
|
2008-06-18 01:46:32 +00:00
|
|
|
.\" ==== SET ====
|
|
|
|
.It Cm set
|
|
|
|
Set the named attribute on the partition entry.
|
2010-09-28 09:07:00 +00:00
|
|
|
See the section entitled
|
2011-06-03 10:39:36 +00:00
|
|
|
.Sx ATTRIBUTES
|
2010-09-28 09:07:00 +00:00
|
|
|
below for a list of available attributes.
|
2008-06-18 01:46:32 +00:00
|
|
|
.Pp
|
2009-10-19 15:50:59 +00:00
|
|
|
Additional options include:
|
|
|
|
.Bl -tag -width 10n
|
2008-06-18 01:46:32 +00:00
|
|
|
.It Fl f Ar flags
|
|
|
|
Additional operational flags.
|
2009-10-19 15:50:59 +00:00
|
|
|
See the section entitled
|
|
|
|
.Sx "OPERATIONAL FLAGS"
|
|
|
|
below for a discussion
|
2008-06-18 01:46:32 +00:00
|
|
|
about its use.
|
|
|
|
.El
|
2007-10-21 00:04:23 +00:00
|
|
|
.\" ==== SHOW ====
|
|
|
|
.It Cm show
|
2013-01-03 21:58:28 +00:00
|
|
|
Show current partition information for the specified geoms, or all
|
|
|
|
geoms if none are specified.
|
|
|
|
The default output includes the logical starting block of each
|
|
|
|
partition, the partition size in blocks, the partition index number,
|
|
|
|
the partition type, and a human readable partition size.
|
|
|
|
Block sizes and locations are based on the device's Sectorsize
|
|
|
|
as shown by
|
|
|
|
.Cm gpart list .
|
2010-11-22 10:08:33 +00:00
|
|
|
Additional options include:
|
|
|
|
.Bl -tag -width 10n
|
|
|
|
.It Fl l
|
2011-11-21 00:02:49 +00:00
|
|
|
For partitioning schemes that support partition labels, print them
|
2010-11-22 10:08:33 +00:00
|
|
|
instead of partition type.
|
2011-03-08 21:36:42 +00:00
|
|
|
.It Fl p
|
|
|
|
Show provider names instead of partition indexes.
|
2010-11-22 10:08:33 +00:00
|
|
|
.It Fl r
|
|
|
|
Show raw partition type instead of symbolic name.
|
|
|
|
.El
|
2007-05-15 20:25:18 +00:00
|
|
|
.\" ==== UNDO ====
|
|
|
|
.It Cm undo
|
2009-10-19 15:50:59 +00:00
|
|
|
Revert any pending changes for geom
|
|
|
|
.Ar geom .
|
2007-05-15 20:25:18 +00:00
|
|
|
This action is the opposite of the
|
|
|
|
.Cm commit
|
|
|
|
action and can be used to undo any changes that have not been committed.
|
2008-06-18 01:46:32 +00:00
|
|
|
.\" ==== UNSET ====
|
|
|
|
.It Cm unset
|
|
|
|
Clear the named attribute on the partition entry.
|
2010-09-28 09:07:00 +00:00
|
|
|
See the section entitled
|
2011-06-03 10:39:36 +00:00
|
|
|
.Sx ATTRIBUTES
|
2010-09-28 09:07:00 +00:00
|
|
|
below for a list of available attributes.
|
2008-06-18 01:46:32 +00:00
|
|
|
.Pp
|
2009-10-19 15:50:59 +00:00
|
|
|
Additional options include:
|
|
|
|
.Bl -tag -width 10n
|
2008-06-18 01:46:32 +00:00
|
|
|
.It Fl f Ar flags
|
|
|
|
Additional operational flags.
|
2009-10-19 15:50:59 +00:00
|
|
|
See the section entitled
|
|
|
|
.Sx "OPERATIONAL FLAGS"
|
|
|
|
below for a discussion
|
2008-06-18 01:46:32 +00:00
|
|
|
about its use.
|
|
|
|
.El
|
2014-08-03 21:54:22 +00:00
|
|
|
.It Cm list
|
|
|
|
See
|
|
|
|
.Xr geom 8 .
|
|
|
|
.It Cm status
|
|
|
|
See
|
|
|
|
.Xr geom 8 .
|
|
|
|
.It Cm load
|
|
|
|
See
|
|
|
|
.Xr geom 8 .
|
|
|
|
.It Cm unload
|
|
|
|
See
|
|
|
|
.Xr geom 8 .
|
2007-05-15 20:25:18 +00:00
|
|
|
.El
|
2011-11-21 00:02:49 +00:00
|
|
|
.Sh PARTITIONING SCHEMES
|
|
|
|
Several partitioning schemes are supported by the
|
|
|
|
.Nm
|
|
|
|
utility:
|
|
|
|
.Bl -tag -width ".Cm VTOC8"
|
|
|
|
.It Cm APM
|
|
|
|
Apple Partition Map, used by PowerPC(R) Macintosh(R) computers.
|
|
|
|
Requires the
|
|
|
|
.Cd GEOM_PART_APM
|
|
|
|
kernel option.
|
|
|
|
.It Cm BSD
|
2011-11-21 18:04:37 +00:00
|
|
|
Traditional BSD disklabel, usually used to subdivide MBR partitions.
|
2011-11-21 00:02:49 +00:00
|
|
|
.Po
|
2011-11-21 18:04:37 +00:00
|
|
|
This scheme can also be used as the sole partitioning method, without
|
|
|
|
an MBR.
|
2012-01-09 05:51:33 +00:00
|
|
|
Partition editing tools from other operating systems often do not
|
|
|
|
understand the bare disklabel partition layout, so this is sometimes
|
2011-11-21 18:04:37 +00:00
|
|
|
called
|
|
|
|
.Dq dangerously dedicated .
|
2011-11-21 00:02:49 +00:00
|
|
|
.Pc
|
|
|
|
Requires the
|
|
|
|
.Cm GEOM_PART_BSD
|
|
|
|
kernel option.
|
2014-06-11 10:42:34 +00:00
|
|
|
.It Cm BSD64
|
|
|
|
64-bit implementation of BSD disklabel used in DragonFlyBSD to subdivide MBR
|
|
|
|
or GPT partitions.
|
|
|
|
Requires the
|
|
|
|
.Cm GEOM_PART_BSD64
|
|
|
|
kernel option.
|
2012-03-19 13:17:47 +00:00
|
|
|
.It Cm LDM
|
|
|
|
The Logical Disk Manager is an implementation of volume manager for
|
|
|
|
Microsoft Windows NT.
|
|
|
|
Requires the
|
|
|
|
.Cd GEOM_PART_LDM
|
|
|
|
kernel option.
|
2011-11-21 00:02:49 +00:00
|
|
|
.It Cm GPT
|
|
|
|
GUID Partition Table is used on Intel-based Macintosh computers and
|
|
|
|
gradually replacing MBR on most PCs and other systems.
|
|
|
|
Requires the
|
|
|
|
.Cm GEOM_PART_GPT
|
|
|
|
kernel option.
|
|
|
|
.It Cm MBR
|
|
|
|
Master Boot Record is used on PCs and removable media.
|
|
|
|
Requires the
|
|
|
|
.Cm GEOM_PART_MBR
|
|
|
|
kernel option.
|
|
|
|
The
|
|
|
|
.Cm GEOM_PART_EBR
|
|
|
|
option adds support for the Extended Boot Record (EBR),
|
|
|
|
which is used to define a logical partition.
|
|
|
|
The
|
|
|
|
.Cm GEOM_PART_EBR_COMPAT
|
|
|
|
option enables backward compatibility for partition names
|
|
|
|
in the EBR scheme.
|
|
|
|
It also prevents any type of actions on such partitions.
|
|
|
|
.It Cm VTOC8
|
|
|
|
Sun's SMI Volume Table Of Contents, used by
|
|
|
|
.Tn SPARC64
|
|
|
|
and
|
|
|
|
.Tn UltraSPARC
|
|
|
|
computers.
|
|
|
|
Requires the
|
|
|
|
.Cm GEOM_PART_VTOC8
|
|
|
|
kernel option.
|
|
|
|
.El
|
2007-05-15 20:25:18 +00:00
|
|
|
.Sh PARTITION TYPES
|
2011-06-06 21:02:26 +00:00
|
|
|
Partition types are identified on disk by particular strings or magic
|
|
|
|
values.
|
2007-05-15 20:25:18 +00:00
|
|
|
The
|
|
|
|
.Nm
|
2011-11-21 00:02:49 +00:00
|
|
|
utility uses symbolic names for common partition types so the user
|
|
|
|
does not need to know these values or other details of the partitioning
|
2011-06-06 21:02:26 +00:00
|
|
|
scheme in question.
|
2009-10-19 15:50:59 +00:00
|
|
|
The
|
2007-05-15 20:25:18 +00:00
|
|
|
.Nm
|
|
|
|
utility also allows the user to specify scheme-specific partition types
|
2011-06-06 21:02:26 +00:00
|
|
|
for partition types that do not have symbolic names.
|
2014-07-01 12:44:47 +00:00
|
|
|
Symbolic names currently understood and used by
|
2014-07-08 14:53:51 +00:00
|
|
|
.Fx
|
|
|
|
are:
|
2014-07-01 12:44:47 +00:00
|
|
|
.Bl -tag -width ".Cm dragonfly-disklabel64"
|
2014-07-04 15:55:32 +00:00
|
|
|
.It Cm apple-boot
|
|
|
|
The system partition dedicated to storing boot loaders on some Apple
|
|
|
|
systems.
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!171"
|
|
|
|
for MBR,
|
|
|
|
.Qq Li "!Apple_Bootstrap"
|
|
|
|
for APM, and
|
|
|
|
.Qq Li "!426f6f74-0000-11aa-aa11-00306543ecac"
|
|
|
|
for GPT.
|
2011-01-28 11:56:14 +00:00
|
|
|
.It Cm bios-boot
|
|
|
|
The system partition dedicated to second stage of the boot loader program.
|
2011-11-21 00:02:49 +00:00
|
|
|
Usually it is used by the GRUB 2 loader for GPT partitioning schemes.
|
2011-01-28 11:56:14 +00:00
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!21686148-6449-6E6F-744E-656564454649" .
|
2009-10-19 15:50:59 +00:00
|
|
|
.It Cm efi
|
2007-05-15 20:25:18 +00:00
|
|
|
The system partition for computers that use the Extensible Firmware
|
|
|
|
Interface (EFI).
|
2011-11-21 00:02:49 +00:00
|
|
|
In such cases, the GPT partitioning scheme is used and the
|
2007-05-15 20:25:18 +00:00
|
|
|
actual partition type for the system partition can also be specified as
|
2013-02-27 03:43:16 +00:00
|
|
|
.Qq Li "!c12a7328-f81f-11d2-ba4b-00a0c93ec93b" .
|
2009-10-19 15:50:59 +00:00
|
|
|
.It Cm freebsd
|
|
|
|
A
|
|
|
|
.Fx
|
2011-11-21 00:02:49 +00:00
|
|
|
partition subdivided into filesystems with a
|
2009-10-19 15:50:59 +00:00
|
|
|
.Bx
|
2011-11-21 00:02:49 +00:00
|
|
|
disklabel.
|
2007-05-15 20:25:18 +00:00
|
|
|
This is a legacy partition type and should not be used for the APM
|
|
|
|
or GPT schemes.
|
2009-10-19 15:50:59 +00:00
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!165"
|
|
|
|
for MBR,
|
|
|
|
.Qq Li "!FreeBSD"
|
|
|
|
for APM, and
|
|
|
|
.Qq Li "!516e7cb4-6ecf-11d6-8ff8-00022d09712b"
|
|
|
|
for GPT.
|
|
|
|
.It Cm freebsd-boot
|
|
|
|
A
|
|
|
|
.Fx
|
|
|
|
partition dedicated to bootstrap code.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!83bd6b9d-7f41-11dc-be0b-001560b84f0f"
|
|
|
|
for GPT.
|
|
|
|
.It Cm freebsd-swap
|
|
|
|
A
|
|
|
|
.Fx
|
|
|
|
partition dedicated to swap space.
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!FreeBSD-swap"
|
2010-06-03 13:04:56 +00:00
|
|
|
for APM,
|
2009-10-19 15:50:59 +00:00
|
|
|
.Qq Li "!516e7cb5-6ecf-11d6-8ff8-00022d09712b"
|
2010-06-03 13:04:56 +00:00
|
|
|
for GPT, and tag 0x0901 for VTOC8.
|
2009-10-19 15:50:59 +00:00
|
|
|
.It Cm freebsd-ufs
|
|
|
|
A
|
|
|
|
.Fx
|
2011-11-21 00:02:49 +00:00
|
|
|
partition that contains a UFS or UFS2 filesystem.
|
2009-10-19 15:50:59 +00:00
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!FreeBSD-UFS"
|
2010-06-03 13:04:56 +00:00
|
|
|
for APM,
|
2009-10-19 15:50:59 +00:00
|
|
|
.Qq Li "!516e7cb6-6ecf-11d6-8ff8-00022d09712b"
|
2010-06-03 13:04:56 +00:00
|
|
|
for GPT, and tag 0x0902 for VTOC8.
|
2009-10-19 15:50:59 +00:00
|
|
|
.It Cm freebsd-vinum
|
|
|
|
A
|
|
|
|
.Fx
|
|
|
|
partition that contains a Vinum volume.
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!FreeBSD-Vinum"
|
2010-06-03 13:04:56 +00:00
|
|
|
for APM,
|
2009-10-19 15:50:59 +00:00
|
|
|
.Qq Li "!516e7cb8-6ecf-11d6-8ff8-00022d09712b"
|
2010-06-03 13:04:56 +00:00
|
|
|
for GPT, and tag 0x0903 for VTOC8.
|
2009-10-19 15:50:59 +00:00
|
|
|
.It Cm freebsd-zfs
|
|
|
|
A
|
|
|
|
.Fx
|
|
|
|
partition that contains a ZFS volume.
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!FreeBSD-ZFS"
|
2010-06-03 13:04:56 +00:00
|
|
|
for APM,
|
2009-10-19 15:50:59 +00:00
|
|
|
.Qq Li "!516e7cba-6ecf-11d6-8ff8-00022d09712b"
|
2010-06-03 13:04:56 +00:00
|
|
|
for GPT, and 0x0904 for VTOC8.
|
2014-07-01 12:44:47 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Another symbolic names that can be used with
|
|
|
|
.Cm gpart
|
|
|
|
utility are:
|
|
|
|
.Bl -tag -width ".Cm dragonfly-disklabel64"
|
2015-03-12 18:51:31 +00:00
|
|
|
.It Cm apple-core-storage
|
|
|
|
An Apple Mac OS X partition used by logical volume manager known as
|
|
|
|
Core Storage.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!53746f72-6167-11aa-aa11-00306543ecac"
|
|
|
|
for GPT.
|
2014-07-01 12:44:47 +00:00
|
|
|
.It Cm apple-hfs
|
|
|
|
An Apple Mac OS X partition that contains a HFS or HFS+ filesystem.
|
|
|
|
The scheme-specific types are
|
2015-05-05 09:33:02 +00:00
|
|
|
.Qq Li "!175"
|
|
|
|
for MBR,
|
2014-07-01 12:44:47 +00:00
|
|
|
.Qq Li "!Apple_HFS"
|
|
|
|
for APM and
|
|
|
|
.Qq Li "!48465300-0000-11aa-aa11-00306543ecac"
|
|
|
|
for GPT.
|
|
|
|
.It Cm apple-label
|
|
|
|
An Apple Mac OS X partition dedicated to partition metadata that descibes
|
|
|
|
disk device.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!4c616265-6c00-11aa-aa11-00306543ecac"
|
|
|
|
for GPT.
|
|
|
|
.It Cm apple-raid
|
|
|
|
An Apple Mac OS X partition used in a software RAID configuration.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!52414944-0000-11aa-aa11-00306543ecac"
|
|
|
|
for GPT.
|
|
|
|
.It Cm apple-raid-offline
|
|
|
|
An Apple Mac OS X partition used in a software RAID configuration.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!52414944-5f4f-11aa-aa11-00306543ecac"
|
|
|
|
for GPT.
|
|
|
|
.It Cm apple-tv-recovery
|
|
|
|
An Apple Mac OS X partition used by Apple TV.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!5265636f-7665-11aa-aa11-00306543ecac"
|
|
|
|
for GPT.
|
|
|
|
.It Cm apple-ufs
|
|
|
|
An Apple Mac OS X partition that contains a UFS filesystem.
|
|
|
|
The scheme-specific types are
|
2015-05-05 09:33:02 +00:00
|
|
|
.Qq Li "!168"
|
|
|
|
for MBR,
|
2014-07-01 12:44:47 +00:00
|
|
|
.Qq Li "!Apple_UNIX_SVR2"
|
|
|
|
for APM and
|
|
|
|
.Qq Li "!55465300-0000-11aa-aa11-00306543ecac"
|
|
|
|
for GPT.
|
|
|
|
.It Cm dragonfly-label32
|
|
|
|
A DragonFlyBSD partition subdivided into filesystems with a
|
|
|
|
.Bx
|
|
|
|
disklabel.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!9d087404-1ca5-11dc-8817-01301bb8a9f5"
|
|
|
|
for GPT.
|
|
|
|
.It Cm dragonfly-label64
|
|
|
|
A DragonFlyBSD partition subdivided into filesystems with a
|
|
|
|
disklabel64.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!3d48ce54-1d16-11dc-8696-01301bb8a9f5"
|
|
|
|
for GPT.
|
|
|
|
.It Cm dragonfly-legacy
|
|
|
|
A legacy partition type used in DragonFlyBSD.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!bd215ab2-1d16-11dc-8696-01301bb8a9f5"
|
|
|
|
for GPT.
|
|
|
|
.It Cm dragonfly-ccd
|
|
|
|
A DragonFlyBSD partition used with Concatenated Disk driver.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!dbd5211b-1ca5-11dc-8817-01301bb8a9f5"
|
|
|
|
for GPT.
|
|
|
|
.It Cm dragonfly-hammer
|
|
|
|
A DragonFlyBSD partition that contains a Hammer filesystem.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!61dc63ac-6e38-11dc-8513-01301bb8a9f5"
|
|
|
|
for GPT.
|
|
|
|
.It Cm dragonfly-hammer2
|
|
|
|
A DragonFlyBSD partition that contains a Hammer2 filesystem.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!5cbb9ad1-862d-11dc-a94d-01301bb8a9f5"
|
|
|
|
for GPT.
|
|
|
|
.It Cm dragonfly-swap
|
|
|
|
A DragonFlyBSD partition dedicated to swap space.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!9d58fdbd-1ca5-11dc-8817-01301bb8a9f5"
|
|
|
|
for GPT.
|
|
|
|
.It Cm dragonfly-ufs
|
|
|
|
A DragonFlyBSD partition that contains an UFS1 filesystem.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!9d94ce7c-1ca5-11dc-8817-01301bb8a9f5"
|
|
|
|
for GPT.
|
|
|
|
.It Cm dragonfly-vinum
|
|
|
|
A DragonFlyBSD partition used with Logical Volume Manager.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!9dd4478f-1ca5-11dc-8817-01301bb8a9f5"
|
|
|
|
for GPT.
|
|
|
|
.It Cm ebr
|
|
|
|
A partition subdivided into filesystems with a EBR.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!5"
|
|
|
|
for MBR.
|
|
|
|
.It Cm fat16
|
|
|
|
A partition that contains a FAT16 filesystem.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!6"
|
|
|
|
for MBR.
|
|
|
|
.It Cm fat32
|
|
|
|
A partition that contains a FAT32 filesystem.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!11"
|
|
|
|
for MBR.
|
|
|
|
.It Cm linux-data
|
|
|
|
A Linux partition that contains some filesystem with data.
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!131"
|
|
|
|
for MBR and
|
|
|
|
.Qq Li "!0fc63daf-8483-4772-8e79-3d69d8477de4"
|
|
|
|
for GPT.
|
|
|
|
.It Cm linux-lvm
|
|
|
|
A Linux partition dedicated to Logical Volume Manager.
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!142"
|
|
|
|
for MBR and
|
|
|
|
.Qq Li "!e6d6d379-f507-44c2-a23c-238f2a3df928"
|
|
|
|
for GPT.
|
|
|
|
.It Cm linux-raid
|
|
|
|
A Linux partition used in a software RAID configuration.
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!253"
|
|
|
|
for MBR and
|
|
|
|
.Qq Li "!a19d880f-05fc-4d3b-a006-743f0f84911e"
|
|
|
|
for GPT.
|
|
|
|
.It Cm linux-swap
|
|
|
|
A Linux partition dedicated to swap space.
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!130"
|
|
|
|
for MBR and
|
|
|
|
.Qq Li "!0657fd6d-a4ab-43c4-84e5-0933c84b4f4f"
|
|
|
|
for GPT.
|
2009-10-19 15:50:59 +00:00
|
|
|
.It Cm mbr
|
2011-11-21 00:02:49 +00:00
|
|
|
A partition that is sub-partitioned by a Master Boot Record (MBR).
|
2009-10-19 15:50:59 +00:00
|
|
|
This type is known as
|
|
|
|
.Qq Li "!024dee41-33e7-11d3-9d69-0008c781f39f"
|
|
|
|
by GPT.
|
2014-04-02 11:12:48 +00:00
|
|
|
.It Cm ms-basic-data
|
|
|
|
A basic data partition (BDP) for Microsoft operating systems.
|
|
|
|
In the GPT this type is the equivalent to partition types
|
|
|
|
.Cm fat16 , fat32
|
|
|
|
and
|
|
|
|
.Cm ntfs
|
|
|
|
in MBR.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!ebd0a0a2-b9e5-4433-87c0-68b6b72699c7"
|
|
|
|
for GPT.
|
2012-03-19 13:17:47 +00:00
|
|
|
.It Cm ms-ldm-data
|
|
|
|
A partition that contains Logical Disk Manager (LDM) volumes.
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!66"
|
|
|
|
for MBR,
|
|
|
|
.Qq Li "!af9b60a0-1431-4f62-bc68-3311714a69ad"
|
|
|
|
for GPT.
|
|
|
|
.It Cm ms-ldm-metadata
|
|
|
|
A partition that contains Logical Disk Manager (LDM) database.
|
2012-05-24 02:24:03 +00:00
|
|
|
The scheme-specific type is
|
2012-03-19 13:17:47 +00:00
|
|
|
.Qq Li "!5808c8aa-7e8f-42e0-85d2-e1e90434cfb3"
|
|
|
|
for GPT.
|
2014-07-01 12:44:47 +00:00
|
|
|
.It Cm netbsd-ccd
|
|
|
|
A NetBSD partition used with Concatenated Disk driver.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!2db519c4-b10f-11dc-b99b-0019d1879648"
|
|
|
|
for GPT.
|
|
|
|
.It Cm netbsd-cgd
|
|
|
|
An encrypted NetBSD partition.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!2db519ec-b10f-11dc-b99b-0019d1879648"
|
|
|
|
for GPT.
|
|
|
|
.It Cm netbsd-ffs
|
|
|
|
A NetBSD partition that contains an UFS filesystem.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!49f48d5a-b10e-11dc-b99b-0019d1879648"
|
|
|
|
for GPT.
|
|
|
|
.It Cm netbsd-lfs
|
|
|
|
A NetBSD partition that contains an LFS filesystem.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!49f48d82-b10e-11dc-b99b-0019d1879648"
|
|
|
|
for GPT.
|
|
|
|
.It Cm netbsd-raid
|
|
|
|
A NetBSD partition used in a software RAID configuration.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!49f48daa-b10e-11dc-b99b-0019d1879648"
|
|
|
|
for GPT.
|
|
|
|
.It Cm netbsd-swap
|
|
|
|
A NetBSD partition dedicated to swap space.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!49f48d32-b10e-11dc-b99b-0019d1879648"
|
|
|
|
for GPT.
|
2014-04-02 11:12:48 +00:00
|
|
|
.It Cm ntfs
|
|
|
|
A partition that contains a NTFS or exFAT filesystem.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!7"
|
|
|
|
for MBR.
|
2014-07-04 15:55:32 +00:00
|
|
|
.It Cm prep-boot
|
|
|
|
The system partition dedicated to storing boot loaders on some PowerPC systems,
|
|
|
|
notably those made by IBM.
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!65"
|
|
|
|
for MBR and
|
|
|
|
.Qq Li "!0x9e1a2d38-c612-4316-aa26-8b49521e5a8b"
|
|
|
|
for GPT.
|
2014-05-21 05:27:57 +00:00
|
|
|
.It Cm vmware-vmfs
|
|
|
|
A partition that contains a VMware File System (VMFS).
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!251"
|
|
|
|
for MBR and
|
|
|
|
.Qq Li "!aa31e02a-400f-11db-9590-000c2911d1b8"
|
|
|
|
for GPT.
|
|
|
|
.It Cm vmware-vmkdiag
|
|
|
|
A partition that contains a VMware diagostic filesystem.
|
|
|
|
The scheme-specific types are
|
|
|
|
.Qq Li "!252"
|
|
|
|
for MBR and
|
|
|
|
.Qq Li "!9d275380-40ad-11db-bf97-000c2911d1b8"
|
|
|
|
for GPT.
|
|
|
|
.It Cm vmware-reserved
|
|
|
|
A VMware reserved partition.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!9198effc-31c0-11db-8f-78-000c2911d1b8"
|
|
|
|
for GPT.
|
|
|
|
.It Cm vmware-vsanhdr
|
|
|
|
A partition claimed by VMware VSAN.
|
|
|
|
The scheme-specific type is
|
|
|
|
.Qq Li "!381cfccc-7288-11e0-92ee-000c2911d0b2"
|
|
|
|
for GPT.
|
2007-05-15 20:25:18 +00:00
|
|
|
.El
|
2010-09-28 09:07:00 +00:00
|
|
|
.Sh ATTRIBUTES
|
|
|
|
The scheme-specific attributes for EBR:
|
2011-06-03 10:39:36 +00:00
|
|
|
.Bl -tag -width ".Cm active"
|
|
|
|
.It Cm active
|
2010-09-28 09:07:00 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The scheme-specific attributes for GPT:
|
2011-06-03 10:39:36 +00:00
|
|
|
.Bl -tag -width ".Cm bootfailed"
|
|
|
|
.It Cm bootme
|
2010-09-28 09:07:00 +00:00
|
|
|
When set, the
|
|
|
|
.Nm gptboot
|
|
|
|
stage 1 boot loader will try to boot the system from this partition.
|
2013-07-01 22:38:36 +00:00
|
|
|
Multiple partitions can be marked with the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootme
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute.
|
2013-07-01 22:38:36 +00:00
|
|
|
See
|
|
|
|
.Xr gptboot 8
|
|
|
|
for more details.
|
2011-06-03 10:39:36 +00:00
|
|
|
.It Cm bootonce
|
2010-09-28 09:07:00 +00:00
|
|
|
Setting this attribute automatically sets the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootme
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute.
|
|
|
|
When set, the
|
|
|
|
.Nm gptboot
|
|
|
|
stage 1 boot loader will try to boot the system from this partition only once.
|
2013-07-01 22:38:36 +00:00
|
|
|
Multiple partitions can be marked with the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootonce
|
2010-09-28 09:07:00 +00:00
|
|
|
and
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootme
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute pairs.
|
2013-07-01 22:38:36 +00:00
|
|
|
See
|
|
|
|
.Xr gptboot 8
|
|
|
|
for more details.
|
2011-06-03 10:39:36 +00:00
|
|
|
.It Cm bootfailed
|
2010-09-28 09:07:00 +00:00
|
|
|
This attribute should not be manually managed.
|
|
|
|
It is managed by the
|
|
|
|
.Nm gptboot
|
|
|
|
stage 1 boot loader and the
|
|
|
|
.Pa /etc/rc.d/gptboot
|
|
|
|
start-up script.
|
2013-07-01 22:38:36 +00:00
|
|
|
See
|
|
|
|
.Xr gptboot 8
|
|
|
|
for more details.
|
2015-07-15 02:23:55 +00:00
|
|
|
.It Cm lenovofix
|
|
|
|
Setting this attribute overwrites the Protective MBR with a new one where
|
|
|
|
the 0xee partition is the second, rather than the first record.
|
|
|
|
This resolves a BIOS compatibility issue with some Lenovo models including the
|
|
|
|
X220, T420, and T520, allowing them to boot from GPT partitioned disks
|
|
|
|
without using EFI.
|
2010-09-28 09:07:00 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The scheme-specific attributes for MBR:
|
2011-06-03 10:39:36 +00:00
|
|
|
.Bl -tag -width ".Cm active"
|
|
|
|
.It Cm active
|
2010-09-28 09:07:00 +00:00
|
|
|
.El
|
2011-08-19 10:12:02 +00:00
|
|
|
.Sh BOOTSTRAPPING
|
2011-08-20 08:20:10 +00:00
|
|
|
.Fx
|
|
|
|
supports several partitioning schemes and each scheme uses different
|
2011-08-19 10:12:02 +00:00
|
|
|
bootstrap code.
|
2011-11-21 00:02:49 +00:00
|
|
|
The bootstrap code is located in a specific disk area for each partitioning
|
|
|
|
scheme, and may vary in size for different schemes.
|
2011-08-19 10:12:02 +00:00
|
|
|
.Pp
|
2011-11-21 00:02:49 +00:00
|
|
|
Bootstrap code can be separated into two types.
|
|
|
|
The first type is embedded in the partitioning scheme's metadata, while the
|
|
|
|
second type is located on a specific partition.
|
|
|
|
Embedding bootstrap code should only be done with the
|
2011-08-19 10:12:02 +00:00
|
|
|
.Cm gpart bootcode
|
2011-11-21 00:02:49 +00:00
|
|
|
command with the
|
2011-08-19 10:12:02 +00:00
|
|
|
.Fl b Ar bootcode
|
|
|
|
option.
|
2011-11-21 00:02:49 +00:00
|
|
|
The GEOM PART class knows how to safely embed bootstrap code into
|
|
|
|
specific partitioning scheme metadata without causing any damage.
|
2011-08-19 10:12:02 +00:00
|
|
|
.Pp
|
2011-11-21 00:02:49 +00:00
|
|
|
The Master Boot Record (MBR) uses a 512-byte bootstrap code image, embedded
|
|
|
|
into the partition table's metadata area.
|
2011-08-19 10:12:02 +00:00
|
|
|
There are two variants of this bootstrap code:
|
|
|
|
.Pa /boot/mbr
|
|
|
|
and
|
|
|
|
.Pa /boot/boot0 .
|
2011-11-21 00:02:49 +00:00
|
|
|
.Pa /boot/mbr
|
|
|
|
searches for a partition with the
|
2011-08-19 10:12:02 +00:00
|
|
|
.Cm active
|
|
|
|
attribute (see the
|
|
|
|
.Sx ATTRIBUTES
|
|
|
|
section) in the partition table.
|
|
|
|
Then it runs next bootstrap stage.
|
|
|
|
The
|
|
|
|
.Pa /boot/boot0
|
2011-11-21 00:02:49 +00:00
|
|
|
image contains a boot manager with some additional interactive functions
|
|
|
|
for multi-booting from a user-selected partition.
|
2011-08-19 10:12:02 +00:00
|
|
|
.Pp
|
2011-11-21 00:02:49 +00:00
|
|
|
A BSD disklabel is usually created inside an MBR partition (slice)
|
2011-08-19 10:12:02 +00:00
|
|
|
with type
|
|
|
|
.Cm freebsd
|
|
|
|
(see the
|
|
|
|
.Sx "PARTITION TYPES"
|
|
|
|
section).
|
|
|
|
It uses 8 KB size bootstrap code image
|
|
|
|
.Pa /boot/boot ,
|
2011-11-21 00:02:49 +00:00
|
|
|
embedded into the partition table's metadata area.
|
2011-08-19 10:12:02 +00:00
|
|
|
.Pp
|
|
|
|
Both types of bootstrap code are used to boot from the GUID Partition Table.
|
2011-11-21 00:02:49 +00:00
|
|
|
First, a protective MBR is embedded into the first disk sector from the
|
2011-08-19 10:12:02 +00:00
|
|
|
.Pa /boot/pmbr
|
|
|
|
image.
|
2013-01-25 16:33:00 +00:00
|
|
|
It searches through the GPT for a
|
2011-08-19 10:12:02 +00:00
|
|
|
.Cm freebsd-boot
|
|
|
|
partition (see the
|
|
|
|
.Sx "PARTITION TYPES"
|
2013-01-25 16:33:00 +00:00
|
|
|
section) and runs the next bootstrap stage from it.
|
2011-08-19 10:12:02 +00:00
|
|
|
The
|
|
|
|
.Cm freebsd-boot
|
|
|
|
partition should be smaller than 545 KB.
|
2013-01-25 16:33:00 +00:00
|
|
|
It can be located either before or after other
|
|
|
|
.Fx
|
|
|
|
partitions on the disk.
|
2011-08-19 10:12:02 +00:00
|
|
|
There are two variants of bootstrap code to write to this partition:
|
|
|
|
.Pa /boot/gptboot
|
|
|
|
and
|
|
|
|
.Pa /boot/gptzfsboot .
|
2013-07-01 22:38:36 +00:00
|
|
|
.Pp
|
2011-11-21 00:02:49 +00:00
|
|
|
.Pa /boot/gptboot
|
2013-07-01 22:38:36 +00:00
|
|
|
is used to boot from UFS partitions.
|
|
|
|
.Cm gptboot
|
|
|
|
searches through
|
2013-01-25 16:33:00 +00:00
|
|
|
.Cm freebsd-ufs
|
2013-07-01 22:38:36 +00:00
|
|
|
partitions in the GPT and selects one to boot based on the
|
2013-01-25 16:33:00 +00:00
|
|
|
.Cm bootonce
|
2013-07-01 22:38:36 +00:00
|
|
|
and
|
2013-01-25 16:33:00 +00:00
|
|
|
.Cm bootme
|
2013-07-01 22:38:36 +00:00
|
|
|
attributes.
|
2013-01-25 16:33:00 +00:00
|
|
|
If neither attribute is found,
|
|
|
|
.Pa /boot/gptboot
|
|
|
|
boots from the first
|
|
|
|
.Cm freebsd-ufs
|
|
|
|
partition.
|
2011-11-21 00:02:49 +00:00
|
|
|
.Pa /boot/loader
|
|
|
|
.Pq the third bootstrap stage
|
2013-01-25 16:33:00 +00:00
|
|
|
is loaded from the first partition that matches these conditions.
|
2013-07-01 22:38:36 +00:00
|
|
|
See
|
|
|
|
.Xr gptboot 8
|
|
|
|
for more information.
|
|
|
|
.Pp
|
2011-08-19 10:12:02 +00:00
|
|
|
.Pa /boot/gptzfsboot
|
|
|
|
is used to boot from ZFS.
|
2013-01-25 16:33:00 +00:00
|
|
|
It searches through the GPT for
|
2011-08-19 10:12:02 +00:00
|
|
|
.Cm freebsd-zfs
|
2013-01-25 16:33:00 +00:00
|
|
|
partitions, trying to detect ZFS pools.
|
|
|
|
After all pools are detected,
|
2011-08-19 10:12:02 +00:00
|
|
|
.Pa /boot/zfsloader
|
2013-01-25 16:33:00 +00:00
|
|
|
is started from the first one found.
|
2011-08-19 10:12:02 +00:00
|
|
|
.Pp
|
|
|
|
The VTOC8 scheme does not support embedding bootstrap code.
|
|
|
|
Instead, the 8 KBytes bootstrap code image
|
|
|
|
.Pa /boot/boot1
|
2011-11-21 00:02:49 +00:00
|
|
|
should be written with the
|
2011-08-19 10:12:02 +00:00
|
|
|
.Cm gpart bootcode
|
2011-11-21 00:02:49 +00:00
|
|
|
command with the
|
2011-08-19 10:12:02 +00:00
|
|
|
.Fl p Ar bootcode
|
|
|
|
option to all sufficiently large VTOC8 partitions.
|
|
|
|
To do this the
|
|
|
|
.Fl i Ar index
|
2011-11-21 00:02:49 +00:00
|
|
|
option could be omitted.
|
2011-08-20 08:20:10 +00:00
|
|
|
.Pp
|
|
|
|
The APM scheme also does not support embedding bootstrap code.
|
|
|
|
Instead, the 800 KBytes bootstrap code image
|
|
|
|
.Pa /boot/boot1.hfs
|
2011-11-21 00:02:49 +00:00
|
|
|
should be written with the
|
2011-08-20 08:20:10 +00:00
|
|
|
.Cm gpart bootcode
|
|
|
|
command to a partition of type
|
2014-07-04 15:55:32 +00:00
|
|
|
.Cm apple-boot ,
|
2011-08-20 08:20:10 +00:00
|
|
|
which should also be 800 KB in size.
|
2007-05-15 20:25:18 +00:00
|
|
|
.Sh OPERATIONAL FLAGS
|
|
|
|
Actions other than the
|
|
|
|
.Cm commit
|
|
|
|
and
|
|
|
|
.Cm undo
|
|
|
|
actions take an optional
|
|
|
|
.Fl f Ar flags
|
|
|
|
option.
|
|
|
|
This option is used to specify action-specific operational flags.
|
|
|
|
By default, the
|
|
|
|
.Nm
|
2009-10-19 15:50:59 +00:00
|
|
|
utility defines the
|
|
|
|
.Ql C
|
|
|
|
flag so that the action is immediately
|
2007-05-15 20:25:18 +00:00
|
|
|
committed.
|
|
|
|
The user can specify
|
2009-10-19 15:50:59 +00:00
|
|
|
.Dq Fl f Cm x
|
2007-05-15 20:25:18 +00:00
|
|
|
to have the action result in a pending change that can later, with
|
|
|
|
other pending changes, be committed as a single compound change with
|
|
|
|
the
|
|
|
|
.Cm commit
|
|
|
|
action or reverted with the
|
|
|
|
.Cm undo
|
|
|
|
action.
|
2010-10-25 16:23:35 +00:00
|
|
|
.Sh RECOVERING
|
2011-06-06 21:02:26 +00:00
|
|
|
The GEOM PART class supports recovering of partition tables only for GPT.
|
2011-11-21 18:04:37 +00:00
|
|
|
The GPT primary metadata is stored at the beginning of the device.
|
2011-11-21 00:02:49 +00:00
|
|
|
For redundancy, a secondary
|
|
|
|
.Pq backup
|
|
|
|
copy of the metadata is stored at the end of the device.
|
|
|
|
As a result of having two copies, some corruption of metadata is not
|
|
|
|
fatal to the working of GPT.
|
|
|
|
When the kernel detects corrupt metadata, it marks this table as corrupt
|
|
|
|
and reports the problem.
|
2010-10-25 16:23:35 +00:00
|
|
|
.Cm destroy
|
|
|
|
and
|
2011-11-21 00:02:49 +00:00
|
|
|
.Cm recover
|
|
|
|
are the only operations allowed on corrupt tables.
|
2010-10-25 16:23:35 +00:00
|
|
|
.Pp
|
2011-06-06 21:02:26 +00:00
|
|
|
If one GPT header appears to be corrupt but the other copy remains intact,
|
|
|
|
the kernel will log the following:
|
2010-10-25 16:23:35 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
GEOM: provider: the primary GPT table is corrupt or invalid.
|
|
|
|
GEOM: provider: using the secondary instead -- recovery strongly advised.
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
or
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
GEOM: provider: the secondary GPT table is corrupt or invalid.
|
|
|
|
GEOM: provider: using the primary only -- recovery suggested.
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2011-06-03 10:39:36 +00:00
|
|
|
Also
|
|
|
|
.Nm
|
2011-06-06 21:02:26 +00:00
|
|
|
commands such as
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm show , status
|
2010-10-25 16:23:35 +00:00
|
|
|
and
|
|
|
|
.Cm list
|
2011-06-06 21:02:26 +00:00
|
|
|
will report about corrupt tables.
|
2010-10-25 16:23:35 +00:00
|
|
|
.Pp
|
2013-01-03 21:58:28 +00:00
|
|
|
If the size of the device has changed (e.g.,\& volume expansion) the
|
2011-06-06 21:02:26 +00:00
|
|
|
secondary GPT header will no longer be located in the last sector.
|
2011-01-13 06:18:00 +00:00
|
|
|
This is not a metadata corruption, but it is dangerous because any
|
2011-11-21 00:02:49 +00:00
|
|
|
corruption of the primary GPT will lead to loss of the partition table.
|
2011-06-06 21:02:26 +00:00
|
|
|
This problem is reported by the kernel with the message:
|
2010-10-25 16:23:35 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
GEOM: provider: the secondary GPT header is not in the last LBA.
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2011-06-06 21:02:26 +00:00
|
|
|
This situation can be recovered with the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm recover
|
2011-01-13 06:18:00 +00:00
|
|
|
command.
|
2011-06-06 21:02:26 +00:00
|
|
|
This command reconstructs the corrupt metadata using known valid
|
|
|
|
metadata and relocates the secondary GPT to the end of the device.
|
2010-10-25 16:23:35 +00:00
|
|
|
.Pp
|
2011-06-03 10:39:36 +00:00
|
|
|
.Em NOTE :
|
2011-06-06 21:02:26 +00:00
|
|
|
The GEOM PART class can detect the same partition table visible through
|
|
|
|
different GEOM providers, and some of them will be marked as corrupt.
|
|
|
|
Be careful when choosing a provider for recovery.
|
2011-01-13 06:18:00 +00:00
|
|
|
If you choose incorrectly you can destroy the metadata of another GEOM class,
|
2013-01-25 16:33:00 +00:00
|
|
|
e.g.,\& GEOM MIRROR or GEOM LABEL.
|
2011-05-30 11:17:42 +00:00
|
|
|
.Sh SYSCTL VARIABLES
|
|
|
|
The following
|
|
|
|
.Xr sysctl 8
|
|
|
|
variables can be used to control the behavior of the
|
|
|
|
.Nm PART
|
|
|
|
GEOM class.
|
|
|
|
The default value is shown next to each variable.
|
|
|
|
.Bl -tag -width indent
|
2017-02-27 17:54:01 +00:00
|
|
|
.It Va kern.geom.part.auto_resize: No 1
|
|
|
|
This variable controls automatic resize behavior of
|
|
|
|
.Nm
|
|
|
|
GEOM class.
|
|
|
|
When this variable is enable and new size of provider is detected, the schema
|
|
|
|
metadata is resized but all changes are not saved to disk, until
|
|
|
|
.Cm gpart commit
|
|
|
|
is run to confirm changes.
|
|
|
|
This behavior is also reported with diagnostic message:
|
|
|
|
.Sy "GEOM_PART: (provider) was automatically resized."
|
|
|
|
.Sy "Use `gpart commit (provider)` to save changes or `gpart undo (provider)`"
|
|
|
|
.Sy "to revert them."
|
2011-05-30 11:17:42 +00:00
|
|
|
.It Va kern.geom.part.check_integrity : No 1
|
|
|
|
This variable controls the behaviour of metadata integrity checks.
|
2011-06-06 21:02:26 +00:00
|
|
|
When integrity checks are enabled, the
|
2011-05-30 11:17:42 +00:00
|
|
|
.Nm PART
|
2011-06-06 21:02:26 +00:00
|
|
|
GEOM class verifies all generic partition parameters obtained from the
|
2011-06-03 10:39:36 +00:00
|
|
|
disk metadata.
|
2011-06-06 21:02:26 +00:00
|
|
|
If some inconsistency is detected, the partition table will be
|
2011-05-30 11:17:42 +00:00
|
|
|
rejected with a diagnostic message:
|
2011-06-03 10:39:36 +00:00
|
|
|
.Sy "GEOM_PART: Integrity check failed (provider, scheme)" .
|
2012-03-19 13:17:47 +00:00
|
|
|
.It Va kern.geom.part.ldm.debug : No 0
|
|
|
|
Debug level of the Logical Disk Manager (LDM) module.
|
|
|
|
This can be set to a number between 0 and 2 inclusive.
|
|
|
|
If set to 0 minimal debug information is printed,
|
|
|
|
and if set to 2 the maximum amount of debug information is printed.
|
|
|
|
.It Va kern.geom.part.ldm.show_mirrors : No 0
|
|
|
|
This variable controls how the Logical Disk Manager (LDM) module handles
|
|
|
|
mirrored volumes.
|
|
|
|
By default mirrored volumes are shown as partitions with type
|
|
|
|
.Cm ms-ldm-data
|
|
|
|
(see the
|
|
|
|
.Sx "PARTITION TYPES"
|
|
|
|
section).
|
|
|
|
If this variable set to 1 each component of the mirrored volume will be
|
2012-05-24 02:24:03 +00:00
|
|
|
present as independent partition.
|
2012-03-19 13:17:47 +00:00
|
|
|
.Em NOTE :
|
|
|
|
This may break a mirrored volume and lead to data damage.
|
2014-08-12 10:31:31 +00:00
|
|
|
.It Va kern.geom.part.mbr.enforce_chs : No 0
|
2014-08-12 09:10:13 +00:00
|
|
|
Specify how the Master Boot Record (MBR) module does alignment.
|
|
|
|
If this variable is set to a non-zero value, the module will automatically
|
|
|
|
recalculate the user-specified offset and size for alignment with the CHS
|
|
|
|
geometry.
|
|
|
|
Otherwise the values will be left unchanged.
|
2011-06-02 09:56:42 +00:00
|
|
|
.El
|
2007-05-15 20:25:18 +00:00
|
|
|
.Sh EXIT STATUS
|
|
|
|
Exit status is 0 on success, and 1 if the command fails.
|
2008-10-09 06:23:04 +00:00
|
|
|
.Sh EXAMPLES
|
2016-07-25 11:25:33 +00:00
|
|
|
The examples below assume that the disk's logical block size is 512
|
|
|
|
bytes, regardless of its physical block size.
|
|
|
|
.Ss GPT
|
|
|
|
In this example, we will format
|
|
|
|
.Pa ada0
|
|
|
|
with the GPT scheme and create boot, swap and root partitions.
|
|
|
|
First, we need to create the partition table:
|
2008-10-09 06:23:04 +00:00
|
|
|
.Bd -literal -offset indent
|
2013-01-03 21:58:28 +00:00
|
|
|
/sbin/gpart create -s GPT ada0
|
2008-10-09 06:23:04 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2016-07-25 11:25:33 +00:00
|
|
|
Next, we install a protective MBR with the first-stage bootstrap code.
|
|
|
|
The protective MBR lists a single, bootable partition spanning the
|
|
|
|
entire disk, thus allowing non-GPT-aware BIOSes to boot from the disk
|
|
|
|
and preventing tools which do not understand the GPT scheme from
|
|
|
|
considering the disk to be unformatted.
|
2008-10-09 06:23:04 +00:00
|
|
|
.Bd -literal -offset indent
|
2013-01-03 21:58:28 +00:00
|
|
|
/sbin/gpart bootcode -b /boot/pmbr ada0
|
2008-10-09 06:23:04 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2016-07-25 11:25:33 +00:00
|
|
|
We then create a dedicated
|
2009-10-19 15:50:59 +00:00
|
|
|
.Cm freebsd-boot
|
2016-07-25 11:25:33 +00:00
|
|
|
partition to hold the second-stage boot loader, which will load the
|
2009-10-19 15:50:59 +00:00
|
|
|
.Fx
|
2016-07-25 11:25:33 +00:00
|
|
|
kernel and modules from a UFS or ZFS filesystem.
|
2012-01-13 12:40:33 +00:00
|
|
|
This partition must be larger than the bootstrap code
|
|
|
|
.Po
|
2016-07-25 11:25:33 +00:00
|
|
|
either
|
2012-01-13 12:40:33 +00:00
|
|
|
.Pa /boot/gptboot
|
2016-07-25 11:25:33 +00:00
|
|
|
for UFS or
|
2011-11-21 00:02:49 +00:00
|
|
|
.Pa /boot/gptzfsboot
|
2016-07-25 11:25:33 +00:00
|
|
|
for ZFS
|
2012-01-13 12:40:33 +00:00
|
|
|
.Pc ,
|
|
|
|
but smaller than 545 kB since the first-stage loader will load the
|
|
|
|
entire partition into memory during boot, regardless of how much data
|
|
|
|
it actually contains.
|
2016-07-25 11:25:33 +00:00
|
|
|
We create a 472-block (236 kB) boot partition at offset 40, which is
|
|
|
|
the size of the partition table (34 blocks or 17 kB) rounded up to the
|
|
|
|
nearest 4 kB boundary.
|
2008-10-09 06:23:04 +00:00
|
|
|
.Bd -literal -offset indent
|
2016-07-25 11:25:33 +00:00
|
|
|
/sbin/gpart add -b 40 -s 472 -t freebsd-boot ada0
|
2013-01-03 21:58:28 +00:00
|
|
|
/sbin/gpart bootcode -p /boot/gptboot -i 1 ada0
|
2008-10-09 06:23:04 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2016-07-25 11:25:33 +00:00
|
|
|
We now create a 4 GB swap partition at the first available offset,
|
|
|
|
which is 40 + 472 = 512 blocks (256 kB).
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart add -s 4G -t freebsd-swap ada0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Aligning the swap partition and all subsequent partitions on a 256 kB
|
|
|
|
boundary ensures optimal performance on a wide range of media, from
|
|
|
|
plain old disks with 512-byte blocks, through modern
|
|
|
|
.Dq advanced format
|
|
|
|
disks with 4096-byte physical blocks, to RAID volumes with stripe
|
|
|
|
sizes of up to 256 kB.
|
|
|
|
.Pp
|
|
|
|
Finally, we create and format an 8 GB
|
2009-10-19 15:50:59 +00:00
|
|
|
.Cm freebsd-ufs
|
2016-07-25 11:25:33 +00:00
|
|
|
partition for the root filesystem, leaving the rest of the slice free
|
|
|
|
for additional filesystems:
|
2008-10-09 06:23:04 +00:00
|
|
|
.Bd -literal -offset indent
|
2016-07-25 11:25:33 +00:00
|
|
|
/sbin/gpart add -s 8G -t freebsd-ufs ada0
|
|
|
|
/sbin/newfs -Uj /dev/ada0p3
|
2008-10-09 06:23:04 +00:00
|
|
|
.Ed
|
2016-07-25 11:25:33 +00:00
|
|
|
.Ss MBR
|
|
|
|
In this example, we will format
|
|
|
|
.Pa ada0
|
|
|
|
with the MBR scheme and create a single partition which we subdivide
|
|
|
|
using a traditional
|
|
|
|
.Bx
|
|
|
|
disklabel.
|
2010-06-03 13:04:56 +00:00
|
|
|
.Pp
|
2016-07-25 11:25:33 +00:00
|
|
|
First, we create the partition table and a single 64 GB partition,
|
|
|
|
then we mark that partition active (bootable) and install the
|
|
|
|
first-stage boot loader:
|
2011-05-27 15:29:39 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart create -s MBR ada0
|
2016-07-25 11:25:33 +00:00
|
|
|
/sbin/gpart add -t freebsd -s 64G ada0
|
2011-05-27 15:29:39 +00:00
|
|
|
/sbin/gpart set -a active -i 1 ada0
|
|
|
|
/sbin/gpart bootcode -b /boot/boot0 ada0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2016-07-25 11:25:33 +00:00
|
|
|
Next, we create a disklabel in that partition
|
|
|
|
.Po
|
|
|
|
.Dq slice
|
|
|
|
in disklabel terminology
|
|
|
|
.Pc
|
|
|
|
with room for up to 20 partitions:
|
2011-05-27 15:29:39 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart create -s BSD -n 20 ada0s1
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2016-07-25 11:25:33 +00:00
|
|
|
We then create an 8 GB root partition and a 4 GB swap partition:
|
2011-05-27 15:29:39 +00:00
|
|
|
.Bd -literal -offset indent
|
2016-07-25 11:25:33 +00:00
|
|
|
/sbin/gpart add -t freebsd-ufs -s 8G ada0s1
|
2011-05-27 15:29:39 +00:00
|
|
|
/sbin/gpart add -t freebsd-swap -s 4G ada0s1
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2016-07-25 11:25:33 +00:00
|
|
|
Finally, we install the appropriate boot loader for the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Bx
|
|
|
|
label:
|
2011-05-27 15:29:39 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart bootcode -b /boot/boot ada0s1
|
|
|
|
.Ed
|
2016-07-25 11:25:33 +00:00
|
|
|
.Ss VTOC8
|
2011-05-27 15:29:39 +00:00
|
|
|
.Pp
|
2011-11-21 00:02:49 +00:00
|
|
|
Create a VTOC8 scheme on
|
2011-06-03 10:39:36 +00:00
|
|
|
.Pa da0 :
|
2010-06-03 13:04:56 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart create -s VTOC8 da0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Create a 512MB-sized
|
|
|
|
.Cm freebsd-ufs
|
2011-11-21 00:02:49 +00:00
|
|
|
partition to contain a UFS filesystem from which the system can boot.
|
2010-06-03 13:04:56 +00:00
|
|
|
.Bd -literal -offset indent
|
2010-07-23 11:00:43 +00:00
|
|
|
/sbin/gpart add -s 512M -t freebsd-ufs da0
|
2010-06-03 13:04:56 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2011-05-03 07:33:39 +00:00
|
|
|
Create a 15GB-sized
|
|
|
|
.Cm freebsd-ufs
|
2011-11-21 00:02:49 +00:00
|
|
|
partition to contain a UFS filesystem and aligned on 4KB boundaries:
|
2011-05-03 07:33:39 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart add -s 15G -t freebsd-ufs -a 4k da0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2011-11-21 00:02:49 +00:00
|
|
|
After creating all required partitions, embed bootstrap code into them:
|
2010-06-03 13:04:56 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart bootcode -p /boot/boot1 da0
|
|
|
|
.Ed
|
2016-07-25 11:25:33 +00:00
|
|
|
.Ss Backup and Restore
|
2010-11-20 16:03:53 +00:00
|
|
|
.Pp
|
2011-11-21 00:02:49 +00:00
|
|
|
Create a backup of the partition table from
|
2011-06-03 10:39:36 +00:00
|
|
|
.Pa da0 :
|
2010-11-20 16:03:53 +00:00
|
|
|
.Bd -literal -offset indent
|
2010-11-22 10:08:33 +00:00
|
|
|
/sbin/gpart backup da0 > da0.backup
|
2010-11-20 16:03:53 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2011-11-21 00:02:49 +00:00
|
|
|
Restore the partition table from the backup to
|
2011-06-03 10:39:36 +00:00
|
|
|
.Pa da0 :
|
2010-11-20 16:03:53 +00:00
|
|
|
.Bd -literal -offset indent
|
2010-11-22 10:08:33 +00:00
|
|
|
/sbin/gpart restore -l da0 < /mnt/da0.backup
|
2010-11-20 16:03:53 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2011-11-21 00:02:49 +00:00
|
|
|
Clone the partition table from
|
2011-06-03 10:39:36 +00:00
|
|
|
.Pa ada0
|
|
|
|
to
|
|
|
|
.Pa ada1
|
|
|
|
and
|
|
|
|
.Pa ada2 :
|
2010-11-20 16:03:53 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart backup ada0 | /sbin/gpart restore -F ada1 ada2
|
|
|
|
.Ed
|
2007-05-15 20:25:18 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr geom 4 ,
|
2011-08-19 10:12:02 +00:00
|
|
|
.Xr boot0cfg 8 ,
|
2013-07-01 22:38:36 +00:00
|
|
|
.Xr geom 8 ,
|
|
|
|
.Xr gptboot 8
|
2007-05-15 20:25:18 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility appeared in
|
|
|
|
.Fx 7.0 .
|
|
|
|
.Sh AUTHORS
|
2014-06-20 09:40:43 +00:00
|
|
|
.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org
|