Linux drive letter drift problem
Hi,when the system is restarted, the storage lun drive letter is /dev/sda
, and after the restart, it becomes /dev/sdc
or other.
We tried to use the Udev strategy to create the 58-storage.rule
rule to solve this problem, but when the system restarts, it prompts that the udev version does not support renaming kernel device nodes, such as "NAME=/sda%n ignored, kernel device nodes can not be renamed; please fix it in /etc/udev/rules.d/10-test.rules:2"
. We want to fix the drive letter under /dev/sda
, so how do we solve this problem?
Among them, the linux version number is Linux nas 3.10.0-693.el7.x86_64
, and the query result of using the rpm -qa | grep udev
command is libgudev1-219-42.el7_4.1.x86_64
, python-pyudev-0.15- 9.el7.noarch
, and the rules information is as follows:
[root@RHEL7X rules.d]# cat 58-storage.rule
SUBSYSTEMS=="scsi",SUBSYSTEM=="block",KERNELS=="2:0:0:1",NAME="/sda%n"
Thank you advance for sharing your experience here.
Responses
sdX
SCSI device names are not expected to be consistent between reboots, or even across add/remove of devices during the one uptime.
You should address the device via some other means, such as by its UUID which you can find with the blkid
command.
If you can say where you are intending to use the letter like /dev/sda
then we may be able to give some advice.
Here is an example usage in /etc/fstab
:
$ sudo blkid | grep sda1
/dev/sda1: UUID="268a25bf-db56-4fc9-edbd-458fc9c9ab61" TYPE="ext4" PARTUUID="51f8e6a4-01"
$ grep 268a25bf /etc/fstab
UUID=268a25bf-db56-4fc9-edbd-458fc9c9ab61 /boot ext4 defaults,noatime 0 2
Why specifically do you need /dev/sda
? What application or user experience is changed by this SCSI device letter being different?
If you have some application or script which depends on /dev/sdX
being consistent between boots, that is the incorrect way to address underlying storage devices.
Applications and users should not care what SCSI device letter a particular storage gets, because those sdX
letters can change and are expected to change.
Instead, the storage should be addressed by some unique and permanent property, such as the LUN WWID or filesystem UUID.
hi Shui,
Using SAN via a single path approach?
I would advise you to reconsider the architecture, I would setup device-mapper-multipath.
In the configuration file you can setup specific names.
using classic scsi device names I would only for a system with internal disks.
I do not understand your remark about user experience.
An user should use the mountpoints, not the partitions, except if they write raw data (which I expect only from an Oracle DBA or a scientist using a near realtime data flow).
Regards,
Jan Gerrit Kootstra
Yes, could be possible. First gather the LUN/Disk specific unique details by using the command 'udevadm info -a -n /dev/sdX' and then create a rule by adding LUN/Disk specific attributes in your custom file under /etc/udev/rules.d/ directory. May be a SYMLINK attribute would get you create a custom/unique device symbolic link and which can be used later as a reference. Please refer this KB for more details https://access.redhat.com/solutions/1135513