I might have solved the problem, or at least found a few more pieces of the puzzle. I finally noticed when running the rescan-scsi-bus
script with the -r
option I received an error message at line 262. This line is in a subroutine named getluns
. That line makes a call to /usr/bin/sg_luns
. No such command was on my box.
A quick check of the web revealed that the sg3_utils
package was available at slacky.eu. I downloaded, compiled, and installed the package. No more error messages.
However, I'm uncertain of the correct syntax when using the -r
option. Seems I have to pass the full SCSI address (host, channel, ID, lun), which first requires manually listing all the devices. I could programmatically extract those four elements from the lsscsi command if I correctly identify the device. I think if only one device is on a particular host that I need only pass that first element. I'm still trying to learn more.
If I do not pass parameters with the -r option, then my internal SATA drive is removed from the scsi list too. Not good --- so some restrictive parameters seem to be necessary to remove only one device.
Perhaps this makes sense, but my thinking was that I could power down the device and then run rescan-scsi-bus
to update my scsi list. However a "mere" rescan does not remove devices from the list. I also presumed that the -r option was programmatically intelligent to notice the device is gone and remove from the list. Apparently this is not so as I need to be more explicit when using the -r option. Someone correct me if I'm off on a tangent and missing the big picture! I would be happy to learn the problem is a syntax misunderstanding by me.
This all seems far to manual and clunky, but then again, SATA does not operate the same as USB and DVDs/CDs. From an electronics perspective SATA is hot pluggable, but that seems about all that is accomplished with the Linux kernel. A script would automate the disconnection process, of course.
I'm wondering whether PV knows that the rescan-scsi-bus
script cannot remove devices because the sg3_utils package is not included in the stock Slackware. The rescan-scsi-bus
script is included in the a/sysvinit-scripts
package, but that is all.
I appreciate any further thoughts.