]> git.ipfire.org Git - thirdparty/util-linux.git/blame - misc-utils/blkid.8
blkid: update man page/usage()
[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
fc7a1669 8.TH BLKID 8 "February 2009" "Linux" "MAINTENANCE COMMANDS"
51410fc6
KZ
9.SH NAME
10blkid \- command\-line utility to locate/print block device attributes
11.SH SYNOPSIS
12.B blkid
fc7a1669
KZ
13.RB \-L
14.IR label " | "
15.RB \-U
16.IR uuid
17
18.B blkid
19.RB [ \-ghlv ]
02a8a21a
KZ
20.RB [ \-c
21.IR file ]
22.RB [ \-w
23.IR file ]
24.RB [ \-o
25.IR format ]
26.in +6
27.RB [ \-s
28.IR tag ]
29.RB [ \-t
30.IR NAME=value ]
02a8a21a
KZ
31[\fIdevice\fR ...]
32.in -6
33
34.B blkid
35.RB -p
25636f82
KZ
36.RB [ \-s
37.IR tag ]
02a8a21a
KZ
38.RB [ \-O
39.IR offset ]
40.RB [ \-S
41.IR size ]
42.RB [ \-o
43.IR format ]
7711e215
KZ
44.RB [ \-s
45.IR tag ]
46.in +9
4f946f53
KZ
47.RB [ \-n
48.IR list ]
0bdd2f97
KZ
49.RB [ \-u
50.IR list ]
02a8a21a
KZ
51.I device
52[\fIdevice\fR ...]
53
51410fc6
KZ
54.SH DESCRIPTION
55The
56.B blkid
57program is the command-line interface to working with
58.BR libblkid (3)
59library. It can determine the type of content (e.g. filesystem, swap)
60a block device holds, and also attributes (tokens, NAME=value pairs)
61from the content metadata (e.g. LABEL or UUID fields).
62.PP
63.B blkid
64has two main forms of operation: either searching for a device with a
65specific NAME=value pair, or displaying NAME=value pairs for one or
66more devices.
67.SH OPTIONS
8ab912cf
KZ
68The \fIsize\fR and \fIoffset\fR arguments may be followed by binary (2^N)
69suffixes KiB, MiB, GiB, TiB, PiB and EiB (the "iB" is optional, e.g. "K" has the
70same meaning as "KiB") or decimal (10^N) suffixes KB, MB, GB, PB and EB.
51410fc6
KZ
71.TP
72.BI \-c " cachefile"
73Read from
74.I cachefile
75instead of reading from the default cache file
76.IR /etc/blkid.tab .
77If you want to start with a clean cache (i.e. don't report devices previously
78scanned but not necessarily available at this time), specify
79.IR /dev/null .
80.TP
81.B \-g
82Perform a garbage collection pass on the blkid cache to remove
83devices which no longer exist.
84.TP
85.B \-h
86Display a usage message and exit.
87.TP
88.B \-l
89Look up one device that matches the search parameter specified using
90the
91.B \-t
92option. If there are multiple devices that match the specified search
93parameter, then the device with the highest priority is returned, and/or
94the first device found at a given priority. Device types in order of
95decreasing priority are Device Mapper, EVMS, LVM, MD, and finally regular
96block devices. If this option is not specified,
97.B blkid
98will print all of the devices that match the search parameter.
99.TP
fc7a1669
KZ
100.B \-L " label "
101Look up one device that uses the label (same as: -l -o device -t
102LABEL=<label>). This look up method is able to reliable use /dev/disk/by-label
103udev symlinks (depends on setting in /etc/blkid.conf). Avoid to use the
104symlinks directly. It is not reliable to use the symlinks without verification.
2d71a929
KZ
105The \fB-L\fR option works on systems with and without udev.
106
107Unfortunately, the original
108.B blkid(8)
109from e2fsprogs use the \fB-L\fR option as a
110synonym to the \fB-o list\fR option. For better portability use "-l -o device
111-t LABEL=<label>" and "-o list" in your scripts rather than -L option.
fc7a1669 112.TP
4f946f53
KZ
113.B \-n " list "
114Restrict probing functions to defined (comma separated) list of superblock types (names).
115The list can be prefixed with "no" to specify the types which should be ignored.
116For example:
117.sp
118 blkid -p -n vfat,ext3,ext4 /dev/sda1
119.sp
120probes for vfat, ext3 and ext4 filesystems, and
121.sp
122 blkid -p -u nominix /dev/sda1
123.sp
124probes for all supported formats exclude minix filesystem. This option is
125useful with
126\fB-p\fR only.
127.TP
51410fc6
KZ
128.BI \-o " format"
129Display
130.BR blkid 's
131output using the specified format. The
132.I format
02a8a21a
KZ
133parameter may be:
134.RS
51410fc6 135.TP
02a8a21a
KZ
136.B full
137print all tags (the default)
138.TP
139.B value
140print the value of the tags
141.TP
142.B list
2d71a929
KZ
143print the devices in a user-friendly format, this output format is unsupported
144for low-level probing (\fB-p\fR)
02a8a21a
KZ
145.TP
146.B device
2d71a929
KZ
147print the device name only, this output format is always enabled for \fB-L\fR
148and \fB-U\fR options
02a8a21a
KZ
149.TP
150.B udev
151vol_id compatible mode; usable in udev rules
152.RE
153.TP
8ab912cf 154.BI \-O " offset"
02a8a21a
KZ
155Probe at the given offset (only useful with \fB-p\fR).
156.TP
157.BI \-p
7711e215 158Switch to low-level probing mode (bypass cache)
51410fc6
KZ
159.TP
160.BI \-s " tag"
161For each (specified) device, show only the tags that match
162.IR tag .
163It is possible to specify multiple
164.B \-s
165options. If no tag is specified, then all tokens are shown for all
166(specified) devices.
167In order to just refresh the cache without showing any tokens, use
168.B "-s none"
169with no other options.
170.TP
8ab912cf 171.BI \-S " size"
0bdd2f97 172Overwrite device/file size (only useful with \fB-p\fR).
02a8a21a 173.TP
51410fc6
KZ
174.BI \-t " NAME" = "value"
175Search for block devices with tokens named
176.I NAME
177that have the value
178.IR value ,
179and display any devices which are found.
180Common values for
181.I NAME
182include
183.BR TYPE ,
184.BR LABEL ,
185and
186.BR UUID .
187If there are no devices specified on the command line, all block devices
188will be searched; otherwise only the specified devices are searched.
189.TP
8ab43e6a
KZ
190.B \-u " list "
191Restrict probing functions to defined (comma separated) list of "usage" types.
192Supported usage types are: filesystem, raid, crypto and other. The list can be
193prefixed with "no" to specify the usage types which should be ignored. For example:
194.sp
195 blkid -p -u filesystem,other /dev/sda1
196.sp
197probes for all filesystems and others (e.g. swap) formats, and
198.sp
199 blkid -p -u noraid /dev/sda1
200.sp
201probes for all supported formats exclude RAIDs. This option is useful with
202\fB-p\fR only.
203.TP
204.B \-U " uuid "
205Look up one device that uses the uuid. For more details see the \fB-L\fR option.
206.TP
51410fc6
KZ
207.B \-v
208Display version number and exit.
209.TP
210.BI \-w " writecachefile"
211Write the device cache to
212.I writecachefile
213instead of writing it to the default cache file
214.IR /etc/blkid.tab .
215If you don't want to save the cache to the default file, specify
216.IR /dev/null.
217If not specified it will be the same file as that given by the
218.B \-c
219option.
220.TP
221.I device
222Display tokens from only the specified device. It is possible to
223give multiple
224.I device
225options on the command line. If none is given, all devices which
226appear in
227.I /proc/partitions
228are shown, if they are recognized.
229.SH "RETURN CODE"
230If the specified token was found, or if any tags were shown from (specified)
231devices, 0 is returned. If the specified token was not found, or no
232(specified) devices could be identified, an exit code of 2 is returned.
233For usage or other errors, an exit code of 4 is returned.
234.SH AUTHOR
235.B blkid
02a8a21a
KZ
236was written by Andreas Dilger for libblkid and improved by Theodore Ts'o
237and Karel Zak.
51410fc6 238.SH AVAILABILITY
02a8a21a
KZ
239The blkid command is part of the util-linux-ng package and is available from
240ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
51410fc6
KZ
241.SH "SEE ALSO"
242.BR libblkid (3)
fc7a1669 243.BR findfs (8)
c49057d2 244.BR wipefs (8)