summaryrefslogtreecommitdiffstats
path: root/disk-utils/partx.8
blob: e70d1fae1a8b524d2ac3f00e6c10284903c8f013 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
.\" partx.8 -- man page for partx
.\" Copyright 2007 Karel Zak <kzak@redhat.com>
.\" Copyright 2007 Red Hat, Inc.
.\" Copyright 2010 Davidlohr Bueso <dave@gnu.org>
.\" May be distributed under the GNU General Public License
.\"
.TH PARTX "8" "December 2014" "util-linux" "System Administration"
.SH NAME
partx \- tell the kernel about the presence and numbering of on-disk partitions
.SH SYNOPSIS
.B partx
.RB [ \-a | \-d | \-P | \-r | \-s | \-u ]
.RB [ \-t " \fItype\fR]"
.RB [ \-n " \fIM" : \fIN\fR]
.RB [ \- "] " \fIdisk
.br
.B partx
.RB [ \-a | \-d | \-P | \-r | \-s | \-u ]
.RB [ \-t " \fItype\fR]"
.IR partition " [" disk ]
.SH DESCRIPTION
Given a device or disk-image,
.B partx
tries to parse the partition table and list its contents.  It
can also tell the kernel to add or remove partitions from its
bookkeeping.
.PP
The
.I disk
argument is optional when a
.I partition
argument is provided.  To force scanning a partition as if it were a whole disk
(for example to list nested subpartitions), use the argument "\-" (hyphen-minus).
For example:

.RS 7
.TP
partx \-\-show \- /dev/sda3
.RE
.PP
This will see sda3 as a whole-disk rather than as a partition.
.PP
.B partx is not an fdisk program
\(en adding and removing partitions does not change the disk, it just
tells the kernel about the presence and numbering of on-disk
partitions.
.SH OPTIONS
.TP
.BR \-a , " \-\-add"
Add the specified partitions, or read the disk and add all partitions.
.TP
.BR \-b , " \-\-bytes"
Print the SIZE column in bytes rather than in human-readable format.
.TP
.BR \-d , " \-\-delete"
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 \fB\-\-nr\fR ranges without care about the current partitions set on
the device.
.TP
.BR \-g , " \-\-noheadings"
Do not print a header line with \fB\-\-show\fR or \fB\-\-raw\fR.
.TP
.BR \-l , " \-\-list"
List the partitions.  Note that all numbers are in 512-byte sectors.
This output format is DEPRECATED in favour of
.BR \-\-show .
Do not use it in newly written scripts.
.TP
.BR \-n , " \-\-nr " \fIM : \fIN
Specify the range of partitions.  For backward compatibility also the
format \fIM\fB\-\fIN\fR is supported.
The range may contain negative numbers, for example
.B \-\-nr \-1:\-1
means the last partition, and
.B \-\-nr \-2:\-1
means the last two partitions.  Supported range specifications are:
.RS 14
.TP
.I M
Specifies just one partition (e.g.\& \fB\-\-nr 3\fR).
.TP
.IB M :
Specifies the lower limit only (e.g.\& \fB\-\-nr 2:\fR).
.TP
.BI : N
Specifies the upper limit only (e.g.\& \fB\-\-nr :4\fR).
.TP
.IB M : N
Specifies the lower and upper limits (e.g.\& \fB\-\-nr 2:4\fR).
.RE
.TP
.BR \-o , " \-\-output " \fIlist
Define the output columns to use for
.BR \-\-show ,
.B \-\-pairs
and
.B \-\-raw
output.  If no output arrangement is specified, then a default set is
used.  Use
.B \-\-help
to get
.I list
of all supported columns.  This option cannot be combined with the
.BR \-\-add ,
.BR \-\-delete ,
.B \-\-update
or
.B \-\-list
options.
.TP
.B \-\-output\-all
Output all available columns.
.TP
.BR \-P , " \-\-pairs"
List the partitions using the KEY="value" format.
.TP
.BR \-r , " \-\-raw"
List the partitions using the raw output format.
.TP
.BR \-s , " \-\-show"
List the partitions.
The output columns can be selected and rearranged with the
\fB\-\-output\fR option.
All numbers (except SIZE) are in 512-byte sectors.
.TP
.BR \-t , " \-\-type " \fItype
Specify the partition table type.
.TP
.B \-\-list\-types
List supported partition types and exit.
.TP
.BR \-u , " \-\-update"
Update the specified partitions.
.TP
.BR \-S , " \-\-sector\-size " \fIsize
Overwrite default sector size.
.TP
.BR \-v , " \-\-verbose"
Verbose mode.
.TP
.BR \-V , " \-\-version"
Display version information and exit.
.TP
.BR \-h , " \-\-help"
Display help text and exit.
.SH ENVIRONMENT
.IP LIBBLKID_DEBUG=all
enables libblkid debug output.
.SH EXAMPLE
.TP
partx \-\-show /dev/sdb3
.TQ
partx \-\-show \-\-nr 3 /dev/sdb
.TQ
partx \-\-show /dev/sdb3 /dev/sdb
All three commands list partition 3 of /dev/sdb.
.TP
partx \-\-show \- /dev/sdb3
Lists all subpartitions on /dev/sdb3 (the device is used as
whole-disk).
.TP
partx \-o START \-g \-\-nr 5 /dev/sdb
Prints the start sector of partition 5 on /dev/sdb without header.
.TP
partx \-o SECTORS,SIZE /dev/sda5 /dev/sda
Lists the length in sectors and human-readable size of partition 5 on
/dev/sda.
.TP
partx \-\-add \-\-nr 3:5 /dev/sdd
Adds all available partitions from 3 to 5 (inclusive) on /dev/sdd.
.TP
partx \-d \-\-nr :\-1 /dev/sdd
Removes the last partition on /dev/sdd.
.SH AUTHORS
.MT dave@gnu.org
Davidlohr Bueso
.ME
.br
.MT kzak@redhat.com
Karel Zak
.ME
.PP
The original version was written by
.MT aeb@cwi.nl
Andries E.\& Brouwer
.ME .
.SH SEE ALSO
.BR addpart (8),
.BR delpart (8),
.BR fdisk (8),
.BR parted (8),
.BR partprobe (8)
.SH AVAILABILITY
The partx command is part of the util-linux package and is available from
.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
Linux Kernel Archive
.UE .