]> git.ipfire.org Git - thirdparty/util-linux.git/blame - misc-utils/blkid.8
docs: make the section AVAILABILITY always come last in man pages
[thirdparty/util-linux.git] / misc-utils / blkid.8
CommitLineData
51410fc6
KZ
1.\" Copyright 2000 Andreas Dilger (adilger@turbolinux.com)
2.\"
3.\" This man page was created for blkid from e2fsprogs-1.25.
4.\"
5.\" This file may be copied under the terms of the GNU Public License.
6.\"
7.\" Based on uuidgen, Mon Sep 17 10:42:12 2000, Andreas Dilger
bc88ad1a 8.TH BLKID 8 "March 2013" "util-linux" "System Administration"
51410fc6 9.SH NAME
0791a058 10blkid \- locate/print block device attributes
51410fc6
KZ
11.SH SYNOPSIS
12.B blkid
bc88ad1a
BS
13.BI \-L " label"
14|
15.BI \-U " uuid"
fc7a1669
KZ
16
17.B blkid
36a74e1b 18.RB [ \-dghlv ]
02a8a21a
KZ
19.RB [ \-c
20.IR file ]
02a8a21a
KZ
21.RB [ \-o
22.IR format ]
02a8a21a
KZ
23.RB [ \-s
24.IR tag ]
bc88ad1a 25.in +6
02a8a21a
KZ
26.RB [ \-t
27.IR NAME=value ]
bc88ad1a 28.RI [ device " ...]"
02a8a21a
KZ
29.in -6
30
31.B blkid
bc88ad1a 32.BR -p " [" \-O
02a8a21a 33.IR offset ]
02a8a21a
KZ
34.RB [ \-o
35.IR format ]
bc88ad1a
BS
36.RB [ \-S
37.IR size ]
7711e215
KZ
38.RB [ \-s
39.IR tag ]
40.in +9
4f946f53
KZ
41.RB [ \-n
42.IR list ]
0bdd2f97
KZ
43.RB [ \-u
44.IR list ]
bc88ad1a 45.IR device " ..."
09792910
KZ
46.in -9
47
48.B blkid
bc88ad1a 49.BR -i " [" \-o
09792910
KZ
50.IR format ]
51.RB [ \-s
52.IR tag ]
bc88ad1a 53.IR device " ..."
02a8a21a 54
51410fc6
KZ
55.SH DESCRIPTION
56The
57.B blkid
0791a058 58program is the command-line interface to working with the
51410fc6 59.BR libblkid (3)
0791a058 60library. It can determine the type of content (e.g. filesystem or swap)
bc88ad1a 61that a block device holds, and also the attributes (tokens, NAME=value pairs)
51410fc6
KZ
62from the content metadata (e.g. LABEL or UUID fields).
63.PP
bc88ad1a
BS
64When
65.I device
66is specified, tokens from only this device are displayed.
67It is possible to specify multiple
68.I device
69arguments on the command line.
70If none is given, all devices which appear in
71.I /proc/partitions
72are shown, if they are recognized.
73.PP
6a076644
KZ
74Note that
75.B blkid
76reads information directly from devices and for non-root users
bc88ad1a 77it returns cached unverified information. It is better to use
6a076644 78.B lsblk --fs
bc88ad1a 79to get a user-friendly overview of filesystems and devices.
6a076644
KZ
80.BR lsblk (8)
81is also easy to use in scripts.
82.B blkid
83is mostly designed for system services and to test libblkid functionality.
84.PP
51410fc6
KZ
85.B blkid
86has two main forms of operation: either searching for a device with a
87specific NAME=value pair, or displaying NAME=value pairs for one or
0791a058 88more specified devices.
51410fc6 89.SH OPTIONS
d636d6d8 90The \fIsize\fR and \fIoffset\fR arguments may be followed by the multiplicative
bc88ad1a
BS
91suffixes like KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB
92(the "iB" is optional, e.g. "K" has the same meaning as "KiB"), or the suffixes
93KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
51410fc6
KZ
94.TP
95.BI \-c " cachefile"
96Read from
97.I cachefile
bc88ad1a 98instead of reading from the default cache file (see the CONFIGURATION FILE section
b82590ad
KZ
99for more details). If you want to start with a clean cache (i.e. don't report
100devices previously scanned but not necessarily available at this time), specify
51410fc6
KZ
101.IR /dev/null .
102.TP
36a74e1b 103.B \-d
bc88ad1a
BS
104Don't encode non-printing characters. The non-printing characters are encoded
105by ^ and M- notation by default. Note that the \fB-o udev\fR output format uses
106a different encoding which cannot be disabled.
36a74e1b 107.TP
51410fc6
KZ
108.B \-g
109Perform a garbage collection pass on the blkid cache to remove
110devices which no longer exist.
111.TP
112.B \-h
113Display a usage message and exit.
114.TP
09792910 115.B \-i
bc88ad1a 116Display information about I/O Limits (aka I/O topology). The 'export' output format is
0791a058 117automatically enabled. This option can be used together with the \fB-p\fR option.
09792910 118.TP
bc88ad1a
BS
119.B \-k
120List all known filesystems and RAIDs and exit.
121.TP
51410fc6 122.B \-l
bc88ad1a 123Look up only one device that matches the search parameter specified with the \fB-t\fR
51410fc6
KZ
124option. If there are multiple devices that match the specified search
125parameter, then the device with the highest priority is returned, and/or
126the first device found at a given priority. Device types in order of
bc88ad1a 127decreasing priority are: Device Mapper, EVMS, LVM, MD, and finally regular
51410fc6
KZ
128block devices. If this option is not specified,
129.B blkid
130will print all of the devices that match the search parameter.
131.TP
0791a058 132.BI \-L " label"
bc88ad1a
BS
133Look up the device that uses this filesystem \fIlabel\fR; this is equal to
134.BR "-l -o device -t LABEL=\fIlabel\fR" .
135This lookup method is able to reliably use /dev/disk/by-label
0791a058
BS
136udev symlinks (dependent on a setting in /etc/blkid.conf). Avoid using the
137symlinks directly; it is not reliable to use the symlinks without verification.
2d71a929
KZ
138The \fB-L\fR option works on systems with and without udev.
139
140Unfortunately, the original
8323d9fd 141.BR blkid (8)
bc88ad1a
BS
142from e2fsprogs uses the \fB-L\fR option as a
143synonym for \fB-o list\fR. For better portability, use \fB-l -o device
144-t LABEL=\fIlabel\fR and \fB-o list\fR in your scripts rather than the \fB-L\fR option.
fc7a1669 145.TP
bc88ad1a 146.BI \-n " list"
0791a058
BS
147Restrict the probing functions to the specified (comma-separated) \fIlist\fR of
148superblock types (names).
149The list items may be prefixed with "no" to specify the types which should be ignored.
4f946f53
KZ
150For example:
151.sp
152 blkid -p -n vfat,ext3,ext4 /dev/sda1
153.sp
154probes for vfat, ext3 and ext4 filesystems, and
155.sp
0791a058 156 blkid -p -n nominix /dev/sda1
4f946f53 157.sp
0791a058
BS
158probes for all supported formats except minix filesystems.
159This option is only useful together with \fB-p\fR.
4f946f53 160.TP
51410fc6 161.BI \-o " format"
bc88ad1a
BS
162Use the specified output format. Note that the order of variables and
163devices is not fixed. See also option \fB-s\fR. The
51410fc6 164.I format
02a8a21a
KZ
165parameter may be:
166.RS
51410fc6 167.TP
02a8a21a
KZ
168.B full
169print all tags (the default)
170.TP
171.B value
172print the value of the tags
173.TP
174.B list
0791a058 175print the devices in a user-friendly format; this output format is unsupported
bc88ad1a
BS
176for low-level probing (\fB-p\fR or \fB-i\fR).
177
178This output format is \fBDEPRECATED\fR in favour of the
24d741d8
KZ
179.BR lsblk (8)
180command.
02a8a21a
KZ
181.TP
182.B device
bc88ad1a 183print the device name only; this output format is always enabled for the \fB-L\fR
2d71a929 184and \fB-U\fR options
02a8a21a
KZ
185.TP
186.B udev
0791a058
BS
187print key="value" pairs for easy import into the udev environment; the keys are
188prefixed by ID_FS_ or ID_PART_ prefixes
c38b4ebb 189
0791a058 190The udev output returns the ID_FS_AMBIVALENT tag if more superblocks are detected,
c38b4ebb 191and ID_PART_ENTRY_* tags are always returned for all partitions including empty
bc88ad1a 192partitions. This output format is \fBDEPRECATED\fR.
ab978962
KZ
193.TP
194.B export
0791a058
BS
195print key=value pairs for easy import into the environment; this output format
196is automatically enabled when I/O Limits (\fB-i\fR option) are requested
02a8a21a
KZ
197.RE
198.TP
8ab912cf 199.BI \-O " offset"
0791a058
BS
200Probe at the given \fIoffset\fR (only useful with \fB-p\fR). This option can be
201used together with the \fB-i\fR option.
02a8a21a
KZ
202.TP
203.BI \-p
bc88ad1a 204Switch to low-level superblock probing mode (bypassing the cache).
c38b4ebb
KZ
205
206Note that low-level probing also returns information about partition table type
207(PTTYPE tag) and partitions (PART_ENTRY_* tags).
51410fc6
KZ
208.TP
209.BI \-s " tag"
210For each (specified) device, show only the tags that match
211.IR tag .
212It is possible to specify multiple
213.B \-s
214options. If no tag is specified, then all tokens are shown for all
215(specified) devices.
216In order to just refresh the cache without showing any tokens, use
217.B "-s none"
218with no other options.
219.TP
8ab912cf 220.BI \-S " size"
bc88ad1a 221Override the size of device/file (only useful with \fB-p\fR).
02a8a21a 222.TP
bc88ad1a 223.BI \-t " NAME" = value
51410fc6
KZ
224Search for block devices with tokens named
225.I NAME
226that have the value
227.IR value ,
228and display any devices which are found.
229Common values for
230.I NAME
231include
232.BR TYPE ,
233.BR LABEL ,
234and
235.BR UUID .
236If there are no devices specified on the command line, all block devices
237will be searched; otherwise only the specified devices are searched.
238.TP
bc88ad1a 239.BI \-u " list"
0791a058
BS
240Restrict the probing functions to the specified (comma-separated) \fIlist\fR of "usage" types.
241Supported usage types are: filesystem, raid, crypto and other. The list items may be
242prefixed with "no" to specify the usage types which should be ignored. For example:
8ab43e6a
KZ
243.sp
244 blkid -p -u filesystem,other /dev/sda1
245.sp
0791a058 246probes for all filesystem and other (e.g. swap) formats, and
8ab43e6a
KZ
247.sp
248 blkid -p -u noraid /dev/sda1
249.sp
0791a058
BS
250probes for all supported formats except RAIDs.
251This option is only useful together with \fB-p\fR.
8ab43e6a 252.TP
bc88ad1a 253.BI \-U " uuid"
10b4d34d 254Look up the device that uses this filesystem \fIuuid\fR. For more details see the \fB-L\fR option.
8ab43e6a 255.TP
a9b2c52f 256.B \-V
51410fc6 257Display version number and exit.
51410fc6
KZ
258.SH "RETURN CODE"
259If the specified token was found, or if any tags were shown from (specified)
68c88d94
KZ
260devices, 0 is returned.
261
262If the specified token was not found, or no (specified) devices could be
0791a058 263identified, an exit code of 2 is returned.
68c88d94 264
51410fc6 265For usage or other errors, an exit code of 4 is returned.
68c88d94 266
bc88ad1a 267If an ambivalent low-level probing result was detected, an exit code of 8 is
68c88d94 268returned.
b82590ad
KZ
269.SH CONFIGURATION FILE
270The standard location of the
271.I /etc/blkid.conf
272config file can be overridden by the environment variable BLKID_CONF.
273The following options control the libblkid library:
274.TP
275.I SEND_UEVENT=<yes|not>
276Sends uevent when
10b4d34d 277.I /dev/disk/by-{label,uuid,partuuid,partlabel}/
bc88ad1a 278symlink does not match with LABEL, UUID, PARTUUID or PARTLABEL on the device. Default is "yes".
b82590ad
KZ
279.TP
280.I CACHE_FILE=<path>
bc88ad1a
BS
281Overrides the standard location of the cache file. This setting can be
282overridden by the environment variable BLKID_FILE. Default is
283.IR /run/blkid/blkid.tab ,
b82590ad
KZ
284or
285.I /etc/blkid.tab
bc88ad1a 286on systems without a /run directory.
b82590ad
KZ
287.TP
288.I EVALUATE=<methods>
bc88ad1a
BS
289Defines LABEL and UUID evaluation method(s). Currently, the libblkid library
290supports the "udev" and "scan" methods. More than one method may be specified in
291a comma-separated list. Default is "udev,scan". The "udev" method uses udev
b82590ad
KZ
292.I /dev/disk/by-*
293symlinks and the "scan" method scans all block devices from the
294.I /proc/partitions
295file.
51410fc6
KZ
296.SH AUTHOR
297.B blkid
02a8a21a
KZ
298was written by Andreas Dilger for libblkid and improved by Theodore Ts'o
299and Karel Zak.
ddfeda98 300.SH ENVIRONMENT
bc88ad1a 301.IP "Setting LIBBLKID_DEBUG=0xffff enables debug output."
9c91fc03 302.SH SEE ALSO
51410fc6 303.BR libblkid (3)
fc7a1669 304.BR findfs (8)
c49057d2 305.BR wipefs (8)
9c91fc03
BS
306.SH AVAILABILITY
307The blkid command is part of the util-linux package and is available from
308ftp://ftp.kernel.org/pub/linux/utils/util-linux/.