1

In my system, I have 1 drive connected to a SATA port, an SSD. CentOS 7 is installed to this disk. Also in the system, is an LSI HBA - an internal card connecting to a backplane with 24 spinning disks on it, used for storage.

The problem is that the boot disk is randomly assigned a device name on startup. I want to lock that specific disk to /dev/sda.

On my test system, it comes up as /dev/sdak. On another identical system, it comes up as /dev/sdac. Again, these systems are identical. They have the same number of drives, same components, everything. I need consistency in the devices for boot.

udev rules don't appear to have the power to re-assign kernel names. I can write one that will name it "fluffy_bunny_19", but I can't set it to be /dev/sda, like I want.

Does anyone know of a way to accomplish this?

3
  • Why do you need this specifically? Usually it's recommended to refer to disks by a UUID or another immutable identifier, precisely because the kernel's ordering of devices is arbitrary and not controllable. (For example, in most places where you could refer to /dev/sda1, you can also refer to UUID=<lots of hex chars> and have it work.)
    – Tom Hunt
    Oct 5, 2015 at 23:15
  • Hi Tom. These systems will need to be used in an automated deployment scheme, and that scheme relies on consistency among the /dev/sd* devices. I would be happy if I could get CentOS to reliably apply "/dev/sdak" to the boot disk across all of the units, but it does not. The same deployment script that works on unit 1 won't work on unit 2 because the device name has changed.
    – Locane
    Oct 6, 2015 at 0:02
  • Well, the technically-correct-but-unhelpful answer is that the scheme is broken, since kernel-assigned device nodes are inherently unpredictable. UUIDs might be more difficult, but if you can get udev to make links with a predictable (even if non-kernel) name, that might be easier to fix the script to use. Unfortunately I don't have any insight into how to assign a kernel name, so if the deploy script can't be modified I have no more ideas.
    – Tom Hunt
    Oct 6, 2015 at 4:45

1 Answer 1

1

UUID doesn't tell you anything. I have a little server with eight identical HGST drives in it - so WHICH one am I looking at ? Too much chance of mistakes using UUIDs.

The easiest work-around is to give the drives consistent labels when you format them and then use fstab to mount them by label to identical points in all your machines. Then you don't have to fool around with sda1,sda2,sdb1 and such for most any practical sort of operation.

Some system tools require a "/dev/[something]" rather than using a mountpoint ... but look in /dev and you'll see "/dev/disk/by-label" in there and you can usually use that instead of an "sda1" or whatever.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .