eSATA hot swap in Linux

I hoped that eSATA interface allows to attach and detach HDDs to Linux on the fly, and the system would notice the changes automatically. The reality was quote apposite, the system hung during experiments. Finally, after scanning internet knowledge, and trying to get commands like atacontrol or scsiadd working, I found the command for manual swap.

After a HDD is attached, ask Linux to re-scan the bus to find the HDD:

$ sudo sh -c 'echo "- - -" >/sys/class/scsi_host/host0/scan '

or without sudo:

# echo "- - -" >/sys/class/scsi_host/host0/scan

To detach the HDD (umount it first!) (in this case, the hdd is sdb):

$ sudo sh -c "echo 1 > /sys/block/sdb/device/delete "

or without sudo:

# echo 1 > /sys/block/sdb/device/delete

Well, I actually don’t need hotswap, manual swap is ok for me. The problem is solved.

2 Responses to “eSATA hot swap in Linux”

  1. David Says:

    Thanks for posting this, it’s been driving me mad, had to reboot the computer all the time to backup.

  2. Mario Says:

    Setup -> option AHCI enable.

Leave a Reply