2 .\" Copyright 2007 Karel Zak <kzak@redhat.com>
3 .\" Copyright 2007 Red Hat, Inc.
4 .\" Copyright 2010 Davidlohr Bueso <dave@gnu.org>
5 .\" May be distributed under the GNU General Public License
6 .TH PARTX "8" "June 2012" "util-linux" "System Administration"
8 partx \- tell the Linux kernel about the presence and numbering of on-disk partitions
10 partx [\-a | \-d | \-s | \-u] [\-t TYPE] [\-n M:N] [\-] disk
12 partx [\-a | \-d | \-s | \-u] [\-t TYPE] partition [disk]
14 Given a device or disk-image,
16 tries to parse the partition table and list its contents. It
17 optionally adds or removes partitions.
21 argument is optional when a
23 argument is provided. To force scanning a partition as if it were a whole disk
24 (for example to list nested subpartitions), use the argument "\-" (hyphen-minus). For example:
28 partx \-\-show \- /dev/sda3
31 This will see sda3 as a whole-disk rather than a partition.
34 .B partx is not an fdisk program
35 \(en adding and removing partitions does not change the disk, it just
36 tells the kernel about the presence and numbering of on-disk
39 .IP "\fB\-a\fR, \fB\-\-add\fP"
40 Add the specified partitions, or read the disk and add all partitions.
41 .IP "\fB\-b\fR, \fB\-\-bytes\fP"
42 Print the SIZE column in bytes rather than in human-readable format.
43 .IP "\fB\-d\fR, \fB\-\-delete\fP"
44 Delete the specified partitions or all partitions.
45 .IP "\fB\-u\fR, \fB\-\-update\fP"
46 Update the specified partitions.
47 .IP "\fB\-g\fR, \fB\-\-noheadings\fP"
48 Do not print a header line.
49 .IP "\fB\-h\fR, \fB\-\-help\fP"
50 Display help text and exit.
51 .IP "\fB\-l\fR, \fB\-\-list\fP"
52 List the partitions. Note that all numbers are in 512-byte sectors.
53 This output format is DEPRECATED in favour of
55 Do not use it in newly written scripts.
56 .IP "\fB\-o\fR, \fB\-\-output \fIlist\fP"
57 Define the output columns to use for
61 output. If no output arrangement is specified, then a default set is
66 of all supported columns. This option cannot be combined with
72 .IP "\fB\-P\fR, \fB\-\-pairs\fP"
73 Output using key="value" format.
74 .IP "\fB\-n\fR, \fB\-\-nr \fIM:N\fP"
75 Specify the range of partitions. For backward compatibility also the
78 is supported. The range may contain negative numbers, for example
80 means the last partition, and
82 means the last two partitions. Supported range specifications are:
86 Specifies just one partition (e.g.\& \fB\-\-nr\fR
90 Specifies lower limit only (e.g.\& \fB\-\-nr\fR
94 Specifies upper limit only (e.g.\& \fB\-\-nr\fR
100 Specifies lower and upper limits (e.g.\& \fB\-\-nr\fR
103 .IP "\fB\-r\fR, \fB\-\-raw\fP"
104 Use the raw output format.
105 .IP "\fB\-s\fR, \fB\-\-show\fP"
106 List the partitions. All numbers (except SIZE) are in 512-byte
107 sectors. The output columns can be rearranged with the
110 .IP "\fB\-t\fR, \fB\-\-type \fItype\fP"
111 Specify the partition table type
124 .IP "\fB\-v\fR, \fB\-\-verbose\fP"
128 partx \-\-show /dev/sdb3
130 partx \-\-show \-\-nr 3 /dev/sdb
132 partx \-\-show /dev/sdb3 /dev/sdb
133 All three commands list partition 3 of /dev/sdb.
135 partx \-\-show \- /dev/sdb3
136 Lists all subpartitions on /dev/sdb3 (the device is used as
139 partx \-o START \-g \-\-nr 5 /dev/sdb
140 Prints the start sector of partition 5 on /dev/sdb without header.
142 partx \-o SECTORS,SIZE /dev/sda5 /dev/sda
143 Lists the length in sectors and human-readable size of partition 5 on
146 partx \-\-add \-\-nr 3:5 /dev/sdd
147 Adds all available partitions from 3 to 5 (inclusive) on /dev/sdd.
149 partx \-d \-\-nr :\-1 /dev/sdd
150 Removes the last partition on /dev/sdd.
166 The original version was written by
171 .IP LIBBLKID_DEBUG=0xffff
172 enables debug output.
174 The partx command is part of the util-linux package and is available from
175 .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/