Here is an introduction to storage Device Names Managed by the udev mechanism (/dev/disk/by-*)
The udev mechanism consists of three major components:

The kernel
Generates events taht are sent to userspace when devices are added, removed or changed.
The udevd daemon
Receives the events.
The udev rules
Specifies the action to take when the ud ev daemon receives the kernel events.

This mechanism is used for all types of devices in Linux, not just for storage devices. In the case of storage devices, Red Linux Enterprise Linux contains ud ev rules that create symbolic links in the /dev/disk directory allowing storage devices to be referred to by their contents, a unique identifier, their serial number, or the hardware path used to access the device.

/dev/disk/by-label

Entries in this directory provide a symbolic name that refers to the storage device by a label in the contents (that is, the data) stored on the device. The bl ki d program is used to read data from the device and determine a name (that is, a label) for the device. For example:

/dev/disk/by-label/Boot

Note
The information is obtained from the contents (that is, the data) on the device so if the contents are copied to another device, the label will remain the same.
The label can also be used to refer to the device in /etc/fstab using the following syntax:

LABEL=Boot
/dev/disk/by-uuid

Entries in this directory provide a symbolic name that refers to the storage device by a unique identifier in the contents (that is, the data) stored on the device. The blkid program is used to read data from the device and obtain a unique identifier (that is, the uuid) for the device. For example:

UUID=3e6be9de-8139-11d1-9106-a43f08d823a6

/dev/disk/by-id

Entries in this directory provide a symbolic name that refers to the storage device by a unique identifier (different from all other storage devices). The identifier is a property of the device but is not stored in the contents (that is, the data) on the devices. For example:

/dev/disk/by-id/scsi-3600508e000000000ce506dc50ab0ad05
/dev/disk/by-id/wwn-0x600508e000000000ce506dc50ab0ad05

The id is obtained from the world-wide ID of the device, or the device serial number. The /dev/disk/by-id entries may also include a partition number. For example:

/dev/disk/by-id/scsi-3600508e000000000ce506dc50ab0ad05-part1
/dev/disk/by-id/wwn-0x600508e000000000ce506dc50ab0ad05-part1

/dev/disk/by-path 

Entries in this directory provide a symbolic name that refers to the storage device by the hardware path used to access the device, beginning with a reference to the storage controller in the PCI hierachy, and including the SCSI host, channel, target, and LUN numbers and, optionally, the partition number. Although these names are preferable to using major and minor numbers or sd names, caution must be used to ensure that the target numbers do not change in a Fibre Channel SAN environment (for example, through the use of persistent binding) and that the use of the names is updated if a host adapter is moved to a different PCI slot. In addition, there is the possibility that the SCSI host numbers could change if a HBA fails to probe, if drivers are loaded in a different order, or if a new HBA is installed on the system. An example of by-path listing is:

/dev/disk/by-path/pci-0000:03:00.0-scsi-0:1:0:0

The /dev/disk/by-path entries may also include a partition number, such as:

/dev/disk/by-path/pci-0000:03:00.0-scsi-0:1:0:0-part1

 

Comments powered by CComment