]> git.ipfire.org Git - thirdparty/util-linux.git/blame - disk-utils/partx.8
wipefs: add --lock and LOCK_BLOCK_DEVICE
[thirdparty/util-linux.git] / disk-utils / partx.8
CommitLineData
e04b8124 1.\" partx.8 -- man page for partx
2f2d6528
KZ
2.\" Copyright 2007 Karel Zak <kzak@redhat.com>
3.\" Copyright 2007 Red Hat, Inc.
c4ecaf21 4.\" Copyright 2010 Davidlohr Bueso <dave@gnu.org>
2f2d6528 5.\" May be distributed under the GNU General Public License
7ab71099
BS
6.\"
7.TH PARTX "8" "December 2014" "util-linux" "System Administration"
2f2d6528 8.SH NAME
e04b8124 9partx \- tell the kernel about the presence and numbering of on-disk partitions
2f2d6528 10.SH SYNOPSIS
f49ccec2 11.B partx
e04b8124 12.RB [ \-a | \-d | \-P | \-r | \-s | \-u ]
f49ccec2
BS
13.RB [ \-t " \fItype\fR]"
14.RB [ \-n " \fIM" : \fIN\fR]
15.RB [ \- "] " \fIdisk
957a3eed 16.br
f49ccec2 17.B partx
e04b8124 18.RB [ \-a | \-d | \-P | \-r | \-s | \-u ]
f49ccec2
BS
19.RB [ \-t " \fItype\fR]"
20.IR partition " [" disk ]
2f2d6528 21.SH DESCRIPTION
957a3eed
SK
22Given a device or disk-image,
23.B partx
24tries to parse the partition table and list its contents. It
e04b8124
BS
25can also tell the kernel to add or remove partitions from its
26bookkeeping.
957a3eed 27.PP
c4ecaf21
DB
28The
29.I disk
957a3eed
SK
30argument is optional when a
31.I partition
957bab4e 32argument is provided. To force scanning a partition as if it were a whole disk
e04b8124
BS
33(for example to list nested subpartitions), use the argument "\-" (hyphen-minus).
34For example:
957bab4e 35
957a3eed
SK
36.RS 7
37.TP
38partx \-\-show \- /dev/sda3
c4ecaf21 39.RE
957a3eed 40.PP
e04b8124 41This will see sda3 as a whole-disk rather than as a partition.
957a3eed 42.PP
957a3eed 43.B partx is not an fdisk program
b4261b5e 44\(en adding and removing partitions does not change the disk, it just
957a3eed
SK
45tells the kernel about the presence and numbering of on-disk
46partitions.
2f2d6528 47.SH OPTIONS
7ab71099
BS
48.TP
49.BR \-a , " \-\-add"
3ec49e9e 50Add the specified partitions, or read the disk and add all partitions.
7ab71099
BS
51.TP
52.BR \-b , " \-\-bytes"
3ec49e9e 53Print the SIZE column in bytes rather than in human-readable format.
7ab71099
BS
54.TP
55.BR \-d , " \-\-delete"
5200aa99
KZ
56Delete the specified partitions or all partitions. It is not error to
57remove non-existing partitions, so this option is possible to use together with
58large \fB\-\-nr\fR ranges without care about the current partitions set on
59the device.
7ab71099
BS
60.TP
61.BR \-g , " \-\-noheadings"
e04b8124 62Do not print a header line with \fB\-\-show\fR or \fB\-\-raw\fR.
7ab71099
BS
63.TP
64.BR \-l , " \-\-list"
957a3eed
SK
65List the partitions. Note that all numbers are in 512-byte sectors.
66This output format is DEPRECATED in favour of
67.BR \-\-show .
68Do not use it in newly written scripts.
7ab71099
BS
69.TP
70.BR \-n , " \-\-nr " \fIM : \fIN
71Specify the range of partitions. For backward compatibility also the
72format \fIM\fB\-\fIN\fR is supported.
73The range may contain negative numbers, for example
12d69ae8 74.B \-\-nr \-1:\-1
7ab71099
BS
75means the last partition, and
76.B \-\-nr \-2:\-1
77means the last two partitions. Supported range specifications are:
78.RS 14
79.TP
80.I M
81Specifies just one partition (e.g.\& \fB\-\-nr 3\fR).
82.TP
83.IB M :
84Specifies the lower limit only (e.g.\& \fB\-\-nr 2:\fR).
85.TP
86.BI : N
87Specifies the upper limit only (e.g.\& \fB\-\-nr :4\fR).
88.TP
89.IB M : N
90Specifies the lower and upper limits (e.g.\& \fB\-\-nr 2:4\fR).
91.RE
92.TP
93.BR \-o , " \-\-output " \fIlist
957a3eed 94Define the output columns to use for
08ec8a6f 95.BR \-\-show ,
08ec8a6f 96.B \-\-pairs
e04b8124
BS
97and
98.B \-\-raw
957a3eed
SK
99output. If no output arrangement is specified, then a default set is
100used. Use
101.B \-\-help
102to get
103.I list
7ab71099 104of all supported columns. This option cannot be combined with the
957a3eed 105.BR \-\-add ,
b4261b5e 106.BR \-\-delete ,
0bb7e904 107.B \-\-update
957a3eed
SK
108or
109.B \-\-list
110options.
2f2d6528 111.TP
ba1c9075
SK
112.B \-\-output\-all
113Output all available columns.
114.TP
7ab71099 115.BR \-P , " \-\-pairs"
e04b8124 116List the partitions using the KEY="value" format.
2f2d6528 117.TP
7ab71099 118.BR \-r , " \-\-raw"
e04b8124 119List the partitions using the raw output format.
2f2d6528 120.TP
e04b8124
BS
121.BR \-s , " \-\-show"
122List the partitions.
123The output columns can be selected and rearranged with the
124\fB\-\-output\fR option.
125All numbers (except SIZE) are in 512-byte sectors.
c4ecaf21 126.TP
7ab71099 127.BR \-t , " \-\-type " \fItype
2cdaf94b
SK
128Specify the partition table type.
129.TP
0bb7e904 130.B \-\-list\-types
2cdaf94b 131List supported partition types and exit.
7ab71099
BS
132.TP
133.BR \-u , " \-\-update"
134Update the specified partitions.
135.TP
f8a4a0d4
KZ
136.BR \-S , " \-\-sector\-size " \fIsize
137Overwrite default sector size.
138.TP
7ab71099 139.BR \-v , " \-\-verbose"
8275b732 140Verbose mode.
7ab71099
BS
141.TP
142.BR \-V , " \-\-version"
143Display version information and exit.
144.TP
145.BR \-h , " \-\-help"
146Display help text and exit.
ade04bb8
MK
147.SH ENVIRONMENT
148.IP LIBBLKID_DEBUG=all
149enables libblkid debug output.
bc281b09 150.SH EXAMPLE
957a3eed
SK
151.TP
152partx \-\-show /dev/sdb3
153.TQ
b4261b5e 154partx \-\-show \-\-nr 3 /dev/sdb
957a3eed
SK
155.TQ
156partx \-\-show /dev/sdb3 /dev/sdb
3ec49e9e 157All three commands list partition 3 of /dev/sdb.
957a3eed
SK
158.TP
159partx \-\-show \- /dev/sdb3
160Lists all subpartitions on /dev/sdb3 (the device is used as
161whole-disk).
162.TP
b4261b5e 163partx \-o START \-g \-\-nr 5 /dev/sdb
957a3eed
SK
164Prints the start sector of partition 5 on /dev/sdb without header.
165.TP
166partx \-o SECTORS,SIZE /dev/sda5 /dev/sda
167Lists the length in sectors and human-readable size of partition 5 on
168/dev/sda.
169.TP
b4261b5e 170partx \-\-add \-\-nr 3:5 /dev/sdd
3ec49e9e 171Adds all available partitions from 3 to 5 (inclusive) on /dev/sdd.
957a3eed 172.TP
b4261b5e 173partx \-d \-\-nr :\-1 /dev/sdd
3ec49e9e 174Removes the last partition on /dev/sdd.
a5db2fd6 175.SH AUTHORS
957a3eed
SK
176.MT dave@gnu.org
177Davidlohr Bueso
178.ME
179.br
180.MT kzak@redhat.com
181Karel Zak
182.ME
183.PP
184The original version was written by
185.MT aeb@cwi.nl
b4261b5e 186Andries E.\& Brouwer
957a3eed 187.ME .
ade04bb8
MK
188.SH SEE ALSO
189.BR addpart (8),
190.BR delpart (8),
191.BR fdisk (8),
192.BR parted (8),
193.BR partprobe (8)
86d62711 194.SH AVAILABILITY
601d12fb 195The partx command is part of the util-linux package and is available from
d673b74e 196.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
957a3eed
SK
197Linux Kernel Archive
198.UE .