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