Rescanning sata/scsi devices on non-hotswap capable controllers

I wanted to use the hotswap tray I recently installed in my computer case, and easily plug in the 1.5TB disk to make a backup of the backup server, before reinstalling it in a couple of days.
When plugging in the disk, the Ubuntu system didn’t see it appearing, or at least, I didn’t notice or know where to look for it.

Looking around (googling) for a ‘sata rescan’ I found a thread describing how to rescan the scsi/sata bus (as sata is seen by the kernel as scsi).
It quite simple, once you know which bus holds which disk…

It works as follows:

Become root:
sudo su
go to the directory for the host/controller in /sys/class/scsi_host/hostN where N is the number of the host

and issue this command:
root@ubuntu:/sys/class/scsi_host/host0# echo - - - > scan

in dmesg you will see the new devices found on this controller/host appearing, and the appropriate /dev/sdX device directives are created automatically.

Easy, no?

Leave a Reply

You must be logged in to post a comment.