blkid 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

blkid 命令安装:


-bash: blkid: command not found

#Debian
apt-get install util-linux

#Ubuntu
apt-get install util-linux

#Alpine
apk add util-linux

#Arch Linux
pacman -S util-linux

#Kali Linux
apt-get install util-linux

#CentOS
yum install util-linux

#Fedora
dnf install util-linux

#OS X
brew install util-linux

#Raspbian
apt-get install util-linux

#Docker
docker run cmd.cat/blkid blkid

blkid 命令补充说明:


在 Linux 下可以使用 blkid 命令 对查询设备上所采用文件系统类型进行查询。blkid 主要用来对系统的块设备(包括交换分区)所使用的文件系统类型、LABEL、UUID 等信息进行查询。要使用这个命令必须安装 e2fsprogs 软件包。

blkid 命令语法:


blkid -L | -U
blkid [-c ] [-ghlLv] [-o] [-s ][-t ] -[w ] [ ...]
blkid -p [-s ] [-O ] [-S ][-o] ...
blkid -i [-s ] [-o] ...

blkid 命令选项:


-c <file>   指定cache文件(default: /etc/blkid.tab, /dev/null = none)
-d          don't encode non-printing characters
-h          显示帮助信息
-g          garbage collect the blkid cache
-o <format> 指定输出格式
-k          list all known filesystems/RAIDs and exit
-s <tag>    显示指定信息,默认显示所有信息
-t <token>  find device with a specific token (NAME=value pair)
-l          look up only first device with token specified by -t
-L <label>  convert LABEL to device name
-U <uuid>   convert UUID to device name
-v          显示版本信息
-w <file>   write cache to different file (/dev/null = no write)
<dev>       specify device(s) to probe (default: all devices)
Low-level probing options:
-p          low-level superblocks probing (bypass cache)
-i          gather information about I/O limits
-S <size>   overwrite device size
-O <offset> probe at the given offset
-u <list>   filter by "usage" (e.g. -u filesystem,raid)
-n <list>   filter by filesystem type (e.g. -n vfat,ext3)

blkid 命令实例:


#列出当前系统中所有已挂载文件系统的类型:
sudo blkid

#显示指定设备 UUID:
sudo blkid -s UUID /dev/sda5

#显示所有设备 UUID:
blkid -s UUID

#显示指定设备 LABEL:
sudo blkid -s LABEL /dev/sda5

#显示所有设备 LABEL:
sudo blkid -s LABEL

#显示所有设备文件系统:
sudo blkid -s TYPE

#显示所有设备:
sudo blkid -o device

#以列表方式查看详细信息:
[root@Dev_Test ~]$blkid -o list
device         fs_type label    mount point        UUID
---------------------------------------------------------------------------------------
/dev/sda1      ext4             /boot              7efc8217-6770-446a-8346-8cea2f5fa0e4
/dev/sda2      ext4             /                  2827d2cb-7726-42a8-92e1-df8f7369cf4d
/dev/sda3      swap             <swap>             da3a90e7-fc05-4736-92cc-de05819379ff

blkid 命令扩展阅读:




blkid 命令评论