Hi all,
Is it expected behaviour that when you plug/unplug a SATA drive, you then have to manually explain to Linux that “hey, I just unplugged/plugged in a drive, please rescan the SCSI bus”? Is it possible to have Linux auto-enumerate (and possibly even auto-mount) a SATA drive when I plug it into a SATA port?
I’ve got Ubuntu 22.04 Desktop installed on a PRIME X570-P based system. I’ve been wanting to play with SATA hotplug, but when I try to plug in a SATA drive while the system is running, nothing seems to happen (not even in dmesg
.)
I’ve updated my mobo to the latest BIOS version (“Revision 4403”).
If I boot the system with my drive plugged in to one of the SATA ports, then the system can see it. If I then un-plug it, I see no changes (the system still insists the drive is there) until someone or something tries to access it (e.g. I try to mount one of the partitions), at which point Linux ‘wakes up’ to the fact that there’s nothing on the end of the SATA cable and spits out the following into dmesg
:
[ 280.531703] ata6: SATA link down (SStatus 0 SControl 300)
[ 285.905936] ata6.00: disabled
[ 285.905974] ata6.00: detaching (SCSI 5:0:0:0)
[ 285.937622] sd 5:0:0:0: [sda] Stopping disk
[ 285.937636] sd 5:0:0:0: [sda] Start/Stop Unit failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
I can also manually invoke Linux to rescan the scsi bus with
$ echo "- - -" > /sys/class/scsi_host/host9/scan
Then the result is more “graceful”, and I only see the following in dmesg
:
[ 69.651916] ata10: SATA link down (SStatus 0 SControl 300)
If I then plug my drive back in, again nothing happens until I tell Linux to re-scan the right bus with the same command:
$ echo "- - -" > /sys/class/scsi_host/host9/scan