SCSI
From Blue-IT.org Wiki
Reset SCSI bus
Works with Ubuntu 11.10 .
Search for the script rescan-scsi-bus.sh.
Install the scscitools (and optionally sg3-utils) package:
sudo apt-get install sg3-utils scsitools
- Power off your device
- Remove the device from the kernel with
rescan-scsi-bus.sh -r
- Switch on the device
- Wait until it is ready
- Rescan the bus
rescan-scsi-bus.sh
Your device should be ready to use now.
Mount and unmount external scsi with scsiadd
#!/bin/bash # Removing an external SCSI with scsiadd ( http://llg.cubic.org/tools/ ) # # Howto: https://blog.shadypixel.com/safely-removing-external-drives-in-linux/ SCSI_CHANNEL="scsi3" shopt -s nullglob export DISPLAY=:0.0 # required for notify-send SCISADD="" if ! [ -f /usr/local/bin/scsiadd ] then notify-send -u critical -t 100000 "Program missing" "scsiadd must be installed in /usr/local/bin/scsiadd." exit 1 fi # Find generic dock interface for UltraBay if /usr/local/bin/scsiadd -p | grep ${SCSI_CHANNEL} then logger external ${SCSI_CHANNEL} eject starting else logger cannot locate external ${SCSI_CHANNEL} device notify-send -u critical -t 100000 "Eject of external SCSI device failed" "Cannot locate an external scsi device on ${SCSI_CHANNEL} (probably already unmounted)." exit 1 fi # A device was found gksudo "su -c 'if /usr/local/bin/scsiadd -r 3 00 00 00; then echo 12 > /proc/acpi/ibm/beep; fi'" if /usr/local/bin/scsiadd -p | grep ${SCSI_CHANNEL}; then logger eject of external scsi went wrong done notify-send -u normal -t 10000 "Somthing went finally wrong" "The external scsi device could _NOT_ be removed. Please check manually for errors." else # Tell the user we're OK logger done notify-send -u normal -t 10000 "Safe to remove device" "The external scsi device can now safely be removed" fi # We need sleep here so someone can disconnect the bay and the drive sleep 1 exit 0