| John-Paul Stewart 2006-11-13, 1:14 pm |
| jon wrote:
>
> I am looking for a way to hotswap a SATA II drive in Ubuntu. I have
> the drives in a SATA II unit that allows me to power down the drives
> and safely remove them.
Have you told the kernel that you've removed the drive? Given that SATA
drives appear to the kernel as SCSI devices, you might want to look into
the 'rescan-scsi-bus.sh' script (Google for it if your distro doesn't
include it) to automatically scan for new/removed devices, or figure out
the proper numbers and enter (as root):
echo "scsi-remove-single-device a b c d" >/proc/scsi/scsi
where a b c and d are the SCSI bus identifiers of your SATA drive. You
can probably obtain them by doing 'cat /proc/scsi/scsi' before you
remove the drive.
Debian also provides a package called 'scsiadd' which you should be able
to apt-get in Ubuntu, too. While I have no hands-on experience with it,
it may do just what you need.
> The problem is when I insert the same drive or
> another drive and power it back up Ubuntu hangs.
When you re-insert a drive, you'll have to echo 'scsi-add-single-device'
or use rescan-scsi-bus.sh again to tell the kernel you've put in a new
drive. Without the remove and add commands, I would expect the kernel
to get confused.
Note that I haven't tried this with SATA drives, but I use it all the
time with real SCSI hot swap drives. But since SATA is using the same
kernel subsystems, I expect it to work with SATA.
|