Some Background...
I think this should be a general linux kernel (or kernel module) related question, though I'm facing the issue while preseeding debian for an automated installation.
Every time I boot the installer from a usb disk, the usb disk turns out to be /dev/sda, but the preseed file I'm using assumes the first hard disk (sata in this case) should be /dev/sda. I'm using the same system for a pxe network installation, and I would prefer to keep them consistent. I also fear that if I wrote a preseed config that assumed the first disk was sdb instead, that for some reason it might not be at some point.
I've tried writing udev rules that changes the device name of the usb disk to "INSTALLMEDIA" which seems to work, however it does not cause the SATA disk to start at sda, they still start at sdb.
My questions...
What determines the order that disks are discovered and named?
What, if anything, can I do to control this?
If I cannot do anything to control it, would it be safe to assume when booting from USB that the USB disk can be more or less guaranteed to be sda and the first SATA disk would always be sdb?
The most reliable answer to this question, that I'm aware of, is to use the newer symlinks that udev can create for you. Udev enumerates the disk drives, and creates several trees with devices - explaining for you what kind of devices they are.
This is located in /dev/disk.
You have, by-path:
Which clearly tells you if the device is a usb-device, for instance.
The other option would be to create your own symlink (or even a device file) if you can run some sort of script before you actually need to access the device. Something like
And as a very last resort solution you could "swap" the sda,sdb,... device files in /dev, but I would try hard to avoid this solution as it could introduce a lot of new problems.