Find failed drive connector of the dmesg reported output

From wiki.linuxonlinehelp.de
Jump to: navigation, search

Find failed drive connector of the dmesg reported output

If you run $dmesg to view current Kernel messages (Dump Kernel Message) and a drive freezesyou should see this:

[Mi Aug  5 18:57:11 2015] ata5.00: exception Emask 0x0 SAct 0x5dc00 SErr 0x0 action 0x6 frozen
[Mi Aug  5 18:57:11 2015] ata5.00: failed command: WRITE FPDMA QUEUED
[Mi Aug  5 18:57:11 2015] ata5.00: cmd 61/80:50:00:0f:31/28:00:14:00:00/40 tag 10 ncq 5308416 out
                                   res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
[Mi Aug  5 18:57:11 2015] ata5.00: status: { DRDY }
[Mi Aug  5 18:57:11 2015] ata5.00: failed command: WRITE FPDMA QUEUED
[Mi Aug  5 18:57:11 2015] ata5.00: cmd 61/80:58:80:37:31/51:00:14:00:00/40 tag 11 ncq 10682368 out
                                   res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
[Mi Aug  5 18:57:11 2015] ata5.00: status: { DRDY }

But you dont know current which drive is ata5.00! create a bash script named "hdd-identify.sh" and insert:

#/bin/sh
ls -l /sys/block/sd* \
| sed -e 's^.*-> \.\.^/sys^' \
       -e 's^/host^ ^'        \
       -e 's^/target.*/^ ^'   \
| while read Path HostNum ID
  do
     echo ${ID}: $(cat $Path/host$HostNum/scsi_host/host$HostNum/unique_id)
  done

save it and then run on console $sh hdd-identify.sh , the output is now:

sda: 1
sdb: 2
sdc: 4
sdd: 5
sde: 6

Now you can go on searching the cable and the Bios Settings for Errors! Remark failed drives often much warmer then the working, cause they are hanging ins unknown stats!