Skip to content

Instantly share code, notes, and snippets.

@nyov
Created March 6, 2014 19:16
Show Gist options
  • Save nyov/9397285 to your computer and use it in GitHub Desktop.
Save nyov/9397285 to your computer and use it in GitHub Desktop.
ata controller to disk mappings (e.g. ata0 has sda)
#!/bin/sh
# ata bus to harddisk mappings
for device in `ls /sys/block/ | grep '[hs]d'`; do
host=`ls /sys/block/${device}/../../../../scsi_host/`
unique_id=`cat /sys/block/${device}/../../../../scsi_host/${host}/unique_id`
echo "ata${unique_id} is scsi_host ${host} with attached device ${device}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment