[SOLVED] How do you change the order SCSI/SATA controllers are detected?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How do you change the order SCSI/SATA controllers are detected?
I'm running Slackware 14.1. I have 2 SATA controllers, an on-board 6 channel device, and an old PCI 6 channel device. The on-board device uses the ahci module. The old PCI controller uses the aacraid module.
It seems whatever I do Linux wants to place the aacraid controller as the first controller. I have disabled the bios on the card, both in the cards configuration utility (accessed with Ctrl-A), and then in the system bios. If I boot the system with no drives connected to the second (aacraid) controller, everything works.
If I boot the system with one drive on the second controller, it gets to lilo, but when I select the kernel it has problems booting. Now sda is sdb, sdb is sdc etc. I want to have the drives on the aacraid controller show up after the ones on the ahci controller.
Ive tried adding either of these to the append= statement in lilo.conf:
scsihosts=ahci:accraid
modprobe.blacklist=aacraid
no luck. Any ideas?
I really want to get the boot drive as sda, second as sdb etc on the ahci controller as I do alot of dd'ing on this machine for drive images.
I'm not sure how to ensure one controller is loaded before the other, but if you can't figure it out, you could always use persistent naming in your fstab and lilo. That would prevent the system from not booting up if the order gets changed. But you would need to be careful when dd'ing since the drives could be different than what you expected.
Strictly speaking you don't care what order the BIOS enumerates things. It's the decision on what to name as /dev/sda that matters - and that is under Linux control. I did have similar issues with a SATA/(E)IDE mix years ago, but whimped out and just used a distro that gave me the same (correct for me) device as /dev/sda consistently.
udev rules would be the place to look, but the initrd would have to be munged similarly.
Edit: fuzzy memories slowly clearing ...
There is also the small matter of where (which MBR) the bootloader gets installed onto. This is known once the device naming can be relied on - but may not be /dev/sda as one might normally expect. Been there, done that ...
Thanks for the replies, but I have now found a solution.
The drive order according to the BIOS was ok. Second controllers BIOS was disabled, so the BIOS had no knowledge of it. The problem was the order in which the kernel loads the built in modules. They seems to be roughly alphabetical order. aacraid is loaded before ahci. The built in modules cant be disabled as far as I can tell.
The trick is to remove the aacraid as a built in module and and set it as a loadable module. This causes the ahci module to be loaded first, then the aacraid module is loaded later. If the aacraid module *had* to be built-in I would still be screwed. According to the second resource you can edit the order of bulit-in modules in drivers/scsi/hosts.c of the kernel source. But perhaps this is old info as a grep for aacraid turned up no matches.
I am still passing the scsihosts=ahci:accraid command to the kernel in lilo, but it looks like this is doing nothing in kernel 4.5.2
The UUID method may work, but it looks like a elephantine solution to solve a simple problem. I suppose its good if you want to plug a drive into any spot on on a huge array, and it always comes up as sdb or whatever.
One last note, when building a kernel on a machine that things /dev/sda is /dev/sdb and vice-versa, lilo gets very confused. I had to boot without drives on the second controller and then run lilo.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.