Linux "partx" Command Line Options and Examples
tell the kernel about the presence and numbering of on-disk partitions

Given a device or disk-image, partx tries to parse the partition table and list its contents. It can also tell the kernel to add or remove partitions from its bookkeeping. The disk argument is optional when a partition argument is provided.


Usage:

partx [-a|-d|-P|-r|-s|-u] [-t type] [-n M:N] [-] disk
    partx [-a|-d|-P|-r|-s|-u] [-t type] partition [disk]






Command Line Options:

-a
Add the specified partitions, or read the disk and add all partitions.
partx -a ...
-b
Print the SIZE column in bytes rather than in human-readable format.
partx -b ...
-d
Delete the specified partitions or all partitions.
partx -d ...
-g
Do not print a header line with --show or --raw.
partx -g ...
-l
List the partitions. Note that all numbers are in 512-byte sectors. This output format is DEPRECATEDin favour of --show. Do not use it in newly written scripts.
partx -l ...
-n
Specify the range of partitions. For backward compatibility also the format M-N is supported. Therange may contain negative numbers, for example --nr -1:-1 means the last partition, and --nr -2:-1means the last two partitions. Supported range specifications are:M Specifies just one partition (e.g. --nr 3).M: Specifies the lower limit only (e.g. --nr 2:).:N Specifies the upper limit only (e.g. --nr :4).M:N Specifies the lower and upper limits (e.g. --nr 2:4).
partx -n ...
-o
Define the output columns to use for --show, --pairs and --raw output. If no output arrangement isspecified, then a default set is used. Use --help to get list of all supported columns. This optioncannot be combined with the --add, --delete, --update or --list options.
partx -o ...
-P
List the partitions using the KEY="value" format.
partx -P ...
-r
List the partitions using the raw output format.
partx -r ...
-s
List the partitions. The output columns can be selected and rearranged with the --output option. Allnumbers (except SIZE) are in 512-byte sectors.
partx -s ...
-t
Specify the partition table type.
partx -t ...
--list-types
List supported partition types and exit.
partx --list-types ...
-u
Update the specified partitions.
partx -u ...
-S
Overwrite default sector size.
partx -S ...
-V
Display version information and exit.
partx -V ...
-h
Display help text and exit.EXAMPLESpartx --show /dev/sdb3partx --show --nr 3 /dev/sdbpartx --show /dev/sdb3 /dev/sdbAll three commands list partition 3 of /dev/sdb.partx --show - /dev/sdb3Lists all subpartitions on /dev/sdb3 (the device is used as whole-disk).partx -o START -g --nr 5 /dev/sdbPrints the start sector of partition 5 on /dev/sdb without header.partx -o SECTORS,SIZE /dev/sda5 /dev/sdaLists the length in sectors and human-readable size of partition 5 on /dev/sda.partx --add --nr 3:5 /dev/sddAdds all available partitions from 3 to 5 (inclusive) on /dev/sdd.partx -d --nr :-1 /dev/sddRemoves the last partition on /dev/sdd.
partx -h ...