summaryrefslogtreecommitdiffstats
path: root/sbin/gpt/gpt.8
blob: 26a32fb169f6f0591c7eda893493060b64129e72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
.\" Copyright (c) 2002 Marcel Moolenaar
.\" 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 AUTHOR ``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 AUTHOR 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$
.\"
.Dd November 12, 2004
.Os
.Dt GPT 8
.Sh NAME
.Nm gpt
.Nd "GUID partition table maintenance utility"
.Sh SYNOPSIS
.Nm
.Op Ar general_options
.Ar command
.Op Ar command_options
.Ar device ...
.Sh DESCRIPTION
The
.Nm
utility provides the necessary functionality to manipulate GUID partition
tables (GPTs), but see
.Sx BUGS
below for how and where functionality is missing.
The basic usage model of the
.Nm
tool follows that of the
.Xr cvs 1
tool.
The general options are described in the following paragraph.
The remaining paragraphs describe the individual commands with their options.
Here we conclude by mentioning that a
.Ar device
is either a special file
corresponding to a disk-like device or a regular file.
The command is applied to each
.Ar device
listed on the command line.
.Ss General Options
The general options allow the user to change default settings or otherwise
change the behaviour that is applicable to all commands.
Not all commands use all default settings, so some general options may not
have an effect on all commands.
.Pp
The
.Fl p Ar count
option allows the user to change the number of partitions the GPT can
accomodate.
This is used whenever a new GPT is created.
By default, the
.Nm
utility will create space for 128 partitions (or 32 sectors of 512 bytes).
.Pp
The
.Fl r
option causes the
.Nm
utility to open the device for reading only.
Currently this option is primarily useful for the
.Ic show
command, but the intent
is to use it to implement dry-run behaviour.
.Pp
The
.Fl v
option controls the verbosity level.
The level increases with every occurrence of this option.
There is no formalized definition of the different levels yet.
.Ss Commands
.Bl -tag -width indent
.\" ==== add ====
.It Xo
.Nm
.Ic add
.Op Fl b Ar number
.Op Fl i Ar index
.Op Fl s Ar count
.Op Fl t Ar type
.Ar device ...
.Xc
The
.Ic add
command allows the user to add a new partition to an existing table.
By default, it will create a UFS partition covering the first available block
of an unused disk space.
The command-specific options can be used to control this behaviour.
.Pp
The
.Fl b Ar number
option allows the user to specify the starting (beginning) sector number of
the partition.
The minimum sector number is 1, but has to fall inside an unused region of
disk space that is covered by the GPT.
.Pp
The
.Fl i Ar index
option allows the user to specify which (free) entry in the GPT table is to
be used for the new partition.
By default, the first free entry is selected.
.Pp
The
.Fl s Ar count
option allows the user to specify the size of the partition in sectors.
The minimum size is 1.
.Pp
The
.Fl t Ar type
option allows the user to specify the partition type.
The type is given as an UUID, but
.Nm
accepts
.Cm efi , swap , ufs , linux
and
.Cm windows
as aliases for the most commonly used partition types.
.\" ==== create ====
.It Nm Ic create Oo Fl fp Oc Ar device ...
The
.Ic create
command allows the user to create a new (empty) GPT.
By default, one cannot create a GPT when the device contains a MBR,
however this can be overridden with the
.Fl f
option.
If the
.Fl f
option is specified, an existing MBR is destroyed and any partitions
described by the MBR are lost.
.Pp
The
.Fl p
option tells
.Nm
to create only the primary table and not the backup table.
This option is only useful for debugging and should not be used otherwise.
.\" ==== destroy ====
.It Nm Ic destroy Oo Fl r Oc Ar device ...
The
.Ic destroy
command allows the user to destroy an existing, possibly not empty GPT.
.Pp
The
.Fl r
option instructs
.Nm
to destroy the table in a way that it can be recovered.
.\" ==== migrate ====
.It Nm Ic migrate Oo Fl fs Oc Ar device ...
The
.Ic migrate
command allows the user to migrate an MBR-based disk partitioning into a
GPT-based partitioning.
By default, the MBR is not migrated when it contains partitions of an unknown
type.
This can be overridden with the
.Fl f
option.
Specifying the
.Fl f
option will cause unknown partitions to be ignored and any data in it
to be lost.
.Pp
The
.Fl s
option prevents migrating
.Bx
disk labels into GPT partitions by creating
the GPT equivalent of a slice.
.\" ==== remove ====
.It Nm Ic remove Oo Fl a Oc
.It Xo
.Nm
.Ic remove
.Op Fl b Ar number
.Op Fl i Ar index
.Op Fl s Ar count
.Op Fl t Ar type
.Ar device ...
.Xc
The
.Ic remove
command allows the user to remove any partitions that match the selection.
At least one option must be specified.
.Pp
The
.Fl a
option specifies that all partitions should be removed.
It is mutually exclusive with all other options.
.Pp
The
.Fl b Ar number
option selects the partitions that starts at the given number.
.Pp
The
.Fl i Ar index
option selects the partition with the given partition number.
.Pp
The
.Fl s Ar count
option selects all partitions that have the given size.
This can cause multiple partitions to be removed.
.Pp
The
.Fl t Ar type
option selects all partitions that have the given type.
The type is given as an UUID or by the aliases that the
.Ic add
command accepts.
This can cause multiple partitions to be removed.
.\" ==== show ====
.It Nm Ic show Oo Fl lu Oc Ar device ...
The
.Ic show
command displays the current partitioning on the listed devices and gives
an overall view of the disk contents.
With the
.Fl l
option the GPT partition label will be displayed instead of the GPT partition
type.
The option has no effect on non-GPT partitions.
With the
.Fl u
option the GPT partition type is displayed as an UUID instead of in an
user friendly form.
The
.Fl l
option takes precedence over the
.Fl u
option.
.El
.Sh SEE ALSO
.Xr fdisk 8 ,
.Xr mount 8 ,
.Xr newfs 8 ,
.Xr swapon 8
.Sh HISTORY
The
.Nm
utility appeared in
.Fx 5.0
for ia64.
.Sh BUGS
The development of the
.Nm
utility is still work in progress.
Many necessary features are missing or partially implemented.
In practice this means that the manual page, supposed to describe these
features, is farther removed from being complete or useful.
As such, missing functionality is not even documented as missing.
However, it is believed that the currently present functionality is reliable
and stable enough that this tool can be used without bullet-proof footware if
one thinks one does not make mistakes.
.Pp
It is expected that the basic usage model does not change, but it is
possible that future versions will not be compatible in the strictest sense
of the word.
For example, the
.Fl p Ar count
option may be changed to a command option rather than a generic option.
There are only two commands that use it so there is a chance that the natural
tendency for people is to use it as a command option.
Also, options primarily intended for diagnostic or debug purposes may be
removed in future versions.
.Pp
Another possibility is that the current usage model is accompanied by
other interfaces to make the tool usable as a back-end.
This all depends on demand and thus feedback.
OpenPOWER on IntegriCloud