partx
TLDR
List the partitions on a block device or disk image
SYNOPSIS
partx [-a | -d | -s | -u] [-t type] [-n M:N] [-] disk
partx [-a | -d | -s | -u] [-t type] partition [disk]
DESCRIPTION
partx tells the Linux kernel about the presence and numbering of on-disk partitions. It parses a partition table and updates the kernel's in-memory representation without modifying the disk. This is useful when partitions have been added or removed while the disk was in use.
The tool can read partition tables from both block devices and disk image files. It supports multiple partition table formats including DOS/MBR, GPT, BSD, and others.
PARAMETERS
-a, --add
Add specified partitions to the kernel-d, --delete
Delete specified partitions from the kernel-s, --show
List partitions (default if no action specified)-l, --list
Same as --show (list partitions)-u, --update
Update specified partitions-n, --nr M:N
Specify range of partitions (M to N)-t, --type type
Specify partition table type (dos, gpt, etc.)-o, --output list
Define which columns to show-g, --noheadings
Do not print headings-b, --bytes
Print sizes in bytes-r, --raw
Use raw output format-v, --verbose
Verbose mode
CAVEATS
Requires root privileges. Modifying kernel partition state for mounted filesystems can be dangerous. The -d option only removes partition entries from the kernel; it does not modify the actual partition table on disk. Use partprobe as an alternative for simpler use cases.
HISTORY
Part of util-linux, the standard Linux utility collection. Provides lower-level control over kernel partition awareness compared to partprobe, which is typically sufficient for most use cases.


