summaryrefslogtreecommitdiffstats
path: root/partx/partx.8
blob: c680d51130d9b6bd2ebc1a1afd99a643625d48cf (plain) (blame)
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
.\" partx.8 --
.\" 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 "1 Feb 2011"
.SH NAME
partx \-
tell the Linux kernel about the presence and numbering of on-disk partitions
.SH SYNOPSIS
.B partx
.RB [ \-a | \-d | \-s ]
.RB [ \-t
.IR TYPE ]
.RB [ \-n
.IR M:N ]
.RI [ \- ]
.I disk

.B partx
.RB [ \-a | \-d | \-s ]
.RB [ \-t
.IR TYPE ]
.I partition
.RI [ disk ]

.SH DESCRIPTION
Given a device or disk-image, \fBpartx\fP tries to parse the partition table and
list its contents.  It optionally adds or removes partitions.

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 "-".  For example:

.RS
.br
.B partx \-\-show \- /dev/sda3
.RE

This will see sda3 as a whole-disk rather than a partition.

.B This is not an fdisk program
\-\- 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
.IP "\fB\-a, \-\-add\fP"
Add the specified partitions, or read the disk and add all partitions.
.IP "\fB\-b, \-\-bytes\fP"
Print the SIZE column in bytes rather than in human-readable format.
.IP "\fB\-d, \-\-delete\fP"
Delete the specified partitions or all partitions.
.IP "\fB\-g, \-\-noheadings\fP"
Do not print a header line.
.IP "\fB\-l, \-\-list\fP"
List the partitions.  Note that all numbers are in 512-byte sectors.  This output
format is DEPRECATED in favour of \fB\-\-show\fP.  Don't use it in newly written
scripts.
.IP "\fB\-o, \-\-output \fIlist\fP"
Define the output columns to use for \fB\-\-show\fP and  \fB\-\-raw\fP output.
If no output arrangement is specified, then a default set is used.
Use \fB\-\-help\fP to  get list of all supported columns.
.IP "\fB\-r, \-\-raw\fP"
Use the raw output format.
.IP "\fB\-s, \-\-show\fP"
List the partitions.  All numbers (except SIZE) are in 512-byte sectors.  The output
columns can be rearranged with the \fB\-\-output\fP option.
.IP "\fB\-t, \-\-type \fItype\fP"
Specify the partition table type -- aix, bsd, dos, gpt, mac, minix, sgi, solaris_x86,
sun, ultrix or unixware.
.IP "\fB\-n, \-\-nr \fIM:N\fP"
Specify the range of partitions.  For backward compatibility also the format
<M-N> is supported.  The range may contain negative
numbers, for example "--nr :-1" means the last partition, and "--nr -2:-1" means
the last two partitions.  Supported range specifications are:
.RS
.TP
.B <M>
Specifies just one partition (e.g. --nr 3).
.TP
.B <M:>
Specifies lower limit only (e.g. --nr 2:).
.TP
.B <:N>
Specifies upper limit only (e.g. --nr :4).
.TP
.B <M:N>
or
.B <M-N>
Specifies lower and upper limits (e.g. --nr 2:4).
.RE
.SH EXAMPLES
.IP "\fBpartx \-\-show /dev/sdb3\fP"
.IP "\fBpartx \-\-show --nr 3 /dev/sdb\fP"
.IP "\fBpartx \-\-show /dev/sdb3 /dev/sdb\fP"
All three commands list partition 3 of /dev/sdb.
.IP "\fBpartx \-\-show \- /dev/sdb3\fP"
Lists all subpartitions on /dev/sdb3 (the device is used as whole-disk).
.IP "\fBpartx \-o START -g --nr 3 /dev/sdb\fP"
Prints the start sector of partition 5 on /dev/sda without header.
.IP "\fBpartx \-o SECTORS,SIZE /dev/sda5 /dev/sda\fP"
Lists the length in sectors and human-readable size of partition 5 on /dev/sda.
.IP "\fBpartx \-\-add --nr 3:5 /dev/sdd\fP"
Adds all available partitions from 3 to 5 (inclusive) on /dev/sdd.
.IP "\fBpartx \-d --nr :-1 /dev/sdd\fP"
Removes the last partition on /dev/sdd.

.SH SEE ALSO
.BR addpart (8),
.BR delpart (8),
.BR fdisk (8),
.BR parted (8),
.BR partprobe (8)

.SH AUTHORS
.nf
Davidlohr Bueso <dave@gnu.org>
Karel Zak <kzak@redhat.com>
.fi

The original version was written by Andries E. Brouwer <aeb@cwi.nl>.
.SH AVAILABILITY
The partx command is part of the util-linux package and is available from
ftp://ftp.kernel.org/pub/linux/utils/util-linux/.