1.\" $NetBSD: gpt.8,v 1.6 2011/02/09 05:11:15 schnoebe 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 June 22, 2006 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.\" ==== create ==== 135.It Nm Ic create Oo Fl fp Oc Ar device ... 136The 137.Ic create 138command allows the user to create a new (empty) GPT. 139By default, one cannot create a GPT when the device contains a MBR, 140however this can be overridden with the 141.Fl f 142option. 143If the 144.Fl f 145option is specified, an existing MBR is destroyed and any partitions 146described by the MBR are lost. 147.Pp 148The 149.Fl p 150option tells 151.Nm 152to create only the primary table and not the backup table. 153This option is only useful for debugging and should not be used otherwise. 154.\" ==== destroy ==== 155.It Nm Ic destroy Oo Fl r Oc Ar device ... 156The 157.Ic destroy 158command allows the user to destroy an existing, possibly not empty GPT. 159.Pp 160The 161.Fl r 162option instructs 163.Nm 164to destroy the table in a way that it can be recovered. 165.\" ==== label ==== 166.It Nm Ic label Oo Fl a Oc Ao Fl f Ar file | Fl l Ar label Ac Ar device ... 167.It Nm Ic label Oo Fl b Ar number Oc Oo Fl i Ar index Oc \ 168Oo Fl s Ar count Oc Oo Fl t Ar type Oc \ 169Ao Fl f Ar file | Fl l Ar label Ac Ar device ... 170The 171.Ic label 172command allows the user to label any partitions that match the selection. 173At least one of the following selection options must be specified. 174.Pp 175The 176.Fl a 177option specifies that all partitions should be labeled. 178It is mutually exclusive with all other selection options. 179.Pp 180The 181.Fl b Ar number 182option selects the partition that starts at the given block number. 183.Pp 184The 185.Fl i Ar index 186option selects the partition with the given partition number. 187.Pp 188The 189.Fl s Ar count 190option selects all partitions that have the given size. 191This can cause multiple partitions to be removed. 192.Pp 193The 194.Fl t Ar type 195option selects all partitions that have the given type. 196The type is given as an UUID or by the aliases that the 197.Ic add 198command accepts. 199This can cause multiple partitions to be removed. 200.Pp 201The 202.Fl f Ar file 203or 204.Fl l Ar label 205options specify the new label to be assigned to the selected partitions. 206The 207.Fl f Ar file 208option is used to read the label from the specified file. 209Only the first line is read from the file and the trailing newline 210character is stripped. 211If the file name is the dash or minus sign 212.Pq Fl , 213the label is read from 214the standard input. 215The 216.Fl l Ar label 217option is used to specify the label in the command line. 218The label is assumed to be encoded in UTF-8. 219.\" ==== migrate ==== 220.It Nm Ic migrate Oo Fl fs Oc Ar device ... 221The 222.Ic migrate 223command allows the user to migrate an MBR-based disk partitioning into a 224GPT-based partitioning. 225By default, the MBR is not migrated when it contains partitions of an unknown 226type. 227This can be overridden with the 228.Fl f 229option. 230Specifying the 231.Fl f 232option will cause unknown partitions to be ignored and any data in it 233to be lost. 234.Pp 235The 236.Fl s 237option prevents migrating 238.Bx 239disk labels into GPT partitions by creating 240the GPT equivalent of a slice. 241.\" ==== remove ==== 242.It Nm Ic remove Oo Fl a Oc Ar device ... 243.It Nm Ic remove Oo Fl b Ar number Oc Oo Fl i Ar index Oc \ 244Oo Fl s Ar count Oc Oo Fl t Ar type Oc Ar device ... 245The 246.Ic remove 247command allows the user to remove any and all partitions that match the 248selection. 249It uses the same selection options as the 250.Ic label 251command. 252See above for a description of these options. 253Partitions are removed by clearing the partition type. 254No other information is changed. 255.\" ==== show ==== 256.It Nm Ic show Oo Fl lu Oc Ar device ... 257The 258.Ic show 259command displays the current partitioning on the listed devices and gives 260an overall view of the disk contents. 261With the 262.Fl l 263option the GPT partition label will be displayed instead of the GPT partition 264type. 265The option has no effect on non-GPT partitions. 266With the 267.Fl u 268option the GPT partition type is displayed as an UUID instead of in a 269user friendly form. 270The 271.Fl l 272option takes precedence over the 273.Fl u 274option. 275.El 276.Sh SEE ALSO 277.Xr fdisk 8 , 278.Xr mount 8 , 279.Xr newfs 8 , 280.Xr swapon 8 281.Sh HISTORY 282The 283.Nm 284utility appeared in 285.Fx 5.0 286for ia64. 287.Sh BUGS 288The development of the 289.Nm 290utility is still work in progress. 291Many necessary features are missing or partially implemented. 292In practice this means that the manual page, supposed to describe these 293features, is farther removed from being complete or useful. 294As such, missing functionality is not even documented as missing. 295However, it is believed that the currently present functionality is reliable 296and stable enough that this tool can be used without bullet-proof footware if 297one thinks one does not make mistakes. 298.Pp 299It is expected that the basic usage model does not change, but it is 300possible that future versions will not be compatible in the strictest sense 301of the word. 302For example, the 303.Fl p Ar count 304option may be changed to a command option rather than a generic option. 305There are only two commands that use it so there is a chance that the natural 306tendency for people is to use it as a command option. 307Also, options primarily intended for diagnostic or debug purposes may be 308removed in future versions. 309.Pp 310Another possibility is that the current usage model is accompanied by 311other interfaces to make the tool usable as a back-end. 312This all depends on demand and thus feedback. 313