[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-user
Subject:    Re: [gentoo-user] ata6: exception Emask 0x10 SAct 0x0 SErr 0x4000000 action 0xe frozen
From:       David Haller <gentoo () dhaller ! de>
Date:       2013-08-01 8:19:47
Message-ID: 20130801081947.GA4828 () grusum ! endjinn ! de
[Download RAW message or body]

Hello,

On Wed, 31 Jul 2013, Paul Hartman wrote:
>http://serverfault.com/questions/244944/linux-ata-errors-translating-to-a-device-name

All flawed IMHO. My version (works with PATA too), possibly flawed too:

==== ~/bin/ataid_to_drive.sh ====
#!/bin/bash
oIFS="$IFS"
IFS=$'\n'
CTRLS=( $(/sbin/lspci | grep 'ATA\|IDE') )
IFS="$oIFS"
for arg; do
    if test -z "${arg/ata*}"; then
        arg="${arg/ata}"
    fi
    if test -z "${arg/*.*}"; then
        ata="${arg%.*}"
        subid="$(printf "%i" "${arg##*.}")"
    else
        ata="$arg"
    fi
    echo "ata${ata}${subid/*/.$(printf "%02i" $subid)} is:"
    for ctrl in ${CTRLS[@]%% *}; do
        idpath="/sys/bus/pci/devices/*${ctrl}/*/*/*/unique_id"
        grep "^${ata}$" $idpath 2>/dev/null
        host=$(grep "^${ata}$" $idpath 2>/dev/null | \
               sed 's@.*/host\([0-9A-Fa-f]\+\)/.*@\1@')
        if test -n "$host"; then
            dmesg | grep "\] s[dr] $host:0:$subid.*Attached"
        fi
    done
done
====

Usage samples:

$ ataid_to_drive.sh ata23.00
$ ataid_to_drive.sh ata23.01
$ ataid_to_drive.sh ata23
$ ataid_to_drive.sh 23.01
$ ataid_to_drive.sh 23.1
$ ataid_to_drive.sh 23
$ ataid_to_drive.sh $(seq 1 4)

So you can use c&p from dmest/syslog or enter the number(s) yourself.

HTH,
-dnh

-- 
This space intentionally left aligned.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic