How to use the blkid command in Linux to query device and file system information

Source: Internet
Author: User
Tags uuid

Under Linux You can use the Blkid command to query the file system type used on the query device. Blkid is mainly used to query the file system type, LABEL, UUID, etc. used by the system's block devices (including the swap partition). To use this command, you must install the E2fsprogs package.

Use Blkid directly to list the types of file systems that are already mounted on the current system.
By default lsblk will output a block device in a tree format:
Name of the name--device
Each device in the Maj:min--linux operating system is represented as a file, and for a block (disk) device, the device is described here with a primary and secondary device number.
rm--removable devices. If this is a removable device will display 1, otherwise show 0.
Types of type--devices
Location of mountpoint--device mount
ro--for read-only file systems, this will show 1, or 0.
Capacity of size--Equipment

Blkid Use Example:

The code is as follows:

[Root@localhost ~]# blkid-s uuid/dev/sda5 #显示指定设备 UUID
/dev/sda5:uuid= "Cad7349a-601d-4df4-a46b-90e1ffc29b1b"

The code is as follows:

[Root@localhost ~]# blkid-s uuid #显示所有设备 UUID
/dev/sda5:uuid= "Cad7349a-601d-4df4-a46b-90e1ffc29b1b"
/dev/sda1:uuid= "d7899bc2-b08e-48cd-b904-54956c085951"

The code is as follows:

[Root@localhost ~]# blkid-s label/dev/sda5 #显示指定设备 LABEL
/dev/sda5:label= "Disk E"

The code is as follows:

[root@localhost ~]# blkid-s label #显示所有设备 label
/dev/sda1:label= "M-fm-^vm-0m-em-^jm-m-em-^mm-7"
/dev/sda5:label= "Disk E"

The code is as follows:

[Root@localhost ~]# blkid-s TYPE #显示所有设备文件系统
/dev/sda5:type= "Swap"
/dev/sda1:type= "Ext4"

The code is as follows:

[root@localhost ~]# blkid-o device #显示所有设备
/dev/sda5
/dev/sda1

The code is as follows:

root@tnak-virtualbox:/home/tnak# blkid-o list   #以列表方式查看详细信息
Device                     fs_type     label        mount point                    UUID
------------------------------------------------------------------ ---------------------
/dev/sda5 swap cad7349a-601d-4df4-a46b-90e1ffc29b1b
/dev/sda1 ext4/ d7899bc2-b08e-48cd-b904-54956c085951

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.