465 lines
14 KiB
HTML
465 lines
14 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of BLKID</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>BLKID</H1>
|
|
Section: System Administration (8)<BR>Updated: March 2013<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
blkid - locate/print block device attributes
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>blkid</B><DD>
|
|
<B>--label</B><I> label</I>
|
|
|
|
|
|
|
<B>--uuid</B><I> uuid</I>
|
|
|
|
<P>
|
|
<DT id="2"><B>blkid</B><DD>
|
|
[<B>--no-encoding</B>
|
|
|
|
<B>--garbage-collect --list-one --cache-file</B>
|
|
|
|
<I>file</I>]
|
|
|
|
[<B>--output</B>
|
|
|
|
<I>format</I>]
|
|
|
|
[<B>--match-tag</B>
|
|
|
|
<I>tag</I>]
|
|
|
|
[<B>--match-token</B>
|
|
|
|
<I>NAME=value</I>]
|
|
|
|
[<I>device</I> ...]
|
|
|
|
<P>
|
|
<DT id="3"><B>blkid</B><DD>
|
|
<B>--probe</B> [<B>--offset</B>
|
|
|
|
<I>offset</I>]
|
|
|
|
[<B>--output</B>
|
|
|
|
<I>format</I>]
|
|
|
|
[<B>--size</B>
|
|
|
|
<I>size</I>]
|
|
|
|
[<B>--match-tag</B>
|
|
|
|
<I>tag</I>]
|
|
|
|
[<B>--match-types</B>
|
|
|
|
<I>list</I>]
|
|
|
|
[<B>--usages</B>
|
|
|
|
<I>list</I>]
|
|
|
|
[<B>--no-part-details</B>]
|
|
|
|
<I>device</I> ...
|
|
|
|
<P>
|
|
<DT id="4"><B>blkid</B><DD>
|
|
<B>--info</B> [<B>--output</B>
|
|
|
|
<I>format</I>]
|
|
|
|
[<B>--match-tag</B>
|
|
|
|
<I>tag</I>]
|
|
|
|
<I>device</I> ...
|
|
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The
|
|
<B>blkid</B>
|
|
|
|
program is the command-line interface to working with the
|
|
<B><A HREF="/cgi-bin/man/man2html?3+libblkid">libblkid</A></B>(3)
|
|
|
|
library. It can determine the type of content (e.g. filesystem or swap)
|
|
that a block device holds, and also the attributes (tokens, NAME=value pairs)
|
|
from the content metadata (e.g. LABEL or UUID fields).
|
|
<P>
|
|
|
|
<B>It is recommended to use</B>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+lsblk">lsblk</A></B>(8)
|
|
|
|
<B>command to get information about block devices, or lsblk --fs to get an overview of filesystems, or</B>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+findmnt">findmnt</A></B>(8)
|
|
|
|
<B>to search in already mounted filesystems.</B>
|
|
|
|
<P>
|
|
|
|
<DL COMPACT><DT id="5"><DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?8+lsblk">lsblk</A></B>(8)
|
|
|
|
provides more information, better control on output formatting, easy to use in
|
|
scripts and it does not require root permissions to get actual information.
|
|
<B>blkid</B>
|
|
|
|
reads information directly from devices and for non-root users
|
|
it returns cached unverified information.
|
|
<B>blkid</B>
|
|
|
|
is mostly designed for system services and to test libblkid functionality.
|
|
</DL>
|
|
|
|
<P>
|
|
<P>
|
|
|
|
When
|
|
<I>device</I>
|
|
|
|
is specified, tokens from only this device are displayed.
|
|
It is possible to specify multiple
|
|
<I>device</I>
|
|
|
|
arguments on the command line.
|
|
If none is given, all partitions or unpartitioned devices which appear in
|
|
<I>/proc/partitions</I>
|
|
|
|
are shown, if they are recognized.
|
|
<P>
|
|
|
|
<B>blkid</B>
|
|
|
|
has two main forms of operation: either searching for a device with a
|
|
specific NAME=value pair, or displaying NAME=value pairs for one or
|
|
more specified devices.
|
|
<P>
|
|
For security reasons
|
|
<B>blkid</B>
|
|
|
|
silently ignores all devices where the probing result is ambivalent (multiple
|
|
colliding filesystems are detected). The low-level probing mode (<B>-p</B>)
|
|
provides more information and extra return code in this case.
|
|
It's recommended to use
|
|
<B><A HREF="/cgi-bin/man/man2html?8+wipefs">wipefs</A></B>(8)
|
|
|
|
to get a detailed overview and to erase obsolete stuff (magic strings) from the device.
|
|
<P>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
The <I>size</I> and <I>offset</I> arguments may be followed by the multiplicative
|
|
suffixes like KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB
|
|
(the "iB" is optional, e.g. "K" has the same meaning as "KiB"), or the suffixes
|
|
KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
|
|
<DL COMPACT>
|
|
<DT id="6"><B>-c</B>, <B>--cache-file</B> <I>cachefile</I><DD>
|
|
Read from
|
|
<I>cachefile</I>
|
|
|
|
instead of reading from the default cache file (see the CONFIGURATION FILE section
|
|
for more details). If you want to start with a clean cache (i.e. don't report
|
|
devices previously scanned but not necessarily available at this time), specify
|
|
<I>/dev/null</I>.
|
|
|
|
<DT id="7"><B>-d</B>, <B>--no-encoding</B><DD>
|
|
Don't encode non-printing characters. The non-printing characters are encoded
|
|
by ^ and M- notation by default. Note that the <B>--output udev</B> output format uses
|
|
a different encoding which cannot be disabled.
|
|
<DT id="8"><B>-D</B>, <B>--no-part-details</B> <DD>
|
|
Don't print information (PART_ENTRY_* tags) from partition table in low-level probing mode.
|
|
<DT id="9"><B>-g</B>, <B>--garbage-collect</B><DD>
|
|
Perform a garbage collection pass on the blkid cache to remove
|
|
devices which no longer exist.
|
|
<DT id="10"><B>-h</B>, <B>--help</B><DD>
|
|
Display a usage message and exit.
|
|
<DT id="11"><B>-i</B>, <B>--info</B><DD>
|
|
Display information about I/O Limits (aka I/O topology). The 'export' output format is
|
|
automatically enabled. This option can be used together with the <B>--probe</B> option.
|
|
<DT id="12"><B>-k</B>, <B>--list-filesystems</B><DD>
|
|
List all known filesystems and RAIDs and exit.
|
|
<DT id="13"><B>-l</B>, <B>--list-one</B><DD>
|
|
Look up only one device that matches the search parameter specified with the <B>--match-token</B>
|
|
option. If there are multiple devices that match the specified search
|
|
parameter, then the device with the highest priority is returned, and/or
|
|
the first device found at a given priority. Device types in order of
|
|
decreasing priority are: Device Mapper, EVMS, LVM, MD, and finally regular
|
|
block devices. If this option is not specified,
|
|
<B>blkid</B>
|
|
|
|
will print all of the devices that match the search parameter.
|
|
<DT id="14"><B>-L</B>, <B>--label</B> <I>label</I><DD>
|
|
Look up the device that uses this filesystem <I>label</I>; this is equal to
|
|
<B>--list-one --output device --match-token LABEL=</B><I>label</I>.
|
|
|
|
This lookup method is able to reliably use /dev/disk/by-label
|
|
udev symlinks (dependent on a setting in /etc/blkid.conf). Avoid using the
|
|
symlinks directly; it is not reliable to use the symlinks without verification.
|
|
The <B>--label</B> option works on systems with and without udev.
|
|
<P>
|
|
Unfortunately, the original
|
|
<B><A HREF="/cgi-bin/man/man2html?8+blkid">blkid</A></B>(8)
|
|
|
|
from e2fsprogs uses the <B>-L</B> option as a
|
|
synonym for <B>-o list</B>. For better portability, use <B>-l -o device
|
|
-t LABEL=</B><I>label</I> and <B>-o list</B> in your scripts rather than the <B>-L</B> option.
|
|
<DT id="15"><B>-n</B>, <B>--match-types</B> <I>list</I><DD>
|
|
Restrict the probing functions to the specified (comma-separated) <I>list</I> of
|
|
superblock types (names).
|
|
The list items may be prefixed with "no" to specify the types which should be ignored.
|
|
For example:
|
|
<P>
|
|
<BR> blkid --probe --match-types vfat,ext3,ext4 /dev/sda1
|
|
<P>
|
|
probes for vfat, ext3 and ext4 filesystems, and
|
|
<P>
|
|
<BR> blkid --probe --match-types nominix /dev/sda1
|
|
<P>
|
|
probes for all supported formats except minix filesystems.
|
|
This option is only useful together with <B>--probe</B>.
|
|
<DT id="16"><B>-o</B>, <B>--output</B> <I>format</I><DD>
|
|
Use the specified output format. Note that the order of variables and
|
|
devices is not fixed. See also option <B>-s</B>. The
|
|
<I>format</I>
|
|
|
|
parameter may be:
|
|
<DL COMPACT><DT id="17"><DD>
|
|
<DL COMPACT>
|
|
<DT id="18"><B>full</B>
|
|
|
|
<DD>
|
|
print all tags (the default)
|
|
<DT id="19"><B>value</B>
|
|
|
|
<DD>
|
|
print the value of the tags
|
|
<DT id="20"><B>list</B>
|
|
|
|
<DD>
|
|
print the devices in a user-friendly format; this output format is unsupported
|
|
for low-level probing (<B>--probe</B> or <B>--info</B>).
|
|
<P>
|
|
This output format is <B>DEPRECATED</B> in favour of the
|
|
<B><A HREF="/cgi-bin/man/man2html?8+lsblk">lsblk</A></B>(8)
|
|
|
|
command.
|
|
<DT id="21"><B>device</B>
|
|
|
|
<DD>
|
|
print the device name only; this output format is always enabled for the <B>--label</B>
|
|
and <B>--uuid</B> options
|
|
<DT id="22"><B>udev</B>
|
|
|
|
<DD>
|
|
print key="value" pairs for easy import into the udev environment; the keys are
|
|
prefixed by ID_FS_ or ID_PART_ prefixes. The value may be modified to be
|
|
safe for udev environment; allowed is plain ASCII, hex-escaping and valid UTF-8,
|
|
everything else (including whitespaces) is replaced with '_'. The keys with
|
|
_ENC postfix use hex-escaping for unsafe chars.
|
|
<P>
|
|
The udev output returns the ID_FS_AMBIVALENT tag if more superblocks are detected,
|
|
and ID_PART_ENTRY_* tags are always returned for all partitions including empty
|
|
partitions.
|
|
<P>
|
|
This output format is <B>DEPRECATED</B>.
|
|
<DT id="23"><B>export</B>
|
|
|
|
<DD>
|
|
print key=value pairs for easy import into the environment; this output format
|
|
is automatically enabled when I/O Limits (<B>--info</B> option) are requested.
|
|
<P>
|
|
The non-printing characters are encoded by ^ and M- notation and all
|
|
potentially unsafe characters are escaped.
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="24"><B>-O</B>, <B>--offset</B> <I>offset</I><DD>
|
|
Probe at the given <I>offset</I> (only useful with <B>--probe</B>). This option can be
|
|
used together with the <B>--info</B> option.
|
|
<DT id="25"><B>-p</B>, <B>--probe</B><DD>
|
|
Switch to low-level superblock probing mode (bypassing the cache).
|
|
<P>
|
|
Note that low-level probing also returns information about partition table type
|
|
(PTTYPE tag) and partitions (PART_ENTRY_* tags). The tag names produced by
|
|
low-level probing are based on names used internally by libblkid and it may be
|
|
different than when executed without <B>--probe</B> (for example PART_ENTRY_UUID= vs
|
|
PARTUUID=). See also <B>--no-part-details</B>.
|
|
<DT id="26"><B>-s</B>, <B>--match-tag</B> <I>tag</I><DD>
|
|
For each (specified) device, show only the tags that match
|
|
<I>tag</I>.
|
|
|
|
It is possible to specify multiple
|
|
<B>--match-tag</B>
|
|
|
|
options. If no tag is specified, then all tokens are shown for all
|
|
(specified) devices.
|
|
In order to just refresh the cache without showing any tokens, use
|
|
<B>--match-tag none</B>
|
|
|
|
with no other options.
|
|
<DT id="27"><B>-S</B>, <B>--size</B> <I>size</I><DD>
|
|
Override the size of device/file (only useful with <B>--probe</B>).
|
|
<DT id="28"><B>-t</B>, <B>--match-token</B> <I>NAME=value</I><DD>
|
|
Search for block devices with tokens named
|
|
<I>NAME</I>
|
|
|
|
that have the value
|
|
<I>value</I>,
|
|
|
|
and display any devices which are found.
|
|
Common values for
|
|
<I>NAME</I>
|
|
|
|
include
|
|
<B>TYPE</B>,
|
|
|
|
<B>LABEL</B>,
|
|
|
|
and
|
|
<B>UUID</B>.
|
|
|
|
If there are no devices specified on the command line, all block devices
|
|
will be searched; otherwise only the specified devices are searched.
|
|
<DT id="29"><B>-u</B>, <B>--usages</B> <I>list</I><DD>
|
|
Restrict the probing functions to the specified (comma-separated) <I>list</I> of "usage" types.
|
|
Supported usage types are: filesystem, raid, crypto and other. The list items may be
|
|
prefixed with "no" to specify the usage types which should be ignored. For example:
|
|
<P>
|
|
<BR> blkid --probe --usages filesystem,other /dev/sda1
|
|
<P>
|
|
probes for all filesystem and other (e.g. swap) formats, and
|
|
<P>
|
|
<BR> blkid --probe --usages noraid /dev/sda1
|
|
<P>
|
|
probes for all supported formats except RAIDs.
|
|
This option is only useful together with <B>--probe</B>.
|
|
<DT id="30"><B>-U</B>, <B>--uuid</B> <I>uuid</I><DD>
|
|
Look up the device that uses this filesystem <I>uuid</I>. For more details see the
|
|
<B>--label</B> option.
|
|
<DT id="31"><B>-V</B>, <B>--version</B><DD>
|
|
Display version number and exit.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>RETURN CODE</H2>
|
|
|
|
If the specified device or device addressed by specified token (option
|
|
<B>--match-token</B>) was found and it's possible to gather any information about the
|
|
device, an exit code 0 is returned. Note the option <B>--match-tag</B> filters output
|
|
tags, but it does not affect return code.
|
|
<P>
|
|
If the specified token was not found, or no (specified) devices could be
|
|
identified, or it is impossible to gather any information about the device
|
|
identifiers or device content an exit code of 2 is returned.
|
|
<P>
|
|
For usage or other errors, an exit code of 4 is returned.
|
|
<P>
|
|
If an ambivalent probing result was detected by low-level probing mode (<B>-p</B>), an exit code of 8 is
|
|
returned.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>CONFIGURATION FILE</H2>
|
|
|
|
The standard location of the
|
|
<I>/etc/blkid.conf</I>
|
|
|
|
config file can be overridden by the environment variable BLKID_CONF.
|
|
The following options control the libblkid library:
|
|
<DL COMPACT>
|
|
<DT id="32"><I>SEND_UEVENT=<yes|not></I>
|
|
|
|
<DD>
|
|
Sends uevent when
|
|
<I>/dev/disk/by-{label,uuid,partuuid,partlabel}/</I>
|
|
|
|
symlink does not match with LABEL, UUID, PARTUUID or PARTLABEL on the device. Default is "yes".
|
|
<DT id="33"><I>CACHE_FILE=<path></I>
|
|
|
|
<DD>
|
|
Overrides the standard location of the cache file. This setting can be
|
|
overridden by the environment variable BLKID_FILE. Default is
|
|
<I>/run/blkid/blkid.tab</I>,
|
|
|
|
or
|
|
<I>/etc/blkid.tab</I>
|
|
|
|
on systems without a /run directory.
|
|
<DT id="34"><I>EVALUATE=<methods></I>
|
|
|
|
<DD>
|
|
Defines LABEL and UUID evaluation method(s). Currently, the libblkid library
|
|
supports the "udev" and "scan" methods. More than one method may be specified in
|
|
a comma-separated list. Default is "udev,scan". The "udev" method uses udev
|
|
<I>/dev/disk/by-*</I>
|
|
|
|
symlinks and the "scan" method scans all block devices from the
|
|
<I>/proc/partitions</I>
|
|
|
|
file.
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
<B>blkid</B>
|
|
|
|
was written by Andreas Dilger for libblkid and improved by Theodore Ts'o
|
|
and Karel Zak.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>ENVIRONMENT</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="35">Setting LIBBLKID_DEBUG=all enables debug output.<DD>
|
|
</DL>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+libblkid">libblkid</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+findfs">findfs</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+lsblk">lsblk</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+wipefs">wipefs</A></B>(8)
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>AVAILABILITY</H2>
|
|
|
|
The blkid command is part of the util-linux package and is available from
|
|
<A HREF="https://www.kernel.org/pub/linux/utils/util-linux/.">https://www.kernel.org/pub/linux/utils/util-linux/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="36"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="37"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="38"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="39"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="40"><A HREF="#lbAF">RETURN CODE</A><DD>
|
|
<DT id="41"><A HREF="#lbAG">CONFIGURATION FILE</A><DD>
|
|
<DT id="42"><A HREF="#lbAH">AUTHOR</A><DD>
|
|
<DT id="43"><A HREF="#lbAI">ENVIRONMENT</A><DD>
|
|
<DT id="44"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="45"><A HREF="#lbAK">AVAILABILITY</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:11 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|