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