Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Determine which harddrive "ata7" is connected to.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
luringen
n00b
n00b


Joined: 20 Aug 2014
Posts: 15
Location: Norwaaay

PostPosted: Fri Oct 02, 2015 5:30 pm    Post subject: [SOLVED] Determine which harddrive "ata7" is conne Reply with quote

Sorry if this is a noob question, but i couldn't find any posts about this.

I have this:
Code:

[ 6889.930311] ata7.00: status: { DRDY }
[ 6889.930313] ata7.00: failed command: READ FPDMA QUEUED
[ 6889.930316] ata7.00: cmd 60/08:c8:68:2e:f3/00:00:0d:00:00/40 tag 25 ncq 4096 in
                        res 40/00:50:48:9a:03/00:00:0e:00:00/40 Emask 0x10 (ATA bus error)
[ 6889.930318] ata7.00: status: { DRDY }
[ 6889.930320] ata7.00: failed command: READ FPDMA QUEUED
[ 6889.930324] ata7.00: cmd 60/08:d0:a0:6d:03/00:00:0e:00:00/40 tag 26 ncq 4096 in
                        res 40/00:50:48:9a:03/00:00:0e:00:00/40 Emask 0x10 (ATA bus error)
[ 6889.930334] ata7.00: status: { DRDY }
[ 6889.930336] ata7.00: failed command: READ FPDMA QUEUED
[ 6889.930340] ata7.00: cmd 60/08:e0:00:1c:f4/00:00:0d:00:00/40 tag 28 ncq 4096 in
                        res 40/00:50:48:9a:03/00:00:0e:00:00/40 Emask 0x10 (ATA bus error)
[ 6889.930342] ata7.00: status: { DRDY }
[ 6889.930343] ata7.00: failed command: READ FPDMA QUEUED
[ 6889.930347] ata7.00: cmd 60/08:e8:38:94:f5/00:00:0d:00:00/40 tag 29 ncq 4096 in
                        res 40/00:50:48:9a:03/00:00:0e:00:00/40 Emask 0x10 (ATA bus error)



repeated a little more times than what i pasted there.

after some googling i figured that the problem is most likely a bad sata cable, not the disk itself (none of my drives have any bad smart data)

what my question is, how can i figure out what block device (sdX) ata7.00 is?

after some dicking around in sysfs, i did:
Code:

ls /sys/class/ata_port/ata7/device/host6/target6\:0\:0/6\:0\:0\:0/block/sda/


which would indicate it is sda, (it was the only item in the block/ folder)

but i am still not 100% sure.

can anyone confirm this is correct?


Last edited by luringen on Sun Oct 04, 2015 5:21 pm; edited 1 time in total
Back to top
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 665

PostPosted: Sat Oct 03, 2015 3:44 am    Post subject: Reply with quote

I've had the same issue before and searched for a method of determining, I kindof trust this script below. I wish i knew who peter and the subsequent poster was, they're both awesome. :D


Code:
#!/bin/bash
# note: inspired by Peter
#
# *UPDATE 1* now we're no longer parsing ls output
# *UPDATE 2* now we're using an array instead of the <<< operator, which on its
# part insists on a writable /tmp directory:
# restricted environments with read-only access often won't allow you that

# save original IFS
OLDIFS="$IFS"

for i in /sys/block/sd*; do
 readlink $i |
 sed 's^\.\./devices^/sys/devices^ ;
      s^/host[0-9]\{1,2\}/target^ ^ ;
      s^/[0-9]\{1,2\}\(:[0-9]\)\{3\}/block/^ ^' \
 \
  |
  while IFS=' ' read Path HostFull ID
  do

     # OLD line: left in for reasons of readability
     # IFS=: read HostMain HostMid HostSub <<< "$HostFull"

     # NEW lines: will now also work without a hitch on r/o environments
     IFS=: h=($HostFull)
     HostMain=${h[0]}; HostMid=${h[1]}; HostSub=${h[2]}

     if echo $Path | grep -q '/usb[0-9]*/'; then
       echo "(Device $ID is not an ATA device, but a USB device [e. g. a pen drive])"
     else
       echo $ID: ata$(< "$Path/host$HostMain/scsi_host/host$HostMain/unique_id").$HostMid$HostSub
     fi

  done

done

# restore original IFS
IFS="$OLDIFS"
Back to top
View user's profile Send private message
luringen
n00b
n00b


Joined: 20 Aug 2014
Posts: 15
Location: Norwaaay

PostPosted: Sun Oct 04, 2015 5:20 pm    Post subject: Reply with quote

Hi and thanks for reply.

I figured it out by examining the script that if i just read the link in /sys/block i can see where it points to.

Thanks for the script also. I'm unsure how to mark this as solved..
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum