1PARTX(8) System Administration PARTX(8)
2
3
4
6 partx - tell the kernel about the presence and numbering of on-disk
7 partitions
8
10 partx [-a|-d|-P|-r|-s|-u] [-t type] [-n M:N] [-] disk
11 partx [-a|-d|-P|-r|-s|-u] [-t type] partition [disk]
12
14 Given a device or disk-image, partx tries to parse the partition table
15 and list its contents. It can also tell the kernel to add or remove
16 partitions from its bookkeeping.
17
18 The disk argument is optional when a partition argument is provided.
19 To force scanning a partition as if it were a whole disk (for example
20 to list nested subpartitions), use the argument "-" (hyphen-minus).
21 For example:
22
23
24 partx --show - /dev/sda3
25
26 This will see sda3 as a whole-disk rather than as a partition.
27
28 partx is not an fdisk program – adding and removing partitions does not
29 change the disk, it just tells the kernel about the presence and num‐
30 bering of on-disk partitions.
31
33 -a, --add
34 Add the specified partitions, or read the disk and add all par‐
35 titions.
36
37 -b, --bytes
38 Print the SIZE column in bytes rather than in human-readable
39 format.
40
41 -d, --delete
42 Delete the specified partitions or all partitions. It is not
43 error to remove non-existing partitions, so this option is pos‐
44 sible to use together with large --nr ranges without care about
45 the current partitions set on the device.
46
47 -g, --noheadings
48 Do not print a header line with --show or --raw.
49
50 -l, --list
51 List the partitions. Note that all numbers are in 512-byte sec‐
52 tors. This output format is DEPRECATED in favour of --show. Do
53 not use it in newly written scripts.
54
55 -n, --nr M:N
56 Specify the range of partitions. For backward compatibility
57 also the format M-N is supported. The range may contain nega‐
58 tive numbers, for example --nr -1:-1 means the last partition,
59 and --nr -2:-1 means the last two partitions. Supported range
60 specifications are:
61
62 M Specifies just one partition (e.g. --nr 3).
63
64 M: Specifies the lower limit only (e.g. --nr 2:).
65
66 :N Specifies the upper limit only (e.g. --nr :4).
67
68 M:N Specifies the lower and upper limits (e.g. --nr
69 2:4).
70
71 -o, --output list
72 Define the output columns to use for --show, --pairs and --raw
73 output. If no output arrangement is specified, then a default
74 set is used. Use --help to get list of all supported columns.
75 This option cannot be combined with the --add, --delete,
76 --update or --list options.
77
78 --output-all
79 Output all available columns.
80
81 -P, --pairs
82 List the partitions using the KEY="value" format.
83
84 -r, --raw
85 List the partitions using the raw output format.
86
87 -s, --show
88 List the partitions. The output columns can be selected and
89 rearranged with the --output option. All numbers (except SIZE)
90 are in 512-byte sectors.
91
92 -t, --type type
93 Specify the partition table type.
94
95 --list-types
96 List supported partition types and exit.
97
98 -u, --update
99 Update the specified partitions.
100
101 -S, --sector-size size
102 Overwrite default sector size.
103
104 -v, --verbose
105 Verbose mode.
106
107 -V, --version
108 Display version information and exit.
109
110 -h, --help
111 Display help text and exit.
112
114 LIBBLKID_DEBUG=all
115 enables libblkid debug output.
116
118 partx --show /dev/sdb3
119 partx --show --nr 3 /dev/sdb
120 partx --show /dev/sdb3 /dev/sdb
121 All three commands list partition 3 of /dev/sdb.
122
123 partx --show - /dev/sdb3
124 Lists all subpartitions on /dev/sdb3 (the device is used as
125 whole-disk).
126
127 partx -o START -g --nr 5 /dev/sdb
128 Prints the start sector of partition 5 on /dev/sdb without
129 header.
130
131 partx -o SECTORS,SIZE /dev/sda5 /dev/sda
132 Lists the length in sectors and human-readable size of partition
133 5 on /dev/sda.
134
135 partx --add --nr 3:5 /dev/sdd
136 Adds all available partitions from 3 to 5 (inclusive) on
137 /dev/sdd.
138
139 partx -d --nr :-1 /dev/sdd
140 Removes the last partition on /dev/sdd.
141
143 Davidlohr Bueso ⟨dave@gnu.org⟩
144 Karel Zak ⟨kzak@redhat.com⟩
145
146 The original version was written by Andries E. Brouwer ⟨aeb@cwi.nl⟩.
147
149 addpart(8), delpart(8), fdisk(8), parted(8), partprobe(8)
150
152 The partx command is part of the util-linux package and is available
153 from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
154 linux/⟩.
155
156
157
158util-linux December 2014 PARTX(8)