GPT(8) | System Manager's Manual | GPT(8) |
gpt | [-nrqv] [-m mediasize] [-s sectorsize] [-T timestamp] command [command_options] device |
gpt | set -l |
gpt | unset -l |
gpt | type -l |
The -a alignment option allows the user to specify an alignment for the start and size. The alignment is given in bytes and may have a suffix to indicate its magnitude. gpt will attempt to align the partition.
The -b blocknr 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.
The -i 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.
The -l label option allows the user to specify a label for the partition.
The -s size option allows the user to specify the size of the partition. If there is no suffix, or the suffix is ‘s’ or ‘S’ then size is in sectors, otherwise size is in bytes which must be a multiple of the device's sector size. Accepted suffix units are ‘b’ to denote bytes, ‘k’ to denote kilobytes, ‘m’ to denote megabytes and ‘g’ to denote gigabytes. The minimum size is 1 sector.
The -t type option allows the user to specify the partition type. The type is given as an UUID, but gpt accepts
The -A options sets the PMBR partition active.
The -c option allows the user to specify the filename that gpt should read the bootcode from. The default is to read from /usr/mdec/gptmbr.bin.
The -i option selects the partition that should contain the primary bootstrap code, as installed via installboot(8). The -L option selects the partition by label. If there are multiple partitions with the same label, the first one found will be used.
The -A options sets the PMBR partition active.
The -P option tells gpt to create only the primary table and not the backup table. This option is only useful for debugging and should not be used otherwise.
The -p option changes the default number of partitions the GPT can accommodate. This is used whenever a new GPT is created. By default, the gpt utility will create space for 128 partitions (or 32 sectors of 512 bytes).
The -r option instructs gpt to destroy the table in a way that it can be recovered.
The -a option specifies that all partitions should be labeled. It is mutually exclusive with all other selection options.
The -b blocknr option selects the partition that starts at the given block number.
The -i index option selects the partition with the given partition number.
The -L label option selects all partitions that have the given label. This can cause multiple partitions to be relabeled.
The -s sectors option selects all partitions that have the given size. This can cause multiple partitions to be labeled.
The -t type option selects all partitions that have the given type. The type is given as an UUID or by the aliases that the add command accepts. This can cause multiple partitions to be labeled.
The -f file or -l label options specify the new label to be assigned to the selected partitions. The -f file option is used to read the label from the specified file. Only the first line is read from the file and the trailing newline character is stripped. If the file name is the dash or minus sign (-), the label is read from the standard input. The -l label option is used to specify the label in the command line. The label is assumed to be encoded in UTF-8.
The -A options sets the PMBR partition active.
The -s option prevents migrating BSD disk labels into GPT partitions by creating the GPT equivalent of a slice. Note that the -s option is not applicable to NetBSD partitions.
The -p option changes the default number of partitions the GPT can accommodate. This is used whenever a new GPT is created. By default, the gpt utility will create space for 128 partitions (or 32 sectors of 512 bytes).
The migrate command requires space at the beginning and the end of the device outside any partitions to store the GPTs. Space is required for the GPT header (which takes one sector) and the GPT partition table. See the -p option for the size of the GPT partition table. By default, just about all devices have a minimum of 62 sectors free at the beginning of the device, but do not have any free space at the end. For the default GPT partition table size on a 512 byte sector size device, 33 sectors at the end of the device would need to be freed.
The -s option allows the new size to be specified, otherwise the backup copy will automatically be placed at the current end of the disk. If there is no suffix, or the suffix is ‘s’ or ‘S’ then size is in sectors, otherwise size is in bytes which must be a multiple of the device's sector size. Accepted suffix units are ‘b’ to denote bytes, ‘k’ to denote kilobytes, ‘m’ to denote megabytes and ‘g’ to denote gigabytes. Using the -s option allows you to move the backup copy prior to resizing the medium. This is primarily useful when shrinking the medium.
nas# gpt show wd3 start size index contents 0 1 PMBR 1 3907029167 nas# gpt create wd3 nas# gpt show wd3 start size index contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table 34 3907029101 3907029135 32 Sec GPT table 3907029167 1 Sec GPT header nas# gpt add -s 10486224 -t swap -i 1 wd3 nas# gpt label -i 1 -l swap_1 wd3 partition 1 on rwd3d labeled swap_1 nas# gpt show wd3 start size index contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table 34 10486224 1 GPT part - NetBSD swap 10486258 3896542877 3907029135 32 Sec GPT table 3907029167 1 Sec GPT header nas# gpt show -l wd3 start size index contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table 34 10486224 1 GPT part - "swap_1" 10486258 3896542877 3907029135 32 Sec GPT table 3907029167 1 Sec GPT header nas#
Booting from GPT on an BIOS system. This creates a bootable partition that can be manually installed to. Note that sysinst(8) does not yet properly support this setup.
xotica# gpt create wd1 xotica# gpt add -b 1024 -l bootroot -t ffs -s 1g wd1 /dev/rwd1: Partition 1 added: 49f48d5a-b10e-11dc-b99b-0019d1879648 1024 2097152 xotica ~# dmesg | tail -2 wd1: GPT GUID: 660e0630-0a3f-47c0-bc52-c88bcec79392 dk0 at wd1: "bootroot", 2097152 blocks at 1024, type: ffs xotica# gpt biosboot -L bootroot wd1 xotica# newfs dk0 xotica# installboot /dev/rdk0 /usr/mdec/bootxx_ffsv1 xotica# mount /dev/dk0 /mnt xotica# cp /usr/mdec/boot /mnt
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. Also, options primarily intended for diagnostic or debug purposes may be removed in future versions.
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.
May 1, 2018 | NetBSD 7.2 |