Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

preface

In Linux, if a new SCSI disk is added or a SAN storage LUN is mapped, the disk identifier (SD *) may be incorrect after the operating system restarts.

introduce

For example, the disk identifier of the SAN STORAGE LUN is /dev/sdd. After the SAN storage LUN is restarted, it is found to be /dev/sdh. This situation is not expected especially in the Oracle RAC environment.

Before you can solve this problem, you need to understand the WWID and UUID numbers in Linux.

WWID

According to the SCSI standard, each SCSI disk has a WWID, which is similar to the MAC address of a network adapter. The requirements are unique.

In Linux, the /dev/disk/by-id directory contains the WWID access path of each SCSI disk.

To view the WWID of a disk:

Linux 6:

scsi_id -g -u /dev/sda
Copy the code

Linux 7/8:

/usr/lib/udev/scsi_id -g -u /dev/sda
Copy the code

UUID

UUID is generated when a file system is created, used to mark the file system, and is unique like WWID.

Therefore, using UUID to identify SCSI disks can also ensure that the path is permanent. On Linux, /dev/disk/by-uuid displays the mapping between each disk that has a file system created and /dev/sd*.

As of kernel 2.15.1, libuuid is part of the util-linux-ng package and is installed on Linux by default. UUID is generated by this library, and it is reasonable to assume that UUID is unique in one system, and unique in all systems.

The UUID is represented by 32 hexadecimal digits, which are displayed in five hyphenated groups. A total of 36 characters are displayed in the format of 8-4-4-4-12 (32 letters or digits and four hyphens).

As a Linux system administrator, you should know how to check the UUID of a partition or file system. Most Linux systems now mount partitions using UUID. You can verify this in the /etc/fstab file.

There are a number of utilities available to view UUID. In this article we will show you several ways to view UUID, and you can choose one that works for you.

For example: d92fa769 – fd7 e00f – 4 – b6ed – ecf7224af7fa

The UUID of the disk is unique and does not change with host restart. Therefore, the UUID is required when attaching the disk to the host. How do I obtain the UUID?

We can use the following seven commands to check.

  • blkidCommand: Locate or print block device properties.
  • lsblkCommand: lists all available or specified block devices.
  • hwinfoCommand: hardware information tool, is another good utility for querying existing hardware in the system.
  • udevadmCommand: udev management tool
  • tune2fsCommand: Adjust tunable file system parameters on an ext2/ext3/ext4 file system.
  • dumpe2fsCommand to query information about ext2, ext3, and ext4 file systems.
  • by-uuidPath: This directory contains the UUID and the actual block device file. The UUID is linked to the actual block device file.

To view the UUID of a disk, perform the following operations:

blkid
Copy the code

This is a brief introduction to the difference between UUID and WWID, and how to check!


This is the end of sharing ~

If you think the article is helpful to you, please like it, favorites it, pay attention to it, comment on it, and support it four times with one button. Your support is the biggest motivation for my creation.

❤️ technical exchange can follow the public number: Lucifer think twice before you do ❤️