And I really wanted to circle back around to this and talk about it for a second, but I had lost the message.
Back in the good old days, we had UNIX devices like "/dev/sd0" (SunOS) and then these could be mapped by kernel config lines to a SCSI target ID.
If you didn't, then the OS would enumerate the devices as they were discovered. In many simple cases, that was just dandy. If you only have two disks on one SCSI bus, one is numbered 0, the other 1, then you have /dev/da0 and /dev/da1 and life is fine.
But if you had multiple SCSI busses and lots of devices... it meant that you had to keep careful track of where your devices were, lest the kernel automatically allocate them in some random order. So back in the days of FreeBSD 3, a large disk kernel config might look like (this is a real config incidentally):
Code:
# SCSI peripherals
# Only one of each of these is needed, they are dynamically allocated.
controller scbus0 at SCBUS0
controller scbus1 at SCBUS1
controller scbus2 at SCBUS2
controller scbus3 at SCBUS3
controller scbus4 at SCBUS4
disk da0 at scbus0 target 0 unit 0
disk da1 at scbus0 target 1 unit 0
disk da2 at scbus0 target 2 unit 0
disk da3 at scbus0 target 3 unit 0
disk da4 at scbus0 target 4 unit 0
disk da5 at scbus0 target 5 unit 0
disk da6 at scbus0 target 6 unit 0
disk da8 at scbus0 target 8 unit 0
disk da9 at scbus0 target 9 unit 0
disk da10 at scbus1 target 0 unit 0
disk da11 at scbus1 target 1 unit 0
disk da12 at scbus1 target 2 unit 0
disk da13 at scbus1 target 3 unit 0
disk da14 at scbus1 target 4 unit 0
disk da15 at scbus1 target 5 unit 0
disk da16 at scbus1 target 6 unit 0
disk da18 at scbus1 target 8 unit 0
disk da19 at scbus1 target 9 unit 0
disk da20 at scbus2 target 0 unit 0
disk da21 at scbus2 target 1 unit 0
disk da22 at scbus2 target 2 unit 0
disk da23 at scbus2 target 3 unit 0
disk da24 at scbus2 target 4 unit 0
disk da25 at scbus2 target 5 unit 0
disk da26 at scbus2 target 6 unit 0
disk da28 at scbus2 target 8 unit 0
disk da29 at scbus2 target 9 unit 0
disk da30 at scbus3 target 0 unit 0
disk da31 at scbus3 target 1 unit 0
disk da32 at scbus3 target 2 unit 0
disk da33 at scbus3 target 3 unit 0
disk da34 at scbus3 target 4 unit 0
disk da35 at scbus3 target 5 unit 0
disk da36 at scbus3 target 6 unit 0
disk da38 at scbus3 target 8 unit 0
disk da39 at scbus3 target 9 unit 0
disk da40 at scbus4 target 0 unit 0
disk da41 at scbus4 target 1 unit 0
disk da42 at scbus4 target 2 unit 0
disk da43 at scbus4 target 3 unit 0
disk da44 at scbus4 target 4 unit 0
disk da45 at scbus4 target 5 unit 0
disk da46 at scbus4 target 6 unit 0
disk da48 at scbus4 target 8 unit 0
disk da49 at scbus4 target 9 unit 0
which is actually humanly-interpretable to mean that "da41" is the first device on the fourth SCSI bus. This kind of thing was a necessary sanity-hack. Then you could use ccd (disk concatenation) to create your meta-devices
Code:
ccd0 110592 none /dev/da10s1f /dev/da20s1f /dev/da30s1f /dev/da40s1f
ccd1 110592 none /dev/da11s1f /dev/da21s1f /dev/da31s1f /dev/da41s1f
ccd2 110592 none /dev/da12s1f /dev/da22s1f /dev/da32s1f /dev/da42s1f
ccd3 110592 none /dev/da13s1f /dev/da23s1f /dev/da33s1f /dev/da43s1f
ccd4 110592 none /dev/da14s1f /dev/da24s1f /dev/da34s1f /dev/da44s1f
ccd5 110592 none /dev/da15s1f /dev/da25s1f /dev/da35s1f /dev/da45s1f
ccd6 110592 none /dev/da16s1f /dev/da26s1f /dev/da36s1f /dev/da46s1f
ccd8 110592 none /dev/da18s1f /dev/da28s1f /dev/da38s1f /dev/da48s1f
ccd9 110592 none /dev/da19s1f /dev/da29s1f /dev/da39s1f /dev/da49s1f
ccd10 128 none /dev/da10s1e /dev/da11s1e /dev/da12s1e /dev/da13s1e /dev/da14s1e /dev/da15s1e /dev/da16s1e /dev/da18s1e /dev/da19s1e /dev/da20s1e /dev/da21s1e /dev/da22s1e /dev/da23s1e /dev/da24s1e /dev/da25s1e /dev/da26s1e /dev/da28s1e /dev/da29s1e /dev/da30s1e /dev/da31s1e /dev/da32s1e /dev/da33s1e /dev/da34s1e /dev/da35s1e /dev/da36s1e /dev/da38s1e /dev/da39s1e /dev/da40s1e /dev/da41s1e /dev/da42s1e /dev/da43s1e /dev/da44s1e /dev/da45s1e /dev/da46s1e /dev/da48s1e /dev/da49s1e
and this worked swimmingly well. However, if you had the misfortune to connect your SCSI busses in the wrong order, all hell would still let loose...
So the thing that's really broken here is that "da14" for example refers to a device by I/O location, "SCSI bus 1, disk 4". Locking these down does indeed prevent lots of headaches, but it was really only a partial solution to a significant problem.
From the UNIX system's point of view, it doesn't really care what the device is named, or what kind of controller it is on. This is already abstracted away, and we could swap out models of SCSI controllers easily (which is substituted into these configs where you see CAPITAL LETTER SCBUS# above). It doesn't know or care that da14 is a Seagate ST150176LW on an Adaptec 3940. It already had all the capability to abstract that out to a generic device name.
The problem is that this was really only half the challenge. What you really want is to refer to a target device by an abstract name that doesn't change as it moves from one SCSI bus to another.
That's where GPT and the gpart tool come in.
Your FreeBSD disk devices still enumerate as /dev/da# but you can use GPT to label partitions. You can either name them explicitly, which is what I do for most modern FreeBSD installs, or the system will assign a UUID when creating it. This means your /dev/da4p1 also shows up as /dev/gptid/1234-some-big-hex-num-5678
But more importantly, when you REMOVE it from the system and put it on a different port, it will no longer show up as /dev/da4p1 but it WILL show up in /dev/gptid/1234-some-big-hex-num-5678
That means that if you access your devices by GPT labels, you are no longer dependent on physical device names. Hooray.