Difference between revisions of "SCSI"

From Blue-IT.org Wiki

(Created page with "== Reset SCSI bus == Works with Ubuntu 11.10 . Search for the script [https://duckduckgo.com/?q=rescan-scsi-bus.sh&kl=de-de rescan-scsi-bus.sh]. Install the scscitools (and op...")
 
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:
  
 
Install the scscitools (and optionally sg3-utils) package:
 
Install the scscitools (and optionally sg3-utils) package:
  sudo apt-get install apt-get install sg3-utils scsitools
+
  sudo apt-get install sg3-utils scsitools
  
 
# Power off your device
 
# Power off your device
Line 17: Line 17:
  
 
Your device should be ready to use now.
 
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
 +
 +
[[Category:Hardware]]

Latest revision as of 10:34, 23 June 2016

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
  1. Power off your device
  2. Remove the device from the kernel with
 rescan-scsi-bus.sh -r
  1. Switch on the device
  2. Wait until it is ready
  3. 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