How to make disk letter /dev/sdX more likely to be consistent at each reboot
Issue
- At each boot, the disk letter will change at some rate, e.g. the same hard drive can be detected as /dev/sda at one reboot, and /dev/sdc at the next reboot.
- How to make sure the same drive is identified to /dev/sdX at each reboot?
Environment
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6
Caution! This is not applicable to RHEL 9 due to the addition of PROBE_PREFER_ASYNCHRONOUS which added full asynchronous lun discovery/probing. See "Unreliable disk detection order in 5.x" for a brief upstream discussion on this. Especially its conclusion "...even with {scsi_mod.scan=} synchronous scanning, device names are not reliable and there are no guarantees that one particular device will always have the same name".
Caution! In RHEL 8 and earlier, a loss or addition of a device, adding a USB device, reservation conflicts, replacing and moving a storage controller as well as other issues can result in the sdX assigned names changing versus expectations even when
scsi_mod.scan=sync
is specified on the grub boot line. The preferred and recommended method of accessing devices is either through a persistent disk name in/dev/disk/by-id
and similar or by using custom udev rules to create your own persistent disk names (although you cannot use sdX name space to do so).
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.