summaryrefslogtreecommitdiffstats
path: root/misc-utils/findmnt.8
blob: e411c3010eae73105812e55d207222177ccdcd9b (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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
.TH FINDMNT 8 "May 2018" "util-linux" "System Administration"
.SH NAME
findmnt \- find a filesystem
.SH SYNOPSIS
.B findmnt
[options]
.sp
.B findmnt
[options]
.IR device | mountpoint
.sp
.B findmnt
[options]
.RB [ \-\-source ]
.I device
.RB [ \-\-target | \-\-mountpoint ]
.I mountpoint
.SH DESCRIPTION
.B findmnt
will list all mounted filesystems or search for a filesystem.  The
.B \%findmnt
command is able to search in
.IR /etc/fstab ,
.I /etc/mtab
or
.IR /proc/self/mountinfo .
If
.I device
or
.I mountpoint
is not given, all filesystems are shown.
.PP
The device may be specified by device name, major:minor numbers,
filesystem label or UUID, or partition label or UUID.  Note that
.B \%findmnt
follows
.BR mount (8)
behavior where a device name may be interpreted
as a mountpoint (and vice versa) if the \fB\-\-target\fR, \fB\-\-mountpoint\fR or
\fB\-\-source\fR options are not specified.
.PP
The command prints all mounted filesystems in the tree-like format by default.
.SH OPTIONS
.TP
.BR \-A , " \-\-all"
Disable all built-in filters and print all filesystems.
.TP
.BR \-a , " \-\-ascii"
Use ascii characters for tree formatting.
.TP
.BR \-b , " \-\-bytes"
Print the SIZE, USED and AVAIL columns in bytes rather than in a human-readable format.
.TP
.BR \-C , " \-\-nocanonicalize"
Do not canonicalize paths at all.  This option affects the comparing of paths
and the evaluation of tags (LABEL, UUID, etc.).
.TP
.BR \-c , " \-\-canonicalize"
Canonicalize all printed paths.
.TP
.BR \-D , " \-\-df"
Imitate the output of
.BR df (1).
This option is equivalent to
.B \-o\ SOURCE,FSTYPE,SIZE,USED,AVAIL,USE%,TARGET
but excludes all pseudo filesystems.
Use \fB\-\-all\fP to print all filesystems.
.TP
.BR \-d , " \-\-direction \fIword\fP"
The search direction, either
.B forward
or
.BR backward .
.TP
.BR \-e , " \-\-evaluate"
Convert all tags (LABEL, UUID, PARTUUID or PARTLABEL) to the corresponding device names.
.TP
.BR \-F , " \-\-tab\-file \fIpath\fP"
Search in an alternative file.  If used with \fB\-\-fstab\fP, \fB\-\-mtab\fP
or \fB\-\-kernel\fP, then it overrides the default paths.  If specified more
than once, then tree-like output is disabled (see the \fB\-\-list\fP option).
.TP
.BR \-f , " \-\-first\-only"
Print the first matching filesystem only.
.TP
.BR \-h , " \-\-help"
Display help text and exit.
.TP
.BR \-i , " \-\-invert"
Invert the sense of matching.
.TP
.BR \-J , " \-\-json"
Use JSON output format.
.TP
.BR \-k , " \-\-kernel"
Search in
.IR /proc/self/mountinfo .
The output is in the tree-like format.  This is the default.  The output
contains only mount options maintained by kernel (see also \fB\-\-mtab)\fP.
.TP
.BR \-l , " \-\-list"
Use the list output format.  This output format is automatically enabled if the
output is restricted by the \fB\-t\fP, \fB\-O\fP, \fB\-S\fP or \fB\-T\fP
option and the option \fB\-\-submounts\fP is not used or if more that one
source file (the option \fB\-F\fP) is specified.
.TP
.BR \-M , " \-\-mountpoint \fIpath\fP"
Explicitly define the mountpoint file or directory.  See also \fB\-\-target\fP.
.TP
.BR \-m , " \-\-mtab"
Search in
.IR /etc/mtab .
The output is in the list format by default (see \fB\-\-tree\fP).  The output may include user
space mount options.
.TP
.BR \-N , " \-\-task \fItid\fP"
Use alternative namespace /proc/<tid>/mountinfo rather than the default
/proc/self/mountinfo.  If the option is specified more than once, then
tree-like output is disabled (see the \fB\-\-list\fP option).  See also the
.BR unshare (1)
command.
.TP
.BR \-n , " \-\-noheadings"
Do not print a header line.
.TP
.BR \-O , " \-\-options \fIlist\fP"
Limit the set of printed filesystems.  More than one option
may be specified in a comma-separated list.  The
.B \-t
and
.B \-O
options are cumulative in effect.  It is different from
.B \-t
in that each option is matched exactly; a leading
.I no
at the beginning does not have global meaning.  The "no" can used for
individual items in the list.  The "no" prefix interpretation can be disabled
by "+" prefix.
.TP
.BR \-o , " \-\-output \fIlist\fP"
Define output columns.  See the \fB\-\-help\fP output to get a list of the
currently supported columns.  The
.B TARGET
column contains tree formatting if the
.B \-\-list
or
.B \-\-raw
options are not specified.

The default list of columns may be extended if \fIlist\fP is
specified in the format \fI+list\fP (e.g., \fBfindmnt \-o +PROPAGATION\fP).
.TP
.B \-\-output\-all
Output almost all available columns.  The columns that require
.B \-\-poll
are not included.
.TP
.BR \-P , " \-\-pairs"
Use key="value" output format.  All potentially unsafe characters are hex-escaped (\\x<code>).
.TP
.BR \-p , " \-\-poll\fR[\fI=list\fR]"
Monitor changes in the /proc/self/mountinfo file.  Supported actions are: mount,
umount, remount and move.  More than one action may be specified in a
comma-separated list.  All actions are monitored by default.

The time for which \fB\-\-poll\fR will block can be restricted with the \fB\-\-timeout\fP
or \fB\-\-first\-only\fP options.

The standard columns always use the new version of the information from the
mountinfo file, except the umount action which is based on the original
information cached by
.BR findmnt (8).
The poll mode allows using extra columns:
.RS
.TP
.B ACTION
mount, umount, move or remount action name; this column is enabled by default
.TP
.B OLD-TARGET
available for umount and move actions
.TP
.B OLD-OPTIONS
available for umount and remount actions
.RE
.TP
.B \-\-pseudo
Print only pseudo filesystems.
.TP
.BR \-R , " \-\-submounts"
Print recursively all submounts for the selected filesystems.  The restrictions
defined by options \fB\-t\fP, \fB\-O\fP, \fB\-S\fP, \fB\-T\fP and
\fB\%\-\-direction\fP are not applied to submounts.  All submounts are always
printed in tree-like order.  The option enables the tree-like output format by
default.  This option has no effect for \fB\-\-mtab\fP or \fB\-\-fstab\fP.
.TP
.BR \-r , " \-\-raw"
Use raw output format.  All potentially unsafe characters are hex-escaped (\\x<code>).
.TP
.B \-\-real
Print only real filesystems.
.TP
.BR \-S , " \-\-source \fIspec\fP"
Explicitly define the mount source.  Supported specifications are \fIdevice\fR,
\fImaj\fB:\fImin\fR, \fBLABEL=\fIlabel\fR, \fBUUID=\fIuuid\fR,
\fBPARTLABEL=\fIlabel\fR and \fBPARTUUID=\fIuuid\fR.
.TP
.BR \-s , " \-\-fstab"
Search in
.IR /etc/fstab .
The output is in the list format (see \fB\-\-list\fR).
.TP
.BR \-T , " \-\-target \fIpath\fP"
Define the mount target.  If \fIpath\fR
is not a mountpoint file or directory, then
.B findmnt
checks the \fIpath\fR elements in reverse order to get the mountpoint (this feature is
supported only when searching in kernel files and unsupported for \fB\-\-fstab\fP).  It's
recommended to use the option \fB\-\-mountpoint\fR when checks of \fIpath\fR elements are
unwanted and \fIpath\fR is a strictly specified mountpoint.
.TP
.BR \-t , " \-\-types \fIlist\fP"
Limit the set of printed filesystems.  More than one type may be
specified in a comma-separated list.  The list of filesystem types can be
prefixed with
.B no
to specify the filesystem types on which no action should be taken.  For
more details see
.BR mount (8).
.TP
.B \-\-tree
Enable tree-like output if possible.  The options is silently ignored for
tables where is missing child-parent relation (e.g., fstab).
.TP
.BR \-U , " \-\-uniq"
Ignore filesystems with duplicate mount targets, thus effectively skipping
over-mounted mount points.
.TP
.BR \-u , " \-\-notruncate"
Do not truncate text in columns.  The default is to not truncate the
.BR TARGET ,
.BR SOURCE ,
.BR UUID ,
.BR LABEL ,
.BR PARTUUID ,
.B PARTLABEL
columns.  This option disables text truncation also in all other columns.
.TP
.BR \-v , " \-\-nofsroot"
Do not print a [/dir] in the SOURCE column for bind mounts or btrfs subvolumes.
.TP
.BR \-w , " \-\-timeout \fImilliseconds\fP"
Specify an upper limit on the time for which \fB\-\-poll\fR will block, in milliseconds.
.TP
.BR \-x , " \-\-verify"
Check mount table content. The default is to verify
.I /etc/fstab
parsability and usability. It's possible to use this option also with \fB\-\-tab\-file\fP.
It's possible to specify source (device) or target (mountpoint) to filter mount table. The option
\fB\-\-verbose\fP forces findmnt to print more details.
.TP
.B \-\-verbose
Force findmnt to print more information (\fB\-\-verify\fP only for now).
.SH ENVIRONMENT
.IP LIBMOUNT_FSTAB=<path>
overrides the default location of the fstab file
.IP LIBMOUNT_MTAB=<path>
overrides the default location of the mtab file
.IP LIBMOUNT_DEBUG=all
enables libmount debug output
.IP LIBSMARTCOLS_DEBUG=all
enables libsmartcols debug output
.IP LIBSMARTCOLS_DEBUG_PADDING=on
use visible padding characters. Requires enabled LIBSMARTCOLS_DEBUG.
.SH EXAMPLE
.IP "\fBfindmnt \-\-fstab \-t nfs\fP"
Prints all NFS filesystems defined in
.IR /etc/fstab .
.IP "\fBfindmnt \-\-fstab /mnt/foo\fP"
Prints all
.I /etc/fstab
filesystems where the mountpoint directory is /mnt/foo.  It also prints bind mounts where /mnt/foo
is a source.
.IP "\fBfindmnt \-\-fstab \-\-target /mnt/foo\fP"
Prints all
.I /etc/fstab
filesystems where the mountpoint directory is /mnt/foo.
.IP "\fBfindmnt \-\-fstab \-\-evaluate\fP"
Prints all
.I /etc/fstab
filesystems and converts LABEL= and UUID= tags to the real device names.
.IP "\fBfindmnt \-n \-\-raw \-\-evaluate \-\-output=target LABEL=/boot\fP"
Prints only the mountpoint where the filesystem with label "/boot" is mounted.
.IP "\fBfindmnt \-\-poll \-\-mountpoint /mnt/foo\fP"
Monitors mount, unmount, remount and move on /mnt/foo.
.IP "\fBfindmnt \-\-poll=umount \-\-first-only \-\-mountpoint /mnt/foo\fP"
Waits for /mnt/foo unmount.
.IP "\fBfindmnt \-\-poll=remount \-t ext3 \-O ro\fP"
Monitors remounts to read-only mode on all ext3 filesystems.
.SH AUTHORS
.nf
Karel Zak <kzak@redhat.com>
.fi
.SH SEE ALSO
.BR fstab (5),
.BR mount (8)
.SH AVAILABILITY
The findmnt command is part of the util-linux package and is available from
https://www.kernel.org/pub/linux/utils/util-linux/.