1 .\" Copyright (c) 2002 Marcel Moolenaar
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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.
25 .\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $
27 .Dd September 28, 2009
32 .Nd "GUID partition table maintenance utility"
35 .Op Ar general_options
37 .Op Ar command_options
42 utility provides the necessary functionality to manipulate GUID partition
43 tables (GPTs), but see
45 below for how and where functionality is missing.
46 GPT partitions are accessed as
48 disk slices, with same number as GPT partition,
49 127 slices per disk device are supported.
50 The basic usage model of the
52 tool follows that of the
55 The general options are described in the following paragraph.
56 The remaining paragraphs describe the individual commands with their options.
57 Here we conclude by mentioning that a
59 is either a special file
60 corresponding to a disk-like device or a regular file.
61 The command is applied to each
63 listed on the command line.
65 The general options allow the user to change default settings or otherwise
66 change the behaviour that is applicable to all commands.
67 Not all commands use all default settings, so some general options may not
68 have an effect on all commands.
72 option allows the user to change the number of partitions the GPT can
74 This is used whenever a new GPT is created.
77 utility will create space for 128 partitions (or 32 sectors of 512 bytes).
83 utility to open the device for reading only.
84 Currently this option is primarily useful for the
86 command, but the intent
87 is to use it to implement dry-run behaviour.
91 option controls the verbosity level.
92 The level increases with every occurrence of this option.
93 There is no formalized definition of the different levels yet.
95 .Bl -tag -width indent
108 command allows the user to add a new partition to an existing table,
109 the name of the disk slice for the added partition is printed.
110 By default, it will create a
112 partition covering the first available block
113 of an unused disk space.
114 The command-specific options can be used to control this behaviour.
118 option allows the user to specify the starting (beginning) sector number of
120 The minimum sector number is 1, but has to fall inside an unused region of
121 disk space that is covered by the GPT.
125 option allows the user to specify which (free) entry in the GPT table is to
126 be used for the new partition.
127 By default, the first free entry is selected.
128 Entries start at index 0 representing partition 0 of the GPT.
132 option allows the user to specify the size of the partition in sectors.
133 The minimum size is 1.
137 option allows the user to specify the partition type.
138 The type is given as an UUID, but
141 .Cm efi , swap , ufs , hfs , linux , dfly ,
144 as aliases for the most commonly used partition types.
156 You may also specify any symbolic name in the system
161 If you don't specify a beginning sector with
163 , the new partition will be aligned to 1MiB in size and position
164 (in case of 512 byte sector sizes).
166 .It Nm Ic boot Ar device ...
169 command allows the user to create a small boot partition in a freshly
172 This command creates a small, 1GB boot partition as partition #0
173 and hacks in a special
175 in the PMBR which aliases it.
176 The PMBR is further modified to add the necessary boot code.
177 You can then disklabel GPT partition #0 and mount it, placing the contents of
180 You must add a line to
183 .Bd -literal -offset indent
184 vfs.root.mountfrom="ufs:da1s1a"
187 which point to the actual root mount.
189 Your root partition may be another GPT partition and you may use a 64 bit
190 disklabel within that partition if you desire.
194 boot manager is used, it can be manipulated with the
198 option usually needs to be set.
201 A disk setup with the
203 command may not be shared with another OS,
204 as it doesn't use a fully standard GPT.
207 Some BIOSes may not be able to deal with this hack, your mileage may vary.
209 .It Nm Ic create Oo Fl fp Oc Ar device ...
212 command allows the user to create a new (empty) GPT.
213 By default, one cannot create a GPT when the device contains a MBR,
214 however this can be overridden with the
219 option is specified, an existing MBR is destroyed and any partitions
220 described by the MBR are lost.
226 to create only the primary table and not the backup table.
227 This option is only useful for debugging and should not be used otherwise.
228 .\" ==== destroy ====
229 .It Nm Ic destroy Oo Fl r Oc Ar device ...
232 command allows the user to destroy an existing, possibly not empty GPT.
238 to destroy the table in a way that it can be recovered.
244 .Aq Fl f Ar file | Fl l Ar label
254 .Aq Fl f Ar file | Fl l Ar label
259 command allows the user to label any partitions that match the selection.
260 At least one of the following selection options must be specified.
264 option specifies that all partitions should be labeled.
265 It is mutually exclusive with all other selection options.
269 option selects the partition that starts at the given block number.
273 option selects the partition with the given partition number.
274 Partition numbers start at 0.
278 option selects all partitions that have the given size.
279 This can cause multiple partitions to be removed.
283 option selects all partitions that have the given type.
284 The type is given as an UUID or by the aliases that the
287 This can cause multiple partitions to be removed.
293 options specify the new label to be assigned to the selected partitions.
296 option is used to read the label from the specified file.
297 Only the first line is read from the file and the trailing newline
298 character is stripped.
299 If the file name is the dash or minus sign
301 the label is read from
305 option is used to specify the label in the command line.
306 The label is assumed to be encoded in UTF-8.
307 .\" ==== migrate ====
308 .It Nm Ic migrate Oo Fl fs Oc Ar device ...
311 command allows the user to migrate an MBR-based disk partitioning into a
312 GPT-based partitioning.
313 By default, the MBR is not migrated when it contains partitions of an unknown
315 This can be overridden with the
320 option will cause unknown partitions to be ignored and any data in it
325 option prevents migrating
327 disk labels into GPT partitions by creating
328 the GPT equivalent of a slice.
330 .It Nm Ic remove Oo Fl a Oc Ar device ...
342 command allows the user to remove any and all partitions that match the
344 It uses the same selection options as the
347 See above for a description of these options.
348 Partitions are removed by clearing the partition type.
349 No other information is changed.
351 .It Nm Ic show Oo Fl lu Oc Ar device ...
354 command displays the current partitioning on the listed devices and gives
355 an overall view of the disk contents.
358 option the GPT partition label will be displayed instead of the GPT partition
360 The option has no effect on non-GPT partitions.
363 option the GPT partition type is displayed as an UUID instead of in a
367 option takes precedence over the
372 .Bl -tag -width ".Pa /etc/defaults/uuids"
377 .It Pa /etc/defaults/uuids
379 and their symbolic names provided by the OS vendor.
382 and their symbolic names provided by the system administrator.
385 To install an empty GPT on
390 GPT partitions are defined in number of sectors, the sector size is usually 512B,
391 which is assumed in the examples below, it can be found using:
393 .Dl "gpt -v show ad6"
395 To add a dummy GPT partition 0:
397 .Dl "gpt add -i0 -s16 ad6"
399 You might want to do this to not use slice 0 for data;
400 when GPT is not used on a disk, slice 0 is the compatibility slice,
402 .Dq dangerously dedicated
404 For GPT slice 0 has no special meaning, it is just the first slice on the disk.
406 To add a GPT partition of size approx. 100GB:
408 .Dl "gpt add -s200000000 ad6"
410 This will be GPT partition 1 as it is the first one free,
411 it will be accessible as
413 which is also printed by the command.
415 .Dq DragonFly Label64 ,
416 it will have to be set up by
419 To add GPT partition 5 with type
421 using the remaining free space:
422 .Bd -literal -offset indent
423 gpt add -i5 -t "DragonFly HAMMER" ad6
426 To print the contents of the GPT:
430 To setup a disk using GPT for booting, the steps below can be used.
431 System is copied from an already installed disk,
432 e.g.\& a hard disk or an install CD.
433 This example will setup disk
435 with GPT for booting, using the
440 Any previous data on disk installed to will be deleted.
441 .Bd -literal -offset indent
445 disklabel -B -r -w da1s0 auto
446 disklabel -e da1s0 # add `a: * * 4.2BSD', to add `a' partition
447 # with fstype `4.2BSD' covering whole slice
450 disklabel64 -r -w da1s1 auto
451 disklabel64 -e da1s1 # add `b: 4G * swap', to add `b' partition
452 # with fstype `swap' and size 4GB,
453 # add `a: * * HAMMER', to add `a' partition
454 # with fstype `HAMMER' covering rest of slice
455 newfs_hammer -L ROOT /dev/da1s1a
456 mount_hammer /dev/da1s1a /mnt
460 mount /dev/da1s0a /mnt/boot
462 cpdup / /mnt # copy each file system you need, e.g.
463 cpdup /boot /mnt/boot
465 cpdup /var/tmp /mnt/var/tmp
469 vi etc/fstab # add `/dev/da1s1a / hammer rw',
470 # add `/dev/da1s1b none swap sw',
471 # add `/dev/da1s0a /boot ufs rw 1 1',
472 # delete lines for file systems cpdup'ed above
473 vi boot/loader.conf # add `vfs.root.mountfrom="hammer:da1s1a"'
481 manipulates is part of the EFI standard and is supported by many OSs.
482 GPT uses 64 bits to store number of sectors, this supports very large disks.
483 With the prevalent sector size of 512B this is 8 billion TB.
505 The development of the
507 utility is still work in progress.
508 Many necessary features are missing or partially implemented.
509 In practice this means that the manual page, supposed to describe these
510 features, is farther removed from being complete or useful.
511 As such, missing functionality is not even documented as missing.
512 However, it is believed that the currently present functionality is reliable
513 and stable enough that this tool can be used without bullet-proof footware if
514 one thinks one does not make mistakes.
516 It is expected that the basic usage model does not change, but it is
517 possible that future versions will not be compatible in the strictest sense
521 option may be changed to a command option rather than a generic option.
522 There are only two commands that use it so there is a chance that the natural
523 tendency for people is to use it as a command option.
524 Also, options primarily intended for diagnostic or debug purposes may be
525 removed in future versions.
527 Another possibility is that the current usage model is accompanied by
528 other interfaces to make the tool usable as a back-end.
529 This all depends on demand and thus feedback.
533 command doesn't support