Code: Select all
for d in /sys/block/sd*
do
s=`basename $d`
h=`ls -l $d | egrep -o "host[0-9]+"`
t=`ls -l $d | egrep -o "target[0-9:]*"`
a2=`echo $t | egrep -o "[0-9]:[0-9]$" | sed 's/://'`
a=`cat /sys/class/scsi_host/$h/unique_id`
echo "$s -> ata$a.$a2"
done
Tested on CentOS 6.5.sda -> ata4.00
sdb -> ata7.00
sdc -> ata8.00
sdd -> ata9.00
sde -> ata10.00
sdf -> ata11.00
sdg -> ata12.00
sdh -> ata14.00
sdi -> ata14.01
Source: http://askubuntu.com/questions/64351/ho ... sical-disk