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