Identificare dischi traducendo device name con ata name

From RVM Wiki
Jump to navigation Jump to search
  • Se si ottiene un errore su un discho SATA identificato tipo
[6407990.328987] ata3.00: exception Emask 0x10 SAct 0x1 SErr 0x280100 action 0x6 frozen
[6407990.336824] ata3.00: irq_stat 0x08000000, interface fatal error
[6407990.343012] ata3: SError: { UnrecovData 10B8B BadCRC }
[6407990.348395] ata3.00: failed command: READ FPDMA QUEUED
[6407990.353819] ata3.00: cmd 60/20:00:28:c2:39/00:00:0c:00:00/40 tag 0 ncq 16384 in
[6407990.353820]          res 40/00:00:28:c2:39/00:00:0c:00:00/40 Emask 0x10 (ATA bus error)
[6407990.369618] ata3.00: status: { DRDY }
[6407990.373504] ata3: hard resetting link
[6407995.905574] ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[6407995.976946] ata3.00: configured for UDMA/133
[6407995.976961] ata3: EH complete
  • Per capire che dispositivo è, elencare i dischi
ls -l /sys/block/sd*
lrwxrwxrwx 1 root root 0 Dec 22 13:04 /sys/block/sda -> ../devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda
lrwxrwxrwx 1 root root 0 Dec 22 13:04 /sys/block/sdb -> ../devices/pci0000:00/0000:00:1f.2/host3/target3:0:0/3:0:0:0/block/sdb
  • In base al link, il numero di ataX è quello di target
  • Usare questo semplice script:
#!/bin/bash
# on Ubuntu get ata ID for block devices sd*
ls -l /sys/block/sd* \
| sed -e 's^.*-> \.\.^/sys^' \
       -e 's^/host^ ^'        \
       -e 's^/target.*/^ ^'   \
| while read Path HostNum ID
  do
     echo "/dev/${ID} <-> ata$(cat $Path/host$HostNum/scsi_host/host$HostNum/unique_id)"
  done

Riferimenti