1BLKID(8)                     MAINTENANCE COMMANDS                     BLKID(8)
2
3
4

NAME

6       blkid - command-line utility to locate/print block device attributes
7

SYNOPSIS

9       blkid -L label | -U uuid
10
11       blkid [-ghlv] [-c file] [-w file] [-o format]
12             [-s tag] [-t NAME=value] device [device ...]
13
14       blkid -p [-O offset] [-S size] [-o format] [-s tag]
15                [-u list] device [device ...]
16
17       blkid -i [-o format] [-s tag] device [device ...]
18
19

DESCRIPTION

21       The  blkid  program  is the command-line interface to working with lib‐
22       blkid(3) library.  It can determine the type of content (e.g.  filesys‐
23       tem,   swap)  a  block  device  holds,  and  also  attributes  (tokens,
24       NAME=value pairs)  from  the  content  metadata  (e.g.  LABEL  or  UUID
25       fields).
26
27       Note  that  blkid  reads information directly from devices and for non-
28       root users it returns cached unverified information.  It is  better  to
29       use  lsblk  --fs  to  get  a  user-friendly overview of filesystems and
30       devices.  lsblk(8) is also easy to use in  scripts.   blkid  is  mostly
31       designed for system services and to test libblkid functionality.
32
33       blkid does not read information about removable devices by default.
34
35       blkid  has  two  main forms of operation: either searching for a device
36       with a specific NAME=value pair, or displaying NAME=value pairs for one
37       or more devices.
38

OPTIONS

40       -c cachefile
41              Read  from  cachefile  instead of reading from the default cache
42              file /etc/blkid/blkid.tab.  If you want to start  with  a  clean
43              cache (i.e. don't report devices previously scanned but not nec‐
44              essarily available at this time), specify /dev/null.
45
46       -g     Perform a garbage collection pass on the blkid cache  to  remove
47              devices which no longer exist.
48
49       -h     Display a usage message and exit.
50
51       -i     Display  I/O Limits (aka I/O topology) information. The 'export'
52              output format is automatically enabled.  This  option  could  be
53              used together with -p option.
54
55       -l     Look  up  one device that matches the search parameter specified
56              using the -t option.  If there are multiple devices  that  match
57              the specified search parameter, then the device with the highest
58              priority is returned, and/or the first device found at  a  given
59              priority.   Device  types  in  order  of decreasing priority are
60              Device Mapper, EVMS, LVM, MD, and finally regular block devices.
61              If  this  option  is  not specified, blkid will print all of the
62              devices that match the search parameter.
63
64       -L  label
65              Look up one device that uses the label (same as: -l -o device -t
66              LABEL=<label>).   This  look  up  method is able to reliable use
67              /dev/disk/by-label  udev  symlinks  (depends   on   setting   in
68              /etc/blkid.conf).  Avoid to use the symlinks directly. It is not
69              reliable to use  the  symlinks  without  verification.   The  -L
70              option works on systems with and without udev.
71
72              Unfortunately,  the  original blkid(8) from e2fsprogs use the -L
73              option as a synonym to the -o list option. For better  portabil‐
74              ity  use  "-l  -o device -t LABEL=<label>" and "-o list" in your
75              scripts rather than -L option.
76
77       -u  list
78              Restrict probing functions to defined (comma separated) list  of
79              "usage"  types.   Supported  usage  types are: filesystem, raid,
80              crypto and other. The list can be prefixed with "no" to  specify
81              the usage types which should be ignored. For example:
82
83                blkid -p -u filesystem,other /dev/sda1
84
85              probes for all filesystems and others (e.g. swap) formats, and
86
87                blkid -p -u noraid /dev/sda1
88
89              probes  for  all supported formats exclude RAIDs. This option is
90              useful with -p only.
91
92       -U  uuid
93              Look up one device that uses the uuid. For more details see  the
94              -L option.
95
96       -o format
97              Display  blkid's  output using the specified format.  The format
98              parameter may be:
99
100              full   print all tags (the default)
101
102              value  print the value of the tags
103
104              list   print the devices in a user-friendly format, this  output
105                     format is unsupported for low-level probing (-p or -i)
106
107              device print  the device name only, this output format is always
108                     enabled for -L and -U options
109
110              udev   print key="value" pairs for easy  import  into  the  udev
111                     environment
112
113              export print  key=value  pairs for easy import into the environ‐
114                     ment.  This output format is automatically  enabled  when
115                     I/O Limits (-i option) are requested.
116
117       -O bytes
118              Probe  at  the  given  offset (only useful with -p). This option
119              could be used together with -i option.
120
121       -p     Switch to low-level superblock probing mode (bypass cache).
122
123       -s tag For each (specified) device, show only the tags that match  tag.
124              It  is  possible  to  specify multiple -s options.  If no tag is
125              specified,  then  all  tokens  are  shown  for  all  (specified)
126              devices.  In order to just refresh the cache without showing any
127              tokens, use -s none with no other options.
128
129       -S bytes
130              Overwrite device/file size (only useful with -p).
131
132       -t NAME=value
133              Search for block devices with tokens named NAME  that  have  the
134              value  value,  and  display any devices which are found.  Common
135              values for NAME include TYPE, LABEL, and UUID.  If there are  no
136              devices specified on the command line, all block devices will be
137              searched; otherwise only the specified devices are searched.
138
139       -v     Display version number and exit.
140
141       -w writecachefile
142              Write the device cache to writecachefile instead of  writing  it
143              to the default cache file.
144
145              This  functionality has never been implemented and the option is
146              no more supported on the recent blkid versions (>= v2.21).
147
148       device Display tokens from only the specified device.  It  is  possible
149              to give multiple device options on the command line.  If none is
150              given, all devices which appear in /proc/partitions  are  shown,
151              if they are recognized.
152

RETURN CODE

154       If the specified token was found, or if any tags were shown from (spec‐
155       ified) devices, 0 is returned.  If the specified token was  not  found,
156       or  no  (specified)  devices  could be identified, an exit code of 2 is
157       returned.  For usage or other errors, an exit code of 4 is returned.
158

AUTHOR

160       blkid was written by  Andreas  Dilger  for  libblkid  and  improved  by
161       Theodore Ts'o and Karel Zak.
162

AVAILABILITY

164       The blkid command is part of the util-linux-ng package and is available
165       from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
166

SEE ALSO

168       libblkid(3) findfs(8) wipefs(8)
169
170
171
172Linux                            February 2009                        BLKID(8)
Impressum