I have an HP xw8200 workstation running linux with two small, fast SCSI drives hooked up to the onboard LSI SCSI controller. The drives get labeled /dev/sda & /dev/sdb in /dev, respectively. I have a large SATA disk that I want to add to the system to store data, but every time I connect it, it's /dev gets assigned sda & the two scsi drives are assigned sdb,c, which messes with the boot procedure. How can I get this SATA drive to use sdc? Or what's the quickest way to get this set up?
The default order in which
sdc are assigned is unpredictable. But it can be overridden through
udev. You can control the name of the block device files by adding directives in
/etc/udev/rules.d/local.rules (some (older?) systems may only support
/etc/udev/rules.conf). Better, you can add directives to create symbolic links, and use those symbolic links in your
fstab. You can match by driver, by serial number, or call external programs to read things like filesystem UUIDs. The official documentation is a bit dry; if you need to write udev rules, you may prefer to start with a tutorial.
KERNEL=="sd*", DRIVERS="ahci", SYMLINK+="sata"
If you're using LVM exclusively on a drive, it doesn't matter what the letter the block device for the disk uses: you'll just be using the volume names. (That's one of the major advantages of LVM.)
If you look in
/dev/disk/by-*, you'll see various ways of naming disks that are part of udev's default setup:
/dev/disk/by-id (disk serial number and more),
/dev/disk/by-label (filesystem or other label),
/dev/disk/by-path (SCSI IDs and so on),
/dev/disk/by-uuid (filesystem UUIDs and the like). These may be sufficient for your purposes.
It's better to match filesystem labels or UUIDs than disk serial numbers, because those don't change if you crash a disk in a RAID array or restore from a byte-for-byte copy (or, for labels, make label restoration part of your recovery procedure). You can use filesystem UUIDs directly in
UUID=01234567-89ab-cdef-0123-456789abcdef in the first field, instead of a block device path.