[CentOS] HotPlug, eSATA, and /media

Sat Aug 4 00:59:03 UTC 2007
Lamar Owen <lowen at pari.edu>

On Friday 03 August 2007, Feizhou wrote:
> Lamar Owen wrote:
> > I have an eSATA drive, a 750GB Seagate in an eSATA external enclosure,
> > and a Silicon Image sil3132 ExpressCard controller for my laptop.  The
> > disk and controller work great in CentOS 5 (or F7, for that matter), if I
> > specifically mount it.

> > This is not how I want to have to use this drive, however. 

> Er...it is not treated like USB disks or CDs or DVDs but as a regular
> hard disk.

I still remember when USB disks were treated as 'regular' disks, too.  Not 
long ago, in fact.  

Hotplug should just be hotplug, regardless of interface technology.  SATA, and 
specifically eSATA, is designed for hotplug; the drive handles it, the 
controller handles it, and in ExpressCard, the bus handles it.  
When '/dev/sdb1' shows up, with a LABEL=eSATA750GS, then it should (in the 
ideal) show up in /media/eSATA750GS, whether it's USB, IEEE1394, or eSATA 
connected.

And the system handles the event, it just doesn't do anything with it at 
present.

The sata_sil24 driver supports phy hotplug; should be just some udev rules 
magic; after all, the USB hotplug does essentially the same thing, and on the 
SCSI layer just like SATA.  And if you've played with eSATA for long, you'll 
see the use for this in a hurry.  eSATA gives you the fastest and best 
external drive connection currently available; my drive, enclosure, and 
controller all run at 3Gb/s, and I can get...hmm, hdparm -t gives me between 
65 and 90 MB/s read speed consistently, to an external drive.

> I guess you will need some scripting...

Given that USB disks come in as SCSI, I don't see why a libata disk (which 
also comes in as SCSI) would need anything beyond what already works for USB.  
Just wondering if I need to come up with the magic myself, or if someone else 
has already done this.  Of course, I reserve the right to be wrong, but I 
don't think I'm too far off the mark.

I'm looking at the udev rules stuff now, but if anyone has any pointers to 
specific docs, it would be great to hear it!

Following is /var/log/messages for a hot unplug (pulling the eSATA data cable 
from the controller) followed by a hotplug (plugging it back in a few seconds 
later), for those who might be interested:
++++++++++++++++++++++
HOTUNPLUG
Aug  3 20:13:47 localhost kernel: ata3: exception Emask 0x10 SAct 0x0 SErr 
0x80000 action 0x2 frozen
Aug  3 20:13:47 localhost kernel: ata3: (irq_stat 0x01100010, PHY RDY changed)
Aug  3 20:13:47 localhost kernel: ata3: soft resetting port
Aug  3 20:13:47 localhost kernel: ata3: SATA link down (SStatus 0 SControl 
300)
Aug  3 20:13:47 localhost kernel: ata3: failed to recover some devices, 
retrying in 5 secs
Aug  3 20:13:52 localhost kernel: ata3: hard resetting port
Aug  3 20:13:54 localhost kernel: ata3: SATA link down (SStatus 0 SControl 
300)
Aug  3 20:13:54 localhost kernel: ata3.00: limiting speed to UDMA/100:PIO3
Aug  3 20:13:54 localhost kernel: ata3: failed to recover some devices, 
retrying in 5 secs
Aug  3 20:13:59 localhost kernel: ata3: hard resetting port
Aug  3 20:14:01 localhost kernel: ata3: SATA link down (SStatus 0 SControl 
300)
Aug  3 20:14:01 localhost kernel: ata3.00: disabled
Aug  3 20:14:02 localhost kernel: ata3: EH complete
Aug  3 20:14:02 localhost kernel: ata3.00: detaching (SCSI 2:0:0:0)
Aug  3 20:14:02 localhost kernel: sd 2:0:0:0: [sdb] Synchronizing SCSI cache
Aug  3 20:14:02 localhost kernel: sd 2:0:0:0: [sdb] Result: 
hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK,
SUGGEST_OK
Aug  3 20:14:02 localhost kernel: sd 2:0:0:0: [sdb] Stopping disk
Aug  3 20:14:02 localhost kernel: sd 2:0:0:0: [sdb] START_STOP FAILED
Aug  3 20:14:02 localhost kernel: sd 2:0:0:0: [sdb] Result: 
hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK,
SUGGEST_OK
++++++++++++++++++++++++++++
HOTPLUG
Aug  3 20:14:18 localhost kernel: ata3: exception Emask 0x10 SAct 0x0 SErr 0x0 
action 0x2 frozen
Aug  3 20:14:18 localhost kernel: ata3: (irq_stat 0x00800080, device 
exchanged)
Aug  3 20:14:19 localhost kernel: ata3: soft resetting port
Aug  3 20:14:19 localhost kernel: ata3: SATA link up 3.0 Gbps (SStatus 123 
SControl 300)
Aug  3 20:14:19 localhost kernel: ata3.00: ATA-7: ST3750640AS, 3.AAE, max 
UDMA/133
Aug  3 20:14:19 localhost kernel: ata3.00: 1465149168 sectors, multi 0: LBA48 
NCQ (depth 31/32)
Aug  3 20:14:19 localhost kernel: ata3.00: configured for UDMA/100
Aug  3 20:14:19 localhost kernel: ata3: EH complete
Aug  3 20:14:19 localhost kernel: scsi 2:0:0:0: Direct-Access     ATA      
ST3750640AS      3.AA PQ: 0 AN
Aug  3 20:14:19 localhost kernel: sd 2:0:0:0: [sdb] 1465149168 512-byte 
hardware sectors (750156 MB)
Aug  3 20:14:19 localhost kernel: sd 2:0:0:0: [sdb] Write Protect is off
Aug  3 20:14:19 localhost kernel: sd 2:0:0:0: [sdb] Write cache: enabled, read 
cache: enabled, doesn't su
pport DPO or FUA
Aug  3 20:14:19 localhost kernel: sd 2:0:0:0: [sdb] 1465149168 512-byte 
hardware sectors (750156 MB)
Aug  3 20:14:19 localhost kernel: sd 2:0:0:0: [sdb] Write Protect is off
Aug  3 20:14:19 localhost kernel: sd 2:0:0:0: [sdb] Write cache: enabled, read 
cache: enabled, doesn't su
pport DPO or FUA
Aug  3 20:14:19 localhost kernel:  sdb: sdb1
Aug  3 20:14:19 localhost kernel: sd 2:0:0:0: [sdb] Attached SCSI disk
Aug  3 20:14:19 localhost kernel: sd 2:0:0:0: Attached scsi generic sg2 type 0
++++++++++++++++++++++++++
-- 
Lamar Owen
Chief Information Officer
Pisgah Astronomical Research Institute
1 PARI Drive
Rosman, NC  28772
(828)862-5554
www.pari.edu