1BLKID(8)                     System Administration                    BLKID(8)
2
3
4

NAME

6       blkid - locate/print block device attributes
7

SYNOPSIS

9       blkid  --label label | --uuid uuid
10
11
12       blkid  [--no-encoding  --garbage-collect  --list-one --cache-file file]
13              [--output format] [--match-tag tag]  [--match-token  NAME=value]
14              [device ...]
15
16
17       blkid  --probe   [--offset  offset]  [--output  format]  [--size  size]
18              [--match-tag tag] [--match-types list]  [--usages  list]  device
19              ...
20
21
22       blkid  --info [--output format] [--match-tag tag] device ...
23
24

DESCRIPTION

26       The  blkid  program  is  the command-line interface to working with the
27       libblkid(3) library.  It  can  determine  the  type  of  content  (e.g.
28       filesystem  or swap) that a block device holds, and also the attributes
29       (tokens, NAME=value pairs) from the content  metadata  (e.g.  LABEL  or
30       UUID fields).
31
32       It  is  recommended  to  use  lsblk(8) command to get information about
33       block devices, or lsblk --fs to get  an  overview  of  filesystems,  or
34       findmnt(8) to search in already mounted filesystems.
35
36              lsblk(8)  provides  more  information,  better control on output
37              formatting, easy to use in scripts and it does not require  root
38              permissions  to get actual information.  blkid reads information
39              directly from devices and for non-root users it  returns  cached
40              unverified  information.   blkid  is  mostly designed for system
41              services and to test libblkid functionality.
42
43
44       When device is specified, tokens from only this device  are  displayed.
45       It  is  possible  to  specify  multiple device arguments on the command
46       line.  If none is given, all devices which appear  in  /proc/partitions
47       are shown, if they are recognized.
48
49       blkid  has  two  main forms of operation: either searching for a device
50       with a specific NAME=value pair, or displaying NAME=value pairs for one
51       or more specified devices.
52
53       For security reasons blkid silently ignores all devices where the prob‐
54       ing result is ambivalent (multiple colliding filesystems are detected).
55       The  low-level  probing  mode  (-p) provides more information and extra
56       return code in this case.  It's recommended to use wipefs(8) to  get  a
57       detailed  overview and to erase obsolete stuff (magic strings) from the
58       device.
59
60

OPTIONS

62       The size and offset arguments may be  followed  by  the  multiplicative
63       suffixes  like  KiB  (=1024), MiB (=1024*1024), and so on for GiB, TiB,
64       PiB, EiB, ZiB and YiB (the "iB" is optional,  e.g.  "K"  has  the  same
65       meaning  as "KiB"), or the suffixes KB (=1000), MB (=1000*1000), and so
66       on for GB, TB, PB, EB, ZB and YB.
67
68       -c, --cache-file cachefile
69              Read from cachefile instead of reading from  the  default  cache
70              file  (see the CONFIGURATION FILE section for more details).  If
71              you want to start with a clean cache (i.e. don't report  devices
72              previously  scanned but not necessarily available at this time),
73              specify /dev/null.
74
75       -d, --no-encoding
76              Don't encode non-printing characters.  The non-printing  charac‐
77              ters are encoded by ^ and M- notation by default.  Note that the
78              --output udev output format uses a different encoding which can‐
79              not be disabled.
80
81       -g, --garbage-collect
82              Perform  a  garbage collection pass on the blkid cache to remove
83              devices which no longer exist.
84
85       -h, --help
86              Display a usage message and exit.
87
88       -i, --info
89              Display information about I/O Limits (aka  I/O  topology).   The
90              'export'  output  format  is automatically enabled.  This option
91              can be used together with the --probe option.
92
93       -k, --list-filesystems
94              List all known filesystems and RAIDs and exit.
95
96       -l, --list-one
97              Look up only one device that matches the search parameter speci‐
98              fied  with  the  --match-token  option.   If  there are multiple
99              devices that match the  specified  search  parameter,  then  the
100              device  with  the highest priority is returned, and/or the first
101              device found at a given priority.   Device  types  in  order  of
102              decreasing  priority  are:  Device  Mapper,  EVMS,  LVM, MD, and
103              finally regular block devices.  If this option is not specified,
104              blkid will print all of the devices that match the search param‐
105              eter.
106
107       -L, --label label
108              Look up the device that uses  this  filesystem  label;  this  is
109              equal  to  --list-one --output device --match-token LABEL=label.
110              This lookup method is able to  reliably  use  /dev/disk/by-label
111              udev  symlinks  (dependent  on  a  setting  in /etc/blkid.conf).
112              Avoid using the symlinks directly; it is not reliable to use the
113              symlinks without verification.  The --label option works on sys‐
114              tems with and without udev.
115
116              Unfortunately, the original blkid(8) from e2fsprogs uses the  -L
117              option as a synonym for -o list.  For better portability, use -l
118              -o device -t LABEL=label and -o list in your scripts rather than
119              the -L option.
120
121       -n, --match-types list
122              Restrict  the  probing  functions  to the specified (comma-sepa‐
123              rated) list of superblock types (names).  The list items may  be
124              prefixed with "no" to specify the types which should be ignored.
125              For example:
126
127                blkid --probe --match-types vfat,ext3,ext4 /dev/sda1
128
129              probes for vfat, ext3 and ext4 filesystems, and
130
131                blkid --probe --match-types nominix /dev/sda1
132
133              probes for all supported formats except minix filesystems.  This
134              option is only useful together with --probe.
135
136       -o, --output format
137              Use  the  specified output format.  Note that the order of vari‐
138              ables and devices is not fixed.  See also option -s.  The format
139              parameter may be:
140
141              full   print all tags (the default)
142
143              value  print the value of the tags
144
145              list   print  the devices in a user-friendly format; this output
146                     format is unsupported for low-level probing  (--probe  or
147                     --info).
148
149                     This  output  format  is  DEPRECATED  in  favour  of  the
150                     lsblk(8) command.
151
152              device print the device name only; this output format is  always
153                     enabled for the --label and --uuid options
154
155              udev   print  key="value"  pairs  for  easy import into the udev
156                     environment; the keys are prefixed by ID_FS_ or  ID_PART_
157                     prefixes.   The value may be modified to be safe for udev
158                     environment; allowed is  plain  ASCII,  hex-escaping  and
159                     valid  UTF-8,  everything else (including whitespaces) is
160                     replaced with '_'. The keys with _ENC  postfix  use  hex-
161                     escaping for unsafe chars.
162
163                     The  udev output returns the ID_FS_AMBIVALENT tag if more
164                     superblocks are detected, and  ID_PART_ENTRY_*  tags  are
165                     always returned for all partitions including empty parti‐
166                     tions.
167
168                     This output format is DEPRECATED.
169
170              export print key=value pairs for easy import into  the  environ‐
171                     ment;  this  output  format is automatically enabled when
172                     I/O Limits (--info option) are requested.
173
174                     The non-printing characters are encoded by ^ and M- nota‐
175                     tion and all potentially unsafe characters are escaped.
176
177       -O, --offset offset
178              Probe  at  the  given  offset  (only useful with --probe).  This
179              option can be used together with the --info option.
180
181       -p, --probe
182              Switch to  low-level  superblock  probing  mode  (bypassing  the
183              cache).
184
185              Note  that low-level probing also returns information about par‐
186              tition table type  (PTTYPE  tag)  and  partitions  (PART_ENTRY_*
187              tags).  The tag names produced by low-level probing are based on
188              names used internally by libblkid and it may be  different  than
189              when  executed  without --probe (for example PART_ENTRY_UUID= vs
190              PARTUUID=).
191
192       -s, --match-tag tag
193              For each (specified) device, show only the tags that match  tag.
194              It  is  possible to specify multiple --match-tag options.  If no
195              tag is specified, then all tokens are shown for all  (specified)
196              devices.  In order to just refresh the cache without showing any
197              tokens, use --match-tag none with no other options.
198
199       -S, --size size
200              Override the size of device/file (only useful with --probe).
201
202       -t, --match-token NAME=value
203              Search for block devices with tokens named NAME  that  have  the
204              value  value,  and  display any devices which are found.  Common
205              values for NAME include TYPE, LABEL, and UUID.  If there are  no
206              devices specified on the command line, all block devices will be
207              searched; otherwise only the specified devices are searched.
208
209       -u, --usages list
210              Restrict the probing functions  to  the  specified  (comma-sepa‐
211              rated)  list  of  "usage"  types.   Supported  usage  types are:
212              filesystem, raid, crypto and other.  The list items may be  pre‐
213              fixed  with  "no"  to  specify  the  usage types which should be
214              ignored.  For example:
215
216                blkid --probe --usages filesystem,other /dev/sda1
217
218              probes for all filesystem and other (e.g. swap) formats, and
219
220                blkid --probe --usages noraid /dev/sda1
221
222              probes for all supported formats except RAIDs.  This  option  is
223              only useful together with --probe.
224
225       -U, --uuid uuid
226              Look  up  the  device  that uses this filesystem uuid.  For more
227              details see the --label option.
228
229       -V, --version
230              Display version number and exit.
231

