Fix the device path for a SCSI device with multiple HBA adapters

I was installing Bacula on my server, and I got the following problem: Because I have several SCSI adapters, something changed the enumeration order of the adapters, causing the SCSI devices to be enumerated in a different order. Now, for hard drives it is mostly a non-issue, as the uuid and LVM take care of mounting the correct partition on the right place. The exception to this is during boot, but that can be solved one way or another.

However, the situation is different for tape drives (and my autochanger). The change in order moved the generic SCSI device number, and swapped the number of both my tape drives. So it ended up in Bacula that the autochanger was not the autochanger, the tape drive of the autoloader was not the one in the changer, and the comands where sent to all the wrong devices. Besides changing the reference, I wanted to avoid this from happening again.
Continue reading