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