GPT(8) | System Manager's Manual | GPT(8) |
gpt | [general_options] command [command_options] device ... |
The -p partitions option allows the user to change the 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 causes the gpt utility to open the device for reading only. Currently this option is primarily useful for the show command, but the intent is to use it to implement dry-run behaviour.
The -v option controls the verbosity level. The level increases with every occurrence of this option. There is no formalized definition of the different levels yet.
The -a alignment option allows the user to specify an alignment for the start and size. The alignment 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. 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 efi, swap, ufs, hfs, linux, raid, lfs, ccd, cgd, bios, ffs, and windows as aliases for the most commonly used partition types.
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 -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 -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 -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 -s option prevents migrating BSD disk labels into GPT partitions by creating the GPT equivalent of a slice. Note that the -s option isn't applicable to NetBSD partitions.
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 don't 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.
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 Partition added, use: dkctl rwd3d addwedge dk<N> 34 10486224 <type> to create a wedge for it nas# gpt label -i 1 -l swap_1 wd3 parition 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#
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. For example, the -p partitions option may be changed to a command option rather than a generic option. There are only two commands that use it so there is a chance that the natural tendency for people is to use it as a command option. 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.
December 19, 2013 | NetBSD 6.99 |