Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to check the device UUID under Linux

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to view the device UUID under Linux. Xiaobian thinks it is quite practical, so share it with you as a reference. I hope you can gain something after reading this article.

UUID provides a unique identification string for a storage device in the system, regardless of the type of device. If you start in the system, when using the drive letter mount, you may not find the device and the load fails, but when using the UUID mount, there will be no such problem. (It is best to mount the device using UUID. If you mount the device using device name, it may not be found after restarting)

How do I use the blkid command in Linux to see the UUID of a disk partition or file system?

blkid is a command-line utility for locating or printing block device properties. It uses the libblkid library to obtain the UUID to the disk partition in Linux systems.

# blkid/dev/sda1: UUID="d92fa769-e00f-4fd7-b6ed-ecf7224af7fa" TYPE="ext4" PARTUUID="eab59449-01"/dev/sdc1: UUID="d17e3c31-e2c9-4f11-809c-94a549bc43b7" TYPE="ext2" PARTUUID="8cc8f9e5-01"/dev/sdc3: UUID="ca307aa4-0866-49b1-8184-004025789e63" TYPE="ext4" PARTUUID="8cc8f9e5-03"/dev/sdc5: PARTUUID="8cc8f9e5-05" How do I use the lsblk command in Linux to view the UUID of a disk partition or file system?

lsblk lists all information about available or specified block devices. The lsblk command reads the sysfs file system and udev database to gather information.

If the udev database is unavailable or the compiled lsblk does not support udev, it attempts to read the label, UUID, and file system type from the block device. In this case, you must run as root. By default, this command prints out all block devices (except RAM disks) in a tree-like format.

# lsblk -o name,mountpoint,size, uuidNAME MOUNTPOINT SIZE UUIDsda 30G└─sda1 / 20G d92fa769-e00f-4fd7-b6ed-ecf7224af7fasdb 10Gsdc 10G├─sdc1 1G d17e3c31-e2c9-4f11-809c-94a549bc43b7├─sdc3 1G ca307aa4-0866-49b1-8184- 004025789e63 $> ─sdc4 1K ─sdc5 1Gsdd 10 Gsde 10Gsr0 1024MLinux How to use by-uuid path to view UUID of disk partition or file system?

This directory contains the UUID linked to the actual block device file and the actual block device file.

# ls -lh /dev/disk/by-uuid/total 0lrwxrwxrwx 1 root root 10 Jan 29 08:34 ca307aa4-0866-49b1-8184-004025789e63 -> ../../ sdc3lrwxrwxrwx 1 root root 10 Jan 29 08:34 d17e3c31-e2c9-4f11-809c-94a549bc43b7 -> ../../ sdc1lrwxrwxrwx 1 root root 10 Jan 29 08:34 d92fa769-e00f-4fd7-b6ed-ecf7224af7fa -> ../../ sda1 How do I use the hwinfo command in Linux to view the UUID of a disk partition or file system?

Hwinfo, which stands for hardware information tool, is another great utility. It is used to detect hardware already present in the system and to display details of various hardware components in a readable format.

# hwinfo --block | grep by-uuid |awk '{print $3,$7}'/dev/sdc1, /dev/disk/by-uuid/d17e3c31-e2c9-4f11-809c-94a549bc43b7/dev/sdc3, /dev/disk/by-uuid/ca307aa4-0866-49b1-8184-004025789e63/dev/sda1,/dev/disk/by-uuid/d92fa769-e00f-4fd7-b6ed-ecf7224af7 faHow do I use the udevadm command to view the UUID of a disk partition or file system in Linux?

udevadm requires commands and command-specific actions. It controls the runtime behavior of systemd-udevd, requests kernel events, manages event queues, and provides simple debugging mechanisms.

# udevadm info -q all -n /dev/sdc1 | grep -i by-uuid |head -1S: disk/by-uuid/d17e3c31-e2c9-4f11-809c-94a549bc43b7 How do I view the UUID of a disk partition or file system using the tune2fs command in Linux?

tune2fs allows system administrators to adjust various tunable file system parameters in the ext2, ext3, and ext4 file systems of Linux. The current values of these options can be displayed using the option-l.

# tune2fs -l /dev/sdc1 |grep UUIDFilesystem UUID: d17e3c31-e2c9-4f11-809c-94a549bc43b7 How do I use the dumpe2fs command in Linux to view the UUID of a disk partition or file system?

Dumpe2fs prints information about superblocks and blockgroups that appear in the device file system.

# dumpe2fs /dev/sdc1 | grep UUIDdumpe2fs 1.43.5 (04-Aug-2017)Filesystem UUID: d17e3c31-e2c9-4f11-809c-94a549bc43b7

About "How to view device UUID under Linux" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report