{
    "mode": "man",
    "parameter": "partx",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/partx/8/json",
    "generated": "2026-05-30T07:08:46Z",
    "synopsis": "partx [-a|-d|-P|-r|-s|-u] [-t type] [-n M:N] [-] disk\npartx [-a|-d|-P|-r|-s|-u] [-t type] partition [disk]",
    "sections": {
        "NAME": {
            "content": "partx - tell the kernel about the presence and numbering of on-disk partitions\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "partx [-a|-d|-P|-r|-s|-u] [-t type] [-n M:N] [-] disk\n\npartx [-a|-d|-P|-r|-s|-u] [-t type] partition [disk]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Given a device or disk-image, partx tries to parse the partition table and list its contents.\nIt can also tell the kernel to add or remove partitions from its bookkeeping.\n\nThe disk argument is optional when a partition argument is provided. To force scanning a\npartition as if it were a whole disk (for example to list nested subpartitions), use the\nargument \"-\" (hyphen-minus). For example:\n\npartx --show - /dev/sda3\n\nThis will see sda3 as a whole-disk rather than as a partition.\n\npartx is not an fdisk program - adding and removing partitions does not change the disk, it\njust tells the kernel about the presence and numbering of on-disk partitions.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-a --add",
                    "content": "Add the specified partitions, or read the disk and add all partitions.\n",
                    "flag": "-a",
                    "long": "--add"
                },
                {
                    "name": "-b --bytes",
                    "content": "Print the SIZE column in bytes rather than in human-readable format.\n",
                    "flag": "-b",
                    "long": "--bytes"
                },
                {
                    "name": "-d --delete",
                    "content": "Delete the specified partitions or all partitions. It is not error to remove non-existing\npartitions, so this option is possible to use together with large --nr ranges without\ncare about the current partitions set on the device.\n",
                    "flag": "-d",
                    "long": "--delete"
                },
                {
                    "name": "-g --noheadings",
                    "content": "Do not print a header line with --show or --raw.\n",
                    "flag": "-g",
                    "long": "--noheadings"
                },
                {
                    "name": "-l --list",
                    "content": "List the partitions. Note that all numbers are in 512-byte sectors. This output format is\nDEPRECATED in favour of --show. Do not use it in newly written scripts.\n",
                    "flag": "-l",
                    "long": "--list"
                },
                {
                    "name": "-n --nr",
                    "content": "Specify the range of partitions. For backward compatibility also the format M-N is\nsupported. The range may contain negative numbers, for example --nr -1:-1 means the last\npartition, and --nr -2:-1 means the last two partitions. Supported range specifications\nare:\n\nM\nSpecifies just one partition (e.g. --nr 3).\n\nM:\nSpecifies the lower limit only (e.g. --nr 2:).\n\n:N\nSpecifies the upper limit only (e.g. --nr :4).\n\nM:N\nSpecifies the lower and upper limits (e.g. --nr 2:4).\n",
                    "flag": "-n",
                    "long": "--nr"
                },
                {
                    "name": "-o --output",
                    "content": "Define the output columns to use for --show, --pairs and --raw output. If no output\narrangement is specified, then a default set is used. Use --help to get list of all\nsupported columns. This option cannot be combined with the --add, --delete, --update or\n--list options.\n",
                    "flag": "-o",
                    "long": "--output"
                },
                {
                    "name": "--output-all",
                    "content": "Output all available columns.\n",
                    "long": "--output-all"
                },
                {
                    "name": "-P --pairs",
                    "content": "List the partitions using the KEY=\"value\" format.\n",
                    "flag": "-P",
                    "long": "--pairs"
                },
                {
                    "name": "-r --raw",
                    "content": "List the partitions using the raw output format.\n",
                    "flag": "-r",
                    "long": "--raw"
                },
                {
                    "name": "-s --show",
                    "content": "List the partitions. The output columns can be selected and rearranged with the --output\noption. All numbers (except SIZE) are in 512-byte sectors.\n",
                    "flag": "-s",
                    "long": "--show"
                },
                {
                    "name": "-t --type",
                    "content": "Specify the partition table type.\n",
                    "flag": "-t",
                    "long": "--type"
                },
                {
                    "name": "--list-types",
                    "content": "List supported partition types and exit.\n",
                    "long": "--list-types"
                },
                {
                    "name": "-u --update",
                    "content": "Update the specified partitions.\n",
                    "flag": "-u",
                    "long": "--update"
                },
                {
                    "name": "-S --sector-size",
                    "content": "Overwrite default sector size.\n",
                    "flag": "-S",
                    "long": "--sector-size"
                },
                {
                    "name": "-v --verbose",
                    "content": "Verbose mode.\n",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "-V --version",
                    "content": "Display version information and exit.\n",
                    "flag": "-V",
                    "long": "--version"
                },
                {
                    "name": "-h --help",
                    "content": "Display help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                }
            ]
        },
        "ENVIRONMENT": {
            "content": "LIBBLKIDDEBUG=all\nenables libblkid debug output.\n",
            "subsections": []
        },
        "EXAMPLE": {
            "content": "partx --show /dev/sdb3, partx --show --nr 3 /dev/sdb, partx --show /dev/sdb3 /dev/sdb\nAll three commands list partition 3 of /dev/sdb.\n\npartx --show - /dev/sdb3\nLists all subpartitions on /dev/sdb3 (the device is used as whole-disk).\n\npartx -o START -g --nr 5 /dev/sdb\nPrints the start sector of partition 5 on /dev/sdb without header.\n\npartx -o SECTORS,SIZE /dev/sda5 /dev/sda\nLists the length in sectors and human-readable size of partition 5 on /dev/sda.\n\npartx --add --nr 3:5 /dev/sdd\nAdds all available partitions from 3 to 5 (inclusive) on /dev/sdd.\n\npartx -d --nr :-1 /dev/sdd\nRemoves the last partition on /dev/sdd.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Davidlohr Bueso <dave@gnu.org>, Karel Zak <kzak@redhat.com>\n\nThe original version was written by Andries E. Brouwer <aeb@cwi.nl>\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "addpart(8), delpart(8), fdisk(8), parted(8), partprobe(8)\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "For bug reports, use the issue tracker at https://github.com/karelzak/util-linux/issues.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "The partx command is part of the util-linux package which can be downloaded from Linux Kernel\nArchive <https://www.kernel.org/pub/linux/utils/util-linux/>.\n\n\n\nutil-linux 2.37.2                            2021-06-02                                     PARTX(8)",
            "subsections": []
        }
    },
    "summary": "partx - tell the kernel about the presence and numbering of on-disk partitions",
    "flags": [
        {
            "flag": "-a",
            "long": "--add",
            "arg": null,
            "description": "Add the specified partitions, or read the disk and add all partitions."
        },
        {
            "flag": "-b",
            "long": "--bytes",
            "arg": null,
            "description": "Print the SIZE column in bytes rather than in human-readable format."
        },
        {
            "flag": "-d",
            "long": "--delete",
            "arg": null,
            "description": "Delete the specified partitions or all partitions. It is not error to remove non-existing partitions, so this option is possible to use together with large --nr ranges without care about the current partitions set on the device."
        },
        {
            "flag": "-g",
            "long": "--noheadings",
            "arg": null,
            "description": "Do not print a header line with --show or --raw."
        },
        {
            "flag": "-l",
            "long": "--list",
            "arg": null,
            "description": "List the partitions. Note that all numbers are in 512-byte sectors. This output format is DEPRECATED in favour of --show. Do not use it in newly written scripts."
        },
        {
            "flag": "-n",
            "long": "--nr",
            "arg": null,
            "description": "Specify the range of partitions. For backward compatibility also the format M-N is supported. The range may contain negative numbers, for example --nr -1:-1 means the last partition, and --nr -2:-1 means 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)."
        },
        {
            "flag": "-o",
            "long": "--output",
            "arg": null,
            "description": "Define the output columns to use for --show, --pairs and --raw output. If no output arrangement is specified, then a default set is used. Use --help to get list of all supported columns. This option cannot be combined with the --add, --delete, --update or --list options."
        },
        {
            "flag": "",
            "long": "--output-all",
            "arg": null,
            "description": "Output all available columns."
        },
        {
            "flag": "-P",
            "long": "--pairs",
            "arg": null,
            "description": "List the partitions using the KEY=\"value\" format."
        },
        {
            "flag": "-r",
            "long": "--raw",
            "arg": null,
            "description": "List the partitions using the raw output format."
        },
        {
            "flag": "-s",
            "long": "--show",
            "arg": null,
            "description": "List the partitions. The output columns can be selected and rearranged with the --output option. All numbers (except SIZE) are in 512-byte sectors."
        },
        {
            "flag": "-t",
            "long": "--type",
            "arg": null,
            "description": "Specify the partition table type."
        },
        {
            "flag": "",
            "long": "--list-types",
            "arg": null,
            "description": "List supported partition types and exit."
        },
        {
            "flag": "-u",
            "long": "--update",
            "arg": null,
            "description": "Update the specified partitions."
        },
        {
            "flag": "-S",
            "long": "--sector-size",
            "arg": null,
            "description": "Overwrite default sector size."
        },
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "Verbose mode."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Display version information and exit."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help text and exit."
        }
    ],
    "examples": [
        "partx --show /dev/sdb3, partx --show --nr 3 /dev/sdb, partx --show /dev/sdb3 /dev/sdb",
        "All three commands list partition 3 of /dev/sdb.",
        "partx --show - /dev/sdb3",
        "Lists all subpartitions on /dev/sdb3 (the device is used as whole-disk).",
        "partx -o START -g --nr 5 /dev/sdb",
        "Prints the start sector of partition 5 on /dev/sdb without header.",
        "partx -o SECTORS,SIZE /dev/sda5 /dev/sda",
        "Lists the length in sectors and human-readable size of partition 5 on /dev/sda.",
        "partx --add --nr 3:5 /dev/sdd",
        "Adds all available partitions from 3 to 5 (inclusive) on /dev/sdd.",
        "partx -d --nr :-1 /dev/sdd",
        "Removes the last partition on /dev/sdd."
    ],
    "see_also": [
        {
            "name": "addpart",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/addpart/8/json"
        },
        {
            "name": "delpart",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/delpart/8/json"
        },
        {
            "name": "fdisk",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/fdisk/8/json"
        },
        {
            "name": "parted",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/parted/8/json"
        },
        {
            "name": "partprobe",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/partprobe/8/json"
        }
    ]
}