[CentOS] How to map ata#.# numbers to /dev/sd numbers?

Fri Jan 29 03:45:50 UTC 2010
Stephen Harris <lists at spuddy.org>

On Thu, Jan 28, 2010 at 07:18:36PM -0500, Robert Heller wrote:
> At Thu, 28 Jan 2010 17:05:41 -0500 CentOS mailing list <centos at centos.org> wrote:
> > Yeah, but dmesg has two problems that I can think of
> > 1) it may disappear if the number of kernel messages grows sufficiently
> > large
> 
> /var/log/dmesg

Doesn't handle hotswap disks, and still has the problem with out-of-order
entries.

> Ata numbers seem to start with 1 (one) and scsi hosts start with 0
> (zero), so, ataN => scsi<N-1>, unless you either have real SCSI
> controllers or PATA controllers that use SCSI-flavored drivers.  The USB
> drivers will be loaded later, so the USB disks will have higher SCSI
> host numners.

Can we guarantee that?  And order detection of disks is not the same
as order detection of buses; in my cases the USB disk is on scsi host 8
but is sdb (the second disk found).

The problem I really want to solve is a scriptable solution so that I can
always map ata#.# number to /dev/sdX entry.  On my own personal machine I
can always write it down 'cos it's not gonna change... but in general?

-- 

rgds
Stephen