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$
|
|
|
|
.\"
|
2011-05-30 11:17:42 +00:00
|
|
|
.Dd May 30, 2011
|
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
|
|
|
|
To add support for the disk partitioning GEOM class,
|
|
|
|
place one or more of the following
|
|
|
|
lines in your kernel configuration file:
|
|
|
|
.Bd -ragged -offset indent
|
|
|
|
.Cd "options GEOM_PART_APM"
|
2008-06-06 05:14:16 +00:00
|
|
|
.Cd "options GEOM_PART_BSD"
|
2010-04-23 03:37:39 +00:00
|
|
|
.Cd "options GEOM_PART_EBR"
|
2011-03-12 17:05:18 +00:00
|
|
|
.Cd "options GEOM_PART_EBR_COMPAT"
|
2007-05-15 20:25:18 +00:00
|
|
|
.Cd "options GEOM_PART_GPT"
|
2007-10-21 00:04:23 +00:00
|
|
|
.Cd "options GEOM_PART_MBR"
|
2008-06-06 05:14:16 +00:00
|
|
|
.Cd "options GEOM_PART_PC98"
|
|
|
|
.Cd "options GEOM_PART_VTOC8"
|
2007-05-15 20:25:18 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2009-10-19 15:50:59 +00:00
|
|
|
The
|
|
|
|
.Dv GEOM_PART_APM
|
|
|
|
option adds support for the Apple Partition Map (APM)
|
2007-10-21 00:04:23 +00:00
|
|
|
found on Apple Macintosh computers.
|
2009-10-19 15:50:59 +00:00
|
|
|
The
|
|
|
|
.Dv GEOM_PART_BSD
|
|
|
|
option adds support for the traditional
|
|
|
|
.Bx
|
|
|
|
disklabel.
|
|
|
|
The
|
2010-04-23 03:37:39 +00:00
|
|
|
.Dv GEOM_PART_EBR
|
|
|
|
option adds support for the Extended Boot Record (EBR),
|
|
|
|
which is used to define a logical partition.
|
|
|
|
The
|
2011-03-12 17:05:18 +00:00
|
|
|
.Dv GEOM_PART_EBR_COMPAT
|
2011-03-12 21:51:56 +00:00
|
|
|
option enables backward compatibility for partition names
|
2011-06-03 10:39:36 +00:00
|
|
|
in the EBR scheme.
|
|
|
|
Also it makes impossible any types of actions
|
2011-03-12 17:05:18 +00:00
|
|
|
with such partitions.
|
|
|
|
The
|
2009-10-19 15:50:59 +00:00
|
|
|
.Dv GEOM_PART_GPT
|
|
|
|
option adds support for the GUID Partition Table (GPT)
|
2007-10-21 00:04:23 +00:00
|
|
|
found on Intel Itanium computers and Intel-based Macintosh computers.
|
2009-10-19 15:50:59 +00:00
|
|
|
The
|
|
|
|
.Dv GEOM_PART_MBR
|
|
|
|
option adds support for the Master Boot Record (MBR)
|
2007-10-21 00:04:23 +00:00
|
|
|
found on PCs and used on many removable media.
|
2009-10-19 15:50:59 +00:00
|
|
|
The
|
|
|
|
.Dv GEOM_PART_PC98
|
|
|
|
option adds support for the MBR variant as used on
|
2008-06-06 05:14:16 +00:00
|
|
|
NEC PC-98 computers.
|
2009-10-19 15:50:59 +00:00
|
|
|
The
|
|
|
|
.Dv GEOM_PART_VTOC8
|
|
|
|
option adds support for Sun's SMI VTOC8 label as
|
2010-06-03 13:04:56 +00:00
|
|
|
found on computers based on
|
|
|
|
.Tn SPARC64
|
|
|
|
and
|
|
|
|
.Tn UltraSPARC.
|
2007-05-15 20:25:18 +00:00
|
|
|
.Pp
|
|
|
|
Usage of the
|
2009-10-19 15:50:59 +00:00
|
|
|
.Ns Nm
|
2007-05-15 20:25:18 +00:00
|
|
|
utility:
|
|
|
|
.Pp
|
|
|
|
.\" ==== 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
|
|
|
.\"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is used to partition GEOM providers, normally disks.
|
|
|
|
The first argument of which 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
|
|
|
|
Dump a partition table to standard output in special format used by
|
|
|
|
.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
|
|
|
|
option is scheme-specific in nature.
|
|
|
|
For the GPT scheme, embedded bootstrap code is supported.
|
|
|
|
The bootstrap code is embedded in the protective MBR rather than the GPT.
|
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.
|
2009-10-19 15:50:59 +00:00
|
|
|
For the MBR scheme, it is a 512 byte file of which the first 446 bytes
|
2008-06-06 05:14:16 +00:00
|
|
|
are installed as bootstrap code.
|
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.
|
2010-06-03 13:04:56 +00:00
|
|
|
For the VTOC8 scheme, it is a 8192 byte file of which the last 7680 bytes
|
|
|
|
are installed as bootstrap code.
|
2008-06-07 00:14:06 +00:00
|
|
|
The partition is specified by the
|
|
|
|
.Fl i Ar index
|
|
|
|
option.
|
2010-06-03 13:04:56 +00:00
|
|
|
For the VTOC8 scheme, if the
|
|
|
|
.Fl i Ar index
|
|
|
|
option is omitted, the bootstrap code is written to all sufficiently large
|
|
|
|
partitions.
|
2008-06-07 00:14:06 +00:00
|
|
|
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 .
|
|
|
|
All actions are being committed by default and will not result in
|
|
|
|
pending changes.
|
|
|
|
Actions can be modified with the
|
|
|
|
.Fl f Ar flags
|
|
|
|
option so that they are not being committed by default.
|
|
|
|
As such, they become pending.
|
|
|
|
Pending changes are reflected by the geom and the
|
|
|
|
.Nm
|
|
|
|
utility, but they are not actually written to disk.
|
|
|
|
The
|
|
|
|
.Cm commit
|
|
|
|
action will write any and all pending changes to disk.
|
|
|
|
.\" ==== 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.
|
|
|
|
The kernel needs to have support for a particular scheme before
|
|
|
|
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.
|
|
|
|
Every partitioning scheme has a minimum and a maximum number of entries
|
|
|
|
and this option allows tables to be created with the number of entries
|
|
|
|
that lies anywhere between the minimum and the maximum.
|
|
|
|
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.
|
|
|
|
Only the the type and/or label of the partition can be modified.
|
|
|
|
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
|
|
|
|
Recover corrupt partition's scheme metadata on the geom
|
|
|
|
.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
|
|
|
|
Restore the partition table from backup previously created by
|
|
|
|
.Cm backup
|
2011-01-13 06:18:00 +00:00
|
|
|
action and given from standard input.
|
|
|
|
Only partition table may be restored.
|
|
|
|
This action does not affect content of partitions.
|
2010-11-20 16:03:53 +00:00
|
|
|
This mean that you should copy your data from backup after restoring
|
2011-06-03 10:39:36 +00:00
|
|
|
partition table and write bootcode again if it is needed.
|
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
|
|
|
|
Show the current partition information of the specified geoms
|
|
|
|
or all geoms if none are specified.
|
2010-11-22 10:08:33 +00:00
|
|
|
Additional options include:
|
|
|
|
.Bl -tag -width 10n
|
|
|
|
.It Fl l
|
|
|
|
For partition schemes that support partition labels print them
|
|
|
|
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
|
2007-05-15 20:25:18 +00:00
|
|
|
.El
|
2008-06-18 01:46:32 +00:00
|
|
|
.\"
|
2007-05-15 20:25:18 +00:00
|
|
|
.Sh PARTITION TYPES
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility uses symbolic names for common partition types to avoid that the
|
|
|
|
user needs to know what the partitioning scheme in question is and what
|
|
|
|
the actual number or identification needs to be used for a particular
|
|
|
|
type.
|
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
|
2009-10-19 15:50:59 +00:00
|
|
|
for partition types that do not have symbol names.
|
2007-05-15 20:25:18 +00:00
|
|
|
The symbolic names currently understood are:
|
2009-10-19 15:50:59 +00:00
|
|
|
.Bl -tag -width ".Cm freebsd-vinum"
|
2011-01-28 11:56:14 +00:00
|
|
|
.It Cm bios-boot
|
|
|
|
The system partition dedicated to second stage of the boot loader program.
|
|
|
|
Usually it used by GRUB 2 loader when the partition table is GPT.
|
|
|
|
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).
|
|
|
|
In such cases, the GPT partitioning scheme is being used and the
|
|
|
|
actual partition type for the system partition can also be specified as
|
2009-10-19 15:50:59 +00:00
|
|
|
.Qq Li "!c12a7328-f81f-11d2-ba4b-00a0c93ec93ab" .
|
|
|
|
.It Cm freebsd
|
|
|
|
A
|
|
|
|
.Fx
|
|
|
|
partition that uses the
|
|
|
|
.Bx
|
|
|
|
disklabel to sub-divide the
|
2007-05-15 20:25:18 +00:00
|
|
|
partition into file systems.
|
|
|
|
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
|
|
|
|
partition that contains a UFS or UFS2 file system.
|
|
|
|
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.
|
2009-10-19 15:50:59 +00:00
|
|
|
.It Cm mbr
|
2007-05-15 20:25:18 +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.
|
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.
|
|
|
|
Multiple partitions might be marked with the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootme
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute.
|
|
|
|
In such scenario the
|
|
|
|
.Nm gptboot
|
|
|
|
will try all
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootme
|
2010-09-28 09:07:00 +00:00
|
|
|
partitions one by one, until the next boot stage is successfully entered.
|
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.
|
|
|
|
Partitions with both
|
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
|
|
|
attributes are tried before partitions with only the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootme
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute.
|
|
|
|
Before
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootonce
|
2010-09-28 09:07:00 +00:00
|
|
|
partition is tried, the
|
|
|
|
.Nm gptboot
|
|
|
|
removes the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootme
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute and tries to execute the next boot stage.
|
|
|
|
If it fails, the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootonce
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute that is now alone is replaced with the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootfailed
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute.
|
|
|
|
If the execution of the next boot stage succeeds, but the system is not fully
|
|
|
|
booted, the
|
|
|
|
.Nm gptboot
|
|
|
|
will look for
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootonce
|
2010-09-28 09:07:00 +00:00
|
|
|
attributes alone (without the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootme
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute) on the next system boot and will replace those with the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootfailed
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute.
|
|
|
|
If the system is fully booted, the
|
|
|
|
.Pa /etc/rc.d/gptboot
|
|
|
|
start-up script will look for partition with the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootonce
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute alone, will remove the attribute and log that the system was
|
|
|
|
successfully booted from this partition.
|
|
|
|
There should be at most one
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootonce
|
2010-09-28 09:07:00 +00:00
|
|
|
partition when system is successfully booted.
|
|
|
|
Multiple partitions might 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.
|
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.
|
|
|
|
This attribute is used to mark partitions that had the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootonce
|
2010-09-28 09:07:00 +00:00
|
|
|
attribute set, but we failed to boot from them.
|
|
|
|
Once we successfully boot, the
|
|
|
|
.Pa /etc/rc.d/gptboot
|
|
|
|
script will log all the partitions we failed to boot from and will remove the
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm bootfailed
|
2010-09-28 09:07:00 +00:00
|
|
|
attributes.
|
|
|
|
.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
|
|
|
|
.Pp
|
|
|
|
The scheme-specific attributes for PC98:
|
2011-06-03 10:39:36 +00:00
|
|
|
.Bl -tag -width ".Cm bootable"
|
|
|
|
.It Cm active
|
|
|
|
.It Cm bootable
|
2010-09-28 09:07:00 +00:00
|
|
|
.El
|
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
|
|
|
|
The GEOM class PART supports recovering of partition tables only for GPT.
|
|
|
|
The GUID partition table has a primary and secondary (backup) copy of
|
2011-01-13 06:18:00 +00:00
|
|
|
metadata for redundance.
|
|
|
|
They are stored in the begining and in the end of device respectively.
|
|
|
|
Therefore it is acceptable to have some corruptions in the metadata that
|
|
|
|
are not fatal to work with GPT.
|
|
|
|
When kernel detects corrupt metadata it marks this table as corrupt and
|
|
|
|
reports about corruption.
|
2010-10-25 16:23:35 +00:00
|
|
|
Any changes in corrupt table are prohibited except
|
|
|
|
.Cm destroy
|
|
|
|
and
|
2011-06-03 10:39:36 +00:00
|
|
|
.Cm recover .
|
2010-10-25 16:23:35 +00:00
|
|
|
.Pp
|
|
|
|
In case when only first sector is corrupt kernel can not detect GPT even
|
2011-01-13 06:18:00 +00:00
|
|
|
if partition table is not corrupt.
|
|
|
|
You can write protective MBR with
|
2010-10-25 16:23:35 +00:00
|
|
|
.Xr dd 1
|
2011-01-13 06:18:00 +00:00
|
|
|
command to restore ability of GPT detection.
|
|
|
|
The copy of protective MBR is usually located in the
|
2010-10-25 16:23:35 +00:00
|
|
|
.Pa /boot/pmbr
|
|
|
|
file.
|
|
|
|
.Pp
|
|
|
|
In case when some of metadata is corrupt you will get to know about this
|
|
|
|
from kernel's messages like these:
|
|
|
|
.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
|
|
|
|
commands like
|
|
|
|
.Cm show , status
|
2010-10-25 16:23:35 +00:00
|
|
|
and
|
|
|
|
.Cm list
|
|
|
|
will report about corrupt table.
|
|
|
|
.Pp
|
2011-06-03 10:39:36 +00:00
|
|
|
In case when the size of device has changed (e.g.\& volume expansion) the
|
2011-01-13 06:18:00 +00:00
|
|
|
secondary GPT header will become located not in the last sector.
|
|
|
|
This is not a metadata corruption, but it is dangerous because any
|
|
|
|
corruption of the primary GPT will lead to lost of partition table.
|
|
|
|
Kernel reports about this problem with 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-03 10:39:36 +00:00
|
|
|
A corrupt table can be recovered with
|
|
|
|
.Cm recover
|
2011-01-13 06:18:00 +00:00
|
|
|
command.
|
2011-06-03 10:39:36 +00:00
|
|
|
This command does reconstruction of corrupt metadata using
|
2011-01-13 06:18:00 +00:00
|
|
|
known valid metadata.
|
|
|
|
Also it can relocate secondary GPT to the end of device.
|
2010-10-25 16:23:35 +00:00
|
|
|
.Pp
|
2011-06-03 10:39:36 +00:00
|
|
|
.Em NOTE :
|
|
|
|
The GEOM class PART can detect the same partition table on different GEOM
|
2011-01-13 06:18:00 +00:00
|
|
|
providers and some of them will be marked as corrupt.
|
|
|
|
Be careful when choosing a provider for recovering.
|
|
|
|
If you choose incorrectly you can destroy the metadata of another GEOM class,
|
2011-06-03 10:39:36 +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
|
|
|
|
.It Va kern.geom.part.check_integrity : No 1
|
|
|
|
This variable controls the behaviour of metadata integrity checks.
|
|
|
|
When integrity checks are enabled
|
|
|
|
.Nm PART
|
|
|
|
GEOM class verifies all generic partition parameters that it gets from the
|
2011-06-03 10:39:36 +00:00
|
|
|
disk metadata.
|
|
|
|
If some inconsistency is detected, 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)" .
|
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
|
|
|
|
Create GPT scheme on
|
2011-06-03 10:39:36 +00:00
|
|
|
.Pa ad0 :
|
2008-10-09 06:23:04 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart create -s GPT ad0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2011-06-03 10:39:36 +00:00
|
|
|
Embed GPT bootstrap code into protective MBR:
|
2008-10-09 06:23:04 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart bootcode -b /boot/pmbr ad0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Create a dedicated
|
2009-10-19 15:50:59 +00:00
|
|
|
.Cm freebsd-boot
|
|
|
|
partition that can boot
|
|
|
|
.Fx
|
|
|
|
from a
|
|
|
|
.Cm freebsd-ufs
|
2008-10-09 06:23:04 +00:00
|
|
|
partition, and install bootstrap code into it.
|
|
|
|
This partition must be larger than
|
|
|
|
.Pa /boot/gptboot ,
|
2010-07-23 11:00:43 +00:00
|
|
|
or the GPT boot you are planning to write, but smaller than 545 KB.
|
2008-11-18 20:38:07 +00:00
|
|
|
A size of 15 blocks (7680 bytes) would be sufficient for
|
2009-10-19 15:50:59 +00:00
|
|
|
booting from UFS but let's use 128 blocks (64 KB) here in
|
2008-10-09 06:23:04 +00:00
|
|
|
this example, in order to reserve some space for potential
|
2009-10-19 15:50:59 +00:00
|
|
|
future need (e.g.\& from a ZFS partition).
|
2008-10-09 06:23:04 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart add -b 34 -s 128 -t freebsd-boot ad0
|
|
|
|
/sbin/gpart bootcode -p /boot/gptboot -i 1 ad0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Create a 512MB-sized
|
2009-10-19 15:50:59 +00:00
|
|
|
.Cm freebsd-ufs
|
2011-06-03 10:39:36 +00:00
|
|
|
partition that would contain UFS where the system boots from:
|
2008-10-09 06:23:04 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart add -b 162 -s 1048576 -t freebsd-ufs ad0
|
|
|
|
.Ed
|
2010-06-03 13:04:56 +00:00
|
|
|
.Pp
|
2011-05-27 15:29:39 +00:00
|
|
|
Create MBR scheme on
|
|
|
|
.Pa ada0 ,
|
2011-06-03 10:39:36 +00:00
|
|
|
then create 30GB-sized
|
|
|
|
.Fx
|
|
|
|
slice, mark it active and
|
|
|
|
install
|
|
|
|
.Nm boot0
|
|
|
|
boot manager:
|
2011-05-27 15:29:39 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart create -s MBR ada0
|
|
|
|
/sbin/gpart add -t freebsd -s 30G ada0
|
|
|
|
/sbin/gpart set -a active -i 1 ada0
|
|
|
|
/sbin/gpart bootcode -b /boot/boot0 ada0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2011-06-03 10:39:36 +00:00
|
|
|
Now create
|
|
|
|
.Bx
|
|
|
|
scheme
|
|
|
|
.Pf ( Bx
|
|
|
|
label) with ability to have 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
|
|
|
|
Create 1GB-sized UFS partition and 4GB-sized swap partition:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart add -t freebsd-ufs -s 1G ada0s1
|
|
|
|
/sbin/gpart add -t freebsd-swap -s 4G ada0s1
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2011-06-03 10:39:36 +00:00
|
|
|
Install bootstrap code for the
|
|
|
|
.Bx
|
|
|
|
label:
|
2011-05-27 15:29:39 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart bootcode -b /boot/boot ada0s1
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2010-06-03 13:04:56 +00:00
|
|
|
Create 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-06-03 10:39:36 +00:00
|
|
|
partition that would contain UFS where the system boots from:
|
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
|
|
|
|
partition that would contain UFS and aligned on 4KB boundaries:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
/sbin/gpart add -s 15G -t freebsd-ufs -a 4k da0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2011-06-03 10:39:36 +00:00
|
|
|
After having created 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
|
2010-11-20 16:03:53 +00:00
|
|
|
.Pp
|
|
|
|
Create backup of 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
|
|
|
|
Restore partition table from 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-06-03 10:39:36 +00:00
|
|
|
Clone partition table from
|
|
|
|
.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
|
2010-10-25 16:23:35 +00:00
|
|
|
.Xr dd 1 ,
|
2007-05-15 20:25:18 +00:00
|
|
|
.Xr geom 4 ,
|
2009-10-19 15:50:59 +00:00
|
|
|
.Xr geom 8
|
2007-05-15 20:25:18 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility appeared in
|
|
|
|
.Fx 7.0 .
|
|
|
|
.Sh AUTHORS
|
|
|
|
.An Marcel Moolenaar Aq marcel@FreeBSD.org
|