RETURN CODE

233       If the specified device or device addressed by specified token  (option
234       --match-token)  was  found  and it's possible to gather any information
235       about the device,  an  exit  code  0  is  returned.   Note  the  option
236       --match-tag filters output tags, but it does not affect return code.
237
238       If  the  specified token was not found, or no (specified) devices could
239       be identified, an exit code of 2 is returned.
240
241       For usage or other errors, an exit code of 4 is returned.
242
243       If an ambivalent probing result was detected by low-level probing  mode
244       (-p), an exit code of 8 is returned.
245

CONFIGURATION FILE

247       The  standard  location of the /etc/blkid.conf config file can be over‐
248       ridden by the environment variable BLKID_CONF.  The  following  options
249       control the libblkid library:
250
251       SEND_UEVENT=<yes|not>
252              Sends  uevent when /dev/disk/by-{label,uuid,partuuid,partlabel}/
253              symlink does not match with LABEL, UUID, PARTUUID  or  PARTLABEL
254              on the device.  Default is "yes".
255
256       CACHE_FILE=<path>
257              Overrides the standard location of the cache file.  This setting
258              can  be  overridden  by  the  environment  variable  BLKID_FILE.
259              Default  is  /run/blkid/blkid.tab,  or /etc/blkid.tab on systems
260              without a /run directory.
261
262       EVALUATE=<methods>
263              Defines LABEL and UUID  evaluation  method(s).   Currently,  the
264              libblkid  library  supports the "udev" and "scan" methods.  More
265              than one method may be  specified  in  a  comma-separated  list.
266              Default   is   "udev,scan".    The   "udev"   method  uses  udev
267              /dev/disk/by-* symlinks and the "scan" method  scans  all  block
268              devices from the /proc/partitions file.
269

AUTHOR

271       blkid  was  written  by  Andreas  Dilger  for  libblkid and improved by
272       Theodore Ts'o and Karel Zak.
273

ENVIRONMENT

275       Setting LIBBLKID_DEBUG=all enables debug output.
276

SEE ALSO

278       libblkid(3), findfs(8), lsblk(8), wipefs(8)
279

AVAILABILITY

281       The blkid command is part of the util-linux package  and  is  available
282       from https://www.kernel.org/pub/linux/utils/util-linux/.
283
284
285
286util-linux                        March 2013                          BLKID(8)
Impressum