One of my SATA drives has failed and needs to be replaced. I have tried to find out if I can hot swap it instead of having to turn off the computer (which isn’t a big deal, but it’s nice if I don’t have to), and the answer seems to be that while Linux should handle hot swapping just fine, the outcome really depends on the SATA controller.
So there should be a simple command that lists the controller for any given block device, right? Perhaps there is, or perhaps there is some simple few-step process to do it. But my Google-fu must be weak right now, because I cannot find any easy or simple way to achieve what I want.
So I came up with the following quite convoluted way to do it:
I have tested it successfully on my main Ubuntu server (the one that has
the failed disk) and one of my virtual Ubuntu servers. On another
virtual Ubuntu server
/sys/block isn’t available, and
bash is old
enough to not recognize -1 as a valid array subscript. YMMV!