home | help
GPART(8)		     System Manager's Manual			GPART(8)

NAME
     gpart -- control utility for the disk partitioning GEOM class

SYNOPSIS
     To add support for the disk partitioning GEOM class, place one or more of
     the following lines in your kernel configuration file:

	   options GEOM_PART_APM
	   options GEOM_PART_BSD
	   options GEOM_PART_GPT
	   options GEOM_PART_MBR
	   options GEOM_PART_PC98
	   options GEOM_PART_VTOC8

     The GEOM_PART_APM option adds support for the Apple Partition Map (APM)
     found on Apple Macintosh computers.  The GEOM_PART_BSD option adds support
     for the traditional BSD disklabel.  The GEOM_PART_GPT option adds support
     for the GUID Partition Table (GPT) found on Intel Itanium computers and
     Intel-based Macintosh computers.  The GEOM_PART_MBR option adds support for
     the Master Boot Record (MBR) found on PCs and used on many removable media.
     The GEOM_PART_PC98 option adds support for the MBR variant as used on NEC
     PC-98 computers.  The GEOM_PART_VTOC8 option adds support for Sun's SMI
     VTOC8 label as found on UltraSPARC-based computers.

     Usage of the gpart(8) utility:

     gpart add -b start -s size -t type [-i index] [-l label] [-f flags] geom
     gpart bootcode [-b bootcode] [-p partcode -i index] [-f flags] geom
     gpart commit geom
     gpart create -s scheme [-n entries] [-f flags] provider
     gpart delete -i index [-f flags] geom
     gpart destroy [-f flags] geom
     gpart modify -i index [-l label] [-t type] [-f flags] geom
     gpart set -a attrib -i index [-f flags] geom
     gpart show [geom ...]
     gpart undo geom
     gpart unset -a attrib -i index [-f flags] geom

DESCRIPTION
     The gpart utility is used to partition GEOM providers, normally disks.  The
     first argument of which is the action to be taken:

     add      Add a new partition to the partitioning scheme given by geom.  The
	      partition  begins  on  the  logical  block address given by the -b
	      start option.  Its size is expressed in logical block numbers  and
	      given  by  the -s size option.  The type of the partition is given
	      by the -t type option.  Partition types are discussed in the  sec-
	      tion entitled "Partition Types".

	      Addition options include:

	      -i index	   The	index  in  the	partition table at which the new
			   partition is to be placed. The index  determines  the
			   name of the device special file used to represent the
			   partition.

	      -l label	   The	label attached to the partition.  This option is
			   only valid when used  on  partitioning  schemes  that
			   support partition labels.

	      -f flags	   Additional  operational flags.  See the section enti-
			   tled "Operational flags" below for a discussion about
			   its use.

     bootcode
	      Embed bootstrap code into the partitioning  scheme's  metadata  on
	      the geom (using -b bootcode) or write bootstrap code into a parti-
	      tion  (using  -p	partcode  and  -i  index).  Not all partitioning
	      schemes have embedded bootstrap code, so the -b bootcode option is
	      scheme-specific in nature.  For the GPT scheme, embedded bootstrap
	      code is supported.  The bootstrap code is embedded in the  protec-
	      tive  MBR rather than the GPT.  The -b bootcode option specifies a
	      file that contains the bootstrap code.  The contents and	size  of
	      the  file  are determined by the partitioning scheme.  For the MBR
	      scheme, it's a 512 byte file of which the first 446 bytes are  in-
	      stalled  as  bootstrap  code.   The -p partcode option specifies a
	      file that contains the bootstrap code intended to be written to  a
	      partition.   The	partition  is  specified by the -i index option.
	      The size of the file must be smaller than the size of  the  parti-
	      tion.

	      Addition options include:

	      -f flags	  Additional  operational  flags.  See the section enti-
			  tled "Operational flags" below for a discussion  about
			  its use.

     commit   Commit  any  pending changes for geom geom.  All actions are being
	      committed by default and will not result in pending changes.   Ac-
	      tions  can  be  modified with the -f 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 gpart utility,
	      but they are not actually written to disk.  The commit action will
	      write any and all pending changes to disk.

     create   Create a new partitioning scheme on a provider given by  provider.
	      The  -s  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.

	      Addition options include:

	      -n 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 max-
			  imum equal to the minimum and some schemes have a max-
			  imum	large enough to be considered unlimited.  By de-
			  fault, partition tables are created with  the  minimum
			  number of entries.

	      -f flags	  Additional  operational  flags.  See the section enti-
			  tled "Operational flags" below for a discussion  about
			  its use.

     delete   Delete a partition from geom geom and further identified by the -i
	      index  option.   The partition cannot be actively used by the ker-
	      nel.

	      Addition options include:

	      -f flags	  Additional operational flags.  See the  section  enti-
			  tled	"Operational flags" below for a discussion about
			  its use.

     destroy  Destroy the partitioning scheme as implemented by geom geom.

	      Addition options include:

	      -f flags	  Additional operational flags.  See the  section  enti-
			  tled	"Operational flags" below for a discussion about
			  its use.

     modify   Modify a partition from geom geom and further identified by the -i
	      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 -t type option.  To change the label of a partition,
	      specify  the  new  label with the -l label option.  Not all parti-
	      tioning schemes support labels and it is invalid to try to  change
	      a partition label in such cases.

	      Addition options include:

	      -f flags	  Additional  operational  flags.  See the section enti-
			  tled "Operational flags" below for a discussion  about
			  its use.

     set      Set the named attribute on the partition entry.

	      Addition options include:

	      -f flags	  Additional  operational  flags.  See the section enti-
			  tled "Operational flags" below for a discussion  about
			  its use.

     show     Show  the  current partition information of the specified geoms or
	      all geoms if none are specified.

     undo     Revert any pending changes.  This action is the  opposite  of  the
	      commit  action  and  can be used to undo any changes that have not
	      been committed.

     unset    Clear the named attribute on the partition entry.

	      Addition options include:

	      -f flags	  Additional operational flags.  See the  section  enti-
			  tled	"Operational flags" below for a discussion about
			  its use.

PARTITION TYPES
     The gpart 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.  the gpart utility also allows the user  to	specify  scheme-specific
     partition types for partition types that don't have symbol names.	The sym-
     bolic names currently understood are:

     efi	    The  system  partition for computers that use the Extensible
		    Firmware Interface (EFI).  In such cases, the GPT partition-
		    ing scheme is being used and the actual partition  type  for
		    the    system   partition	can   also   be   specified   as
		    "!c12a7328-f81f-11d2-ba4b-00a0c93ec93ab".

     freebsd	    A FreeBSD partition that uses the BSD disklabel  to  sub-di-
		    vide the partition into file systems.  This is a legacy par-
		    tition  type  and  should  not  be	used  for the APM or GPT
		    schemes.  The scheme-specific  types  are  "!165"  for  MBR,
		    "!FreeBSD"		    for 	    APM,	     and
		    "!516e7cb4-6ecf-11d6-8ff8-00022d09712b" for GPT.

     freebsd-boot   A  FreeBSD	partition  dedicated  to  bootstrap  code.   The
		    scheme-specific	 type	   is	   "!83bd6b9d-7f41-11dc-
		    be0b-001560b84f0f" for GPT.

     freebsd-swap   A FreeBSD partition dedicated to swap  space.   The  scheme-
		    specific	types	are   "!FreeBSD-swap"	for   APM,   and
		    "!516e7cb5-6ecf-11d6-8ff8-00022d09712b" for GPT.

     freebsd-ufs    A FreeBSD partition that contains a UFS or UFS2 file system.
		    the scheme-specific types are "!FreeBSD-UFS"  for  APM,  and
		    "!516e7cb6-6ecf-11d6-8ff8-00022d09712b" for GPT.

     freebsd-vinum  A  FreeBSD	partition  that  contains  a  Vinum volume.  The
		    scheme-specific types  are	"!FreeBSD-Vinum"  for  APM,  and
		    "!516e7cb8-6ecf-11d6-8ff8-00022d09712b" for GPT.

     freebsd-zfs    A FreeBSD partition that contains a ZFS volume.  The scheme-
		    specific	types	 are   "!FreeBSD-ZFS"	for   APM,   and
		    "!516e7cba-6ecf-11d6-8ff8-00022d09712b" for GPT.

     mbr	    A partition that is sub-partitioned by a master boot  record
		    (MBR).	   This       type	 is	  known       as
		    "!024dee41-33e7-11d3-9d69-0008c781f39f" by GPT.

OPERATIONAL FLAGS
     Actions other than the commit and undo actions take an  optional  -f  flags
     option.   This option is used to specify action-specific operational flags.
     By default, the gpart utility defines the 'C' flag so that  the  action  is
     immediately committed.  The user can specify -f x to have the action result
     in  a pending change that can later, with other pending changes, be commit-
     ted as a single compound change with the commit action or reverted with the
     undo action.

EXIT STATUS
     Exit status is 0 on success, and 1 if the command fails.

EXAMPLES
     Create GPT scheme on ad0.

	   /sbin/gpart create -s GPT ad0

     Embed GPT bootstrap code into protective MBR.

	   /sbin/gpart bootcode -b /boot/pmbr ad0

     Create a dedicated freebsd-boot partition that  can  boot	FreeBSD  from  a
     freebsd-ufs  partition, and install bootstrap code into it.  This partition
     must be larger than /boot/gptboot, or the GPT  boot  you  are  planning  to
     write.   A  size  of 15 blocks (7680 bytes) would be sufficient for booting
     from UFS but lets use 128 blocks (64 KB) here in this example, in order  to
     reserve some space for potential future need (e.g. from a ZFS partition).

	   /sbin/gpart add -b 34 -s 128 -t freebsd-boot ad0
	   /sbin/gpart bootcode -p /boot/gptboot -i 1 ad0

     Create a 512MB-sized freebsd-ufs partition that would contain UFS where the
     system boot from.

	   /sbin/gpart add -b 162 -s 1048576 -t freebsd-ufs ad0

SEE ALSO
     geom(4), geom(8),

HISTORY
     The gpart utility appeared in FreeBSD 7.0.

AUTHORS
     Marcel Moolenaar <marcel@FreeBSD.org>

FreeBSD 7.2			  Nov 18, 2008				GPART(8)

home | help