1 .\" Copyright (c) 2007, 2008 Marcel Moolenaar
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd "control utility for the disk partitioning GEOM class"
34 To add support for the disk partitioning GEOM class,
35 place one or more of the following
36 lines in your kernel configuration file:
37 .Bd -ragged -offset indent
38 .Cd "options GEOM_PART_APM"
39 .Cd "options GEOM_PART_BSD"
40 .Cd "options GEOM_PART_EBR"
41 .Cd "options GEOM_PART_GPT"
42 .Cd "options GEOM_PART_MBR"
43 .Cd "options GEOM_PART_PC98"
44 .Cd "options GEOM_PART_VTOC8"
49 option adds support for the Apple Partition Map (APM)
50 found on Apple Macintosh computers.
53 option adds support for the traditional
58 option adds support for the Extended Boot Record (EBR),
59 which is used to define a logical partition.
62 option adds support for the GUID Partition Table (GPT)
63 found on Intel Itanium computers and Intel-based Macintosh computers.
66 option adds support for the Master Boot Record (MBR)
67 found on PCs and used on many removable media.
70 option adds support for the MBR variant as used on
74 option adds support for Sun's SMI VTOC8 label as
75 found on computers based on
94 .\" ==== BOOTCODE ====
98 .Op Fl p Ar partcode Fl i Ar index
118 .\" ==== DESTROY ====
164 utility is used to partition GEOM providers, normally disks.
165 The first argument of which is the action to be taken:
166 .Bl -tag -width ".Cm bootcode"
169 Add a new partition to the partitioning scheme given by
171 The partition begins on the logical block address given by the
174 Its size is given by the
176 option. SI unit suffixes are allowed. One or both
180 options can be ommitted. If so they are automatically calculated.
181 The type of the partition is given by the
184 Partition types are discussed below in the section entitled
185 .Sx "PARTITION TYPES" .
187 Additional options include:
190 The index in the partition table at which the new partition is to be
192 The index determines the name of the device special file used
193 to represent the partition.
195 The label attached to the partition.
196 This option is only valid when used on partitioning schemes that support
199 Additional operational flags.
200 See the section entitled
201 .Sx "OPERATIONAL FLAGS"
202 below for a discussion
205 .\" ==== BOOTCODE ====
207 Embed bootstrap code into the partitioning scheme's metadata on the
211 or write bootstrap code into a partition (using
215 Not all partitioning schemes have embedded bootstrap code, so the
217 option is scheme-specific in nature.
218 For the GPT scheme, embedded bootstrap code is supported.
219 The bootstrap code is embedded in the protective MBR rather than the GPT.
222 option specifies a file that contains the bootstrap code.
223 The contents and size of the file are determined by the partitioning
225 For the MBR scheme, it is a 512 byte file of which the first 446 bytes
226 are installed as bootstrap code.
229 option specifies a file that contains the bootstrap code intended to be
230 written to a partition.
231 For the VTOC8 scheme, it is a 8192 byte file of which the last 7680 bytes
232 are installed as bootstrap code.
233 The partition is specified by the
236 For the VTOC8 scheme, if the
238 option is omitted, the bootstrap code is written to all sufficiently large
240 The size of the file must be smaller than the size of the partition.
242 Additional options include:
245 Additional operational flags.
246 See the section entitled
247 .Sx "OPERATIONAL FLAGS"
248 below for a discussion
253 Commit any pending changes for geom
255 All actions are being committed by default and will not result in
257 Actions can be modified with the
259 option so that they are not being committed by default.
260 As such, they become pending.
261 Pending changes are reflected by the geom and the
263 utility, but they are not actually written to disk.
266 action will write any and all pending changes to disk.
269 Create a new partitioning scheme on a provider given by
273 option determines the scheme to use.
274 The kernel needs to have support for a particular scheme before
275 that scheme can be used to partition a disk.
277 Additional options include:
280 The number of entries in the partition table.
281 Every partitioning scheme has a minimum and a maximum number of entries
282 and this option allows tables to be created with the number of entries
283 that lies anywhere between the minimum and the maximum.
284 Some schemes have a maximum equal to the minimum and some schemes have
285 a maximum large enough to be considered unlimited.
286 By default, partition tables are created with the minimum number of
289 Additional operational flags.
290 See the section entitled
291 .Sx "OPERATIONAL FLAGS"
292 below for a discussion
297 Delete a partition from geom
299 and further identified by the
302 The partition cannot be actively used by the kernel.
304 Additional options include:
307 Additional operational flags.
308 See the section entitled
309 .Sx "OPERATIONAL FLAGS"
310 below for a discussion
313 .\" ==== DESTROY ====
315 Destroy the partitioning scheme as implemented by geom
318 Additional options include:
321 Additional operational flags.
322 See the section entitled
323 .Sx "OPERATIONAL FLAGS"
324 below for a discussion
329 Modify a partition from geom
331 and further identified by the
334 Only the the type and/or label of the partition can be modified.
335 To change the type of a partition, specify the new type with the
338 To change the label of a partition, specify the new label with the
341 Not all partitioning schemes support labels and it is invalid to
342 try to change a partition label in such cases.
344 Additional options include:
347 Additional operational flags.
348 See the section entitled
349 .Sx "OPERATIONAL FLAGS"
350 below for a discussion
355 Resize a partition from geom
357 and further identified by the
360 New partition size is expressed in logical block
361 numbers and can be given by the
366 option is ommited then new size is automatically calculated
367 to maximum available from given geom
370 Additional options include:
373 Additional operational flags.
374 See the section entitled
375 .Sx "OPERATIONAL FLAGS"
376 below for a discussion
381 Set the named attribute on the partition entry.
383 Additional options include:
386 Additional operational flags.
387 See the section entitled
388 .Sx "OPERATIONAL FLAGS"
389 below for a discussion
394 Show the current partition information of the specified geoms
395 or all geoms if none are specified.
398 Revert any pending changes for geom
400 This action is the opposite of the
402 action and can be used to undo any changes that have not been committed.
405 Clear the named attribute on the partition entry.
407 Additional options include:
410 Additional operational flags.
411 See the section entitled
412 .Sx "OPERATIONAL FLAGS"
413 below for a discussion
421 utility uses symbolic names for common partition types to avoid that the
422 user needs to know what the partitioning scheme in question is and what
423 the actual number or identification needs to be used for a particular
427 utility also allows the user to specify scheme-specific partition types
428 for partition types that do not have symbol names.
429 The symbolic names currently understood are:
430 .Bl -tag -width ".Cm freebsd-vinum"
432 The system partition for computers that use the Extensible Firmware
434 In such cases, the GPT partitioning scheme is being used and the
435 actual partition type for the system partition can also be specified as
436 .Qq Li "!c12a7328-f81f-11d2-ba4b-00a0c93ec93ab" .
440 partition that uses the
442 disklabel to sub-divide the
443 partition into file systems.
444 This is a legacy partition type and should not be used for the APM
446 The scheme-specific types are
451 .Qq Li "!516e7cb4-6ecf-11d6-8ff8-00022d09712b"
456 partition dedicated to bootstrap code.
457 The scheme-specific type is
458 .Qq Li "!83bd6b9d-7f41-11dc-be0b-001560b84f0f"
463 partition dedicated to swap space.
464 The scheme-specific types are
465 .Qq Li "!FreeBSD-swap"
467 .Qq Li "!516e7cb5-6ecf-11d6-8ff8-00022d09712b"
468 for GPT, and tag 0x0901 for VTOC8.
472 partition that contains a UFS or UFS2 file system.
473 The scheme-specific types are
474 .Qq Li "!FreeBSD-UFS"
476 .Qq Li "!516e7cb6-6ecf-11d6-8ff8-00022d09712b"
477 for GPT, and tag 0x0902 for VTOC8.
481 partition that contains a Vinum volume.
482 The scheme-specific types are
483 .Qq Li "!FreeBSD-Vinum"
485 .Qq Li "!516e7cb8-6ecf-11d6-8ff8-00022d09712b"
486 for GPT, and tag 0x0903 for VTOC8.
490 partition that contains a ZFS volume.
491 The scheme-specific types are
492 .Qq Li "!FreeBSD-ZFS"
494 .Qq Li "!516e7cba-6ecf-11d6-8ff8-00022d09712b"
495 for GPT, and 0x0904 for VTOC8.
497 A partition that is sub-partitioned by a master boot record (MBR).
498 This type is known as
499 .Qq Li "!024dee41-33e7-11d3-9d69-0008c781f39f"
502 .Sh OPERATIONAL FLAGS
503 Actions other than the
507 actions take an optional
510 This option is used to specify action-specific operational flags.
515 flag so that the action is immediately
519 to have the action result in a pending change that can later, with
520 other pending changes, be committed as a single compound change with
523 action or reverted with the
527 Exit status is 0 on success, and 1 if the command fails.
531 .Bd -literal -offset indent
532 /sbin/gpart create -s GPT ad0
535 Embed GPT bootstrap code into protective MBR.
536 .Bd -literal -offset indent
537 /sbin/gpart bootcode -b /boot/pmbr ad0
542 partition that can boot
546 partition, and install bootstrap code into it.
547 This partition must be larger than
549 or the GPT boot you are planning to write, but smaller than 545 KB.
550 A size of 15 blocks (7680 bytes) would be sufficient for
551 booting from UFS but let's use 128 blocks (64 KB) here in
552 this example, in order to reserve some space for potential
553 future need (e.g.\& from a ZFS partition).
554 .Bd -literal -offset indent
555 /sbin/gpart add -b 34 -s 128 -t freebsd-boot ad0
556 /sbin/gpart bootcode -p /boot/gptboot -i 1 ad0
561 partition that would contain UFS where the system boots from.
562 .Bd -literal -offset indent
563 /sbin/gpart add -b 162 -s 1048576 -t freebsd-ufs ad0
566 Create VTOC8 scheme on
568 .Bd -literal -offset indent
569 /sbin/gpart create -s VTOC8 da0
574 partition that would contain UFS where the system boots from.
575 .Bd -literal -offset indent
576 /sbin/gpart add -s 512M -t freebsd-ufs da0
579 After having created all required partitions, embed bootstrap code into them.
580 .Bd -literal -offset indent
581 /sbin/gpart bootcode -p /boot/boot1 da0
592 .An Marcel Moolenaar Aq marcel@FreeBSD.org