📜 ⬆️ ⬇️

Linux SCSI / SATA bus rescan

By plugging in the “hot” one more SATA screw, I didn’t find it automatically picked up by the system, as it happens when you plug in via USB. Adapter SATA-USB, as for evil, stayed at home ...

The machine was busy carrying out production tasks and it would be very, very painful to overload it. The system is Ubunt 9.04, I think it should work for all 2.6. * Kernels.
Linux ws10.dom 2.6.28-15-generic #49-Ubuntu SMP Tue Aug 18 18:40:08 UTC 2009 i686 GNU/Linux

In FreeBSD, there is such a wonderful thing as atacontrol which can be forced to reinitialize the controller. In Linux, I did not find such a useful utility ...
But after searching in the Internet, I found the following:
#find /sys -name scan
/sys/devices/pci0000:00/0000:00:06.0/host4/scsi_host/host4/scan
/sys/devices/pci0000:00/0000:00:06.0/host5/scsi_host/host5/scan
/sys/devices/pci0000:00/0000:00:08.0/host0/scsi_host/host0/scan
/sys/devices/pci0000:00/0000:00:08.0/host1/scsi_host/host1/scan
/sys/devices/pci0000:00/0000:00:08.1/host2/scsi_host/host2/scan
/sys/devices/pci0000:00/0000:00:08.1/host3/scsi_host/host3/scan

We look that is from the connected
#dmesg | grep ata
[ 1.801457] ata1: SATA max UDMA/133 cmd 0xe400 ctl 0xe080 bmdma 0xd880 irq 15
[ 1.801459] ata2: SATA max UDMA/133 cmd 0xe000 ctl 0xdc00 bmdma 0xd888 irq 15
[ 2.268032] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[ 2.276290] ata1.00: ATA-7: Hitachi HDS721612PLA380, P23OABEA, max UDMA/133
[ 2.276292] ata1.00: 234441648 sectors, multi 16: LBA48 NCQ (depth 0/32)
[ 2.292298] ata1.00: configured for UDMA/133
[ 2.697111] ata3: SATA max UDMA/133 cmd 0xd800 ctl 0xd480 bmdma 0xd000 irq 5
[ 2.697113] ata4: SATA max UDMA/133 cmd 0xd400 ctl 0xd080 bmdma 0xd008 irq 5
[ 3.338805] ata5: PATA max UDMA/133 cmd 0x1f0 ctl 0x3f6 bmdma 0xffa0 irq 14
[ 3.338807] ata6: PATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0xffa8 irq 15

From which it follows that 5.6 are parallel and definitely not ours, but the main disk lives on the 1m.
So we are trying to port 2, 3, 4
#echo '- - -' > /sys/class/scsi_host/host2/scan
#echo '- - -' > /sys/class/scsi_host/host3/scan
#echo '- - -' > /sys/class/scsi_host/host4/scan

We get in / var / log / mesages
[114471.168196] ata4: SError: { PHYRdyChg CommWake }
[114471.884034] ata4: soft resetting link
[114472.040055] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[114472.048259] ata4.00: ATA-7: WDC WD800JD-00LSA0, 06.01D06, max UDMA/133
[114472.048264] ata4.00: 156301488 sectors, multi 0: LBA48
[114472.058191] ata4.00: configured for UDMA/133
[114472.058205] ata4: EH complete
[114472.059257] scsi 3:0:0:0: Direct-Access ATA WDC WD800JD-00LS 06.0 PQ: 0 ANSI: 5

Disk detected on port 4, ready for use. We mount with standard system tools.

UPD: 11/18/2009 - for PATA CD-drive this method did not work

')

Source: https://habr.com/ru/post/68036/


All Articles