Last active
November 22, 2019 21:09
-
-
Save isaaclw/51d4a82ca24302abcfd57a6f91cd0f1d to your computer and use it in GitHub Desktop.
Detect Sata (may not work) #hardware #blockdevices #bash
This file contains 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
# first list devices that are connected: | |
ls /dev/sd* | |
# then list devices listed in /sys/block: | |
ls /sys/block/sd* # I expect they agree, but unsure atm | |
# find the 'hostid' of the existing devices | |
for i in $(ls /dev/); do if [[ "$i" =~ "sd" ]]; then (echo -n "$i => "; readlink /sys/block/$i | cut -d '/' -f 5; echo "") | grep "host"; fi; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment