Created
October 29, 2019 23:59
-
-
Save islander/29f2e1ee3ae7cd23028d5c178e28a4d0 to your computer and use it in GitHub Desktop.
Linux SATA hotswap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if test -h "$1" | |
then | |
disk=$(chase "$1") | |
else | |
disk="$1" | |
fi | |
if test -b "$disk" | |
then | |
echo 1 >/sys/block/$(basename "$disk")/device/delete | |
else | |
echo "$0: not a block device: $1" >&2 | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
exec tee /sys/class/scsi_host/host*/scan <<<'- - -' >/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment