1.\" $NetBSD: gpt.8,v 1.7 2011/03/27 01:01:07 jym Exp $ 2.\" 3.\" Copyright (c) 2002 Marcel Moolenaar 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26.\" 27.\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $ 28.\" 29.Dd March 27, 2011 30.Dt GPT 8 31.Os 32.Sh NAME 33.Nm gpt 34.Nd GUID partition table maintenance utility 35.Sh SYNOPSIS 36.Nm 37.Op Ar general_options 38.Ar command 39.Op Ar command_options 40.Ar device ... 41.Sh DESCRIPTION 42The 43.Nm 44utility provides the necessary functionality to manipulate GUID partition 45tables (GPTs), but see 46.Sx BUGS 47below for how and where functionality is missing. 48The basic usage model of the 49.Nm 50tool follows that of the 51.Xr cvs 1 52tool. 53The general options are described in the following paragraph. 54The remaining paragraphs describe the individual commands with their options. 55Here we conclude by mentioning that a 56.Ar device 57is either a special file 58corresponding to a disk-like device or a regular file. 59The command is applied to each 60.Ar device 61listed on the command line. 62.Ss General Options 63The general options allow the user to change default settings or otherwise 64change the behaviour that is applicable to all commands. 65Not all commands use all default settings, so some general options may not 66have an effect on all commands. 67.Pp 68The 69.Fl p Ar count 70option allows the user to change the number of partitions the GPT can 71accommodate. 72This is used whenever a new GPT is created. 73By default, the 74.Nm 75utility will create space for 128 partitions (or 32 sectors of 512 bytes). 76.Pp 77The 78.Fl r 79option causes the 80.Nm 81utility to open the device for reading only. 82Currently this option is primarily useful for the 83.Ic show 84command, but the intent 85is to use it to implement dry-run behaviour. 86.Pp 87The 88.Fl v 89option controls the verbosity level. 90The level increases with every occurrence of this option. 91There is no formalized definition of the different levels yet. 92.Ss Commands 93.Bl -tag -width indent 94.\" ==== add ==== 95.It Nm Ic add Oo Fl b Ar number Oc Oo Fl i Ar index Oc Oo Fl s Ar count Oc \ 96Oo Fl t Ar type Oc Ar device ... 97The 98.Ic add 99command allows the user to add a new partition to an existing table. 100By default, it will create a UFS partition covering the first available block 101of an unused disk space. 102The command-specific options can be used to control this behaviour. 103.Pp 104The 105.Fl b Ar number 106option allows the user to specify the starting (beginning) sector number of 107the partition. 108The minimum sector number is 1, but has to fall inside an unused region of 109disk space that is covered by the GPT. 110.Pp 111The 112.Fl i Ar index 113option allows the user to specify which (free) entry in the GPT table is to 114be used for the new partition. 115By default, the first free entry is selected. 116.Pp 117The 118.Fl s Ar count 119option allows the user to specify the size of the partition in sectors. 120The minimum size is 1. 121.Pp 122The 123.Fl t Ar type 124option allows the user to specify the partition type. 125The type is given as an UUID, but 126.Nm 127accepts 128.Cm efi , swap , ufs , hfs , linux , 129.Cm raid , lfs , ccd , cgd , bios , 130.Cm ffs , 131and 132.Cm windows 133as aliases for the most commonly used partition types. 134.\" ==== biosboot ==== 135.It Nm Ic biosboot Oo Fl c Ar bootcode Oc Oo Fl i Ar index Oc Ar device ... 136The 137.Ic biosboot 138command allows the user to configure the partition that contains the 139primary bootstrap program, used during 140.Xr boot 8 . 141.Pp 142The 143.Fl c 144option allows the user to specify the filename that 145.Nm 146should read the bootcode from. 147The default is to read from 148.Pa /usr/mdec/mbr_gpt . 149.Pp 150The 151.Fl i 152option selects the partition that should contain the primary 153bootstrap code, as installed via 154.Xr installboot 8 . 155.\" ==== create ==== 156.It Nm Ic create Oo Fl fp Oc Ar device ... 157The 158.Ic create 159command allows the user to create a new (empty) GPT. 160By default, one cannot create a GPT when the device contains a MBR, 161however this can be overridden with the 162.Fl f 163option. 164If the 165.Fl f 166option is specified, an existing MBR is destroyed and any partitions 167described by the MBR are lost. 168.Pp 169The 170.Fl p 171option tells 172.Nm 173to create only the primary table and not the backup table. 174This option is only useful for debugging and should not be used otherwise. 175.\" ==== destroy ==== 176.It Nm Ic destroy Oo Fl r Oc Ar device ... 177The 178.Ic destroy 179command allows the user to destroy an existing, possibly not empty GPT. 180.Pp 181The 182.Fl r 183option instructs 184.Nm 185to destroy the table in a way that it can be recovered. 186.\" ==== label ==== 187.It Nm Ic label Oo Fl a Oc Ao Fl f Ar file | Fl l Ar label Ac Ar device ... 188.It Nm Ic label Oo Fl b Ar number Oc Oo Fl i Ar index Oc \ 189Oo Fl s Ar count Oc Oo Fl t Ar type Oc \ 190Ao Fl f Ar file | Fl l Ar label Ac Ar device ... 191The 192.Ic label 193command allows the user to label any partitions that match the selection. 194At least one of the following selection options must be specified. 195.Pp 196The 197.Fl a 198option specifies that all partitions should be labeled. 199It is mutually exclusive with all other selection options. 200.Pp 201The 202.Fl b Ar number 203option selects the partition that starts at the given block number. 204.Pp 205The 206.Fl i Ar index 207option selects the partition with the given partition number. 208.Pp 209The 210.Fl s Ar count 211option selects all partitions that have the given size. 212This can cause multiple partitions to be removed. 213.Pp 214The 215.Fl t Ar type 216option selects all partitions that have the given type. 217The type is given as an UUID or by the aliases that the 218.Ic add 219command accepts. 220This can cause multiple partitions to be removed. 221.Pp 222The 223.Fl f Ar file 224or 225.Fl l Ar label 226options specify the new label to be assigned to the selected partitions. 227The 228.Fl f Ar file 229option is used to read the label from the specified file. 230Only the first line is read from the file and the trailing newline 231character is stripped. 232If the file name is the dash or minus sign 233.Pq Fl , 234the label is read from 235the standard input. 236The 237.Fl l Ar label 238option is used to specify the label in the command line. 239The label is assumed to be encoded in UTF-8. 240.\" ==== migrate ==== 241.It Nm Ic migrate Oo Fl fs Oc Ar device ... 242The 243.Ic migrate 244command allows the user to migrate an MBR-based disk partitioning into a 245GPT-based partitioning. 246By default, the MBR is not migrated when it contains partitions of an unknown 247type. 248This can be overridden with the 249.Fl f 250option. 251Specifying the 252.Fl f 253option will cause unknown partitions to be ignored and any data in it 254to be lost. 255.Pp 256The 257.Fl s 258option prevents migrating 259.Bx 260disk labels into GPT partitions by creating 261the GPT equivalent of a slice. 262.\" ==== remove ==== 263.It Nm Ic remove Oo Fl a Oc Ar device ... 264.It Nm Ic remove Oo Fl b Ar number Oc Oo Fl i Ar index Oc \ 265Oo Fl s Ar count Oc Oo Fl t Ar type Oc Ar device ... 266The 267.Ic remove 268command allows the user to remove any and all partitions that match the 269selection. 270It uses the same selection options as the 271.Ic label 272command. 273See above for a description of these options. 274Partitions are removed by clearing the partition type. 275No other information is changed. 276.\" ==== show ==== 277.It Nm Ic show Oo Fl lu Oc Ar device ... 278The 279.Ic show 280command displays the current partitioning on the listed devices and gives 281an overall view of the disk contents. 282With the 283.Fl l 284option the GPT partition label will be displayed instead of the GPT partition 285type. 286The option has no effect on non-GPT partitions. 287With the 288.Fl u 289option the GPT partition type is displayed as an UUID instead of in a 290user friendly form. 291The 292.Fl l 293option takes precedence over the 294.Fl u 295option. 296.El 297.Sh SEE ALSO 298.Xr boot 8 , 299.Xr fdisk 8 , 300.Xr installboot 8 , 301.Xr mount 8 , 302.Xr newfs 8 , 303.Xr swapon 8 304.Sh HISTORY 305The 306.Nm 307utility appeared in 308.Fx 5.0 309for ia64. 310.Sh BUGS 311The development of the 312.Nm 313utility is still work in progress. 314Many necessary features are missing or partially implemented. 315In practice this means that the manual page, supposed to describe these 316features, is farther removed from being complete or useful. 317As such, missing functionality is not even documented as missing. 318However, it is believed that the currently present functionality is reliable 319and stable enough that this tool can be used without bullet-proof footware if 320one thinks one does not make mistakes. 321.Pp 322It is expected that the basic usage model does not change, but it is 323possible that future versions will not be compatible in the strictest sense 324of the word. 325For example, the 326.Fl p Ar count 327option may be changed to a command option rather than a generic option. 328There are only two commands that use it so there is a chance that the natural 329tendency for people is to use it as a command option. 330Also, options primarily intended for diagnostic or debug purposes may be 331removed in future versions. 332.Pp 333Another possibility is that the current usage model is accompanied by 334other interfaces to make the tool usable as a back-end. 335This all depends on demand and thus feedback. 336