* SCSI vs SATA
@ 2007-07-23 10:52 BuraphaLinux Server
2007-07-23 11:00 ` Michael Tokarev
2007-07-23 11:12 ` Rene Herman
0 siblings, 2 replies; 4+ messages in thread
From: BuraphaLinux Server @ 2007-07-23 10:52 UTC (permalink / raw)
To: linux-kernel
Hello,
I have had a hard time determining if /dev/sda is SCSI or SATA
from my boot scripts. It matters for smartd which needs an added
parameter -d sat in the configuration file for SATA drives. Finally I
came up with this, but I wonder if there is a better way? It appears
that
vendor is "ATA " (5 trailing spaces) for SATA. If the kernel is
ever fixed to show proper vendor information (Maxtor, Seagate,
whatever) then how can I know if /dev/sda is SCSI or SATA from a bash
script? When flaming me, please also include the proper solution.
Thanks.
#! /bin/bash
drive="sda"
vendor=$(</sys/block/${drive}/device/vendor)
if [[ "${vendor}" = "ATA " ]]
then
printf "SATA\n"
else
printf "SCSI\n"
fi
exit 0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SCSI vs SATA
2007-07-23 10:52 SCSI vs SATA BuraphaLinux Server
@ 2007-07-23 11:00 ` Michael Tokarev
2007-07-23 11:12 ` Rene Herman
1 sibling, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2007-07-23 11:00 UTC (permalink / raw)
To: BuraphaLinux Server; +Cc: linux-kernel
BuraphaLinux Server wrote:
> Hello,
>
> I have had a hard time determining if /dev/sda is SCSI or SATA
> from my boot scripts. It matters for smartd which needs an added
> parameter -d sat in the configuration file for SATA drives. Finally I
Just FYI: Recent smartmontools (5.36+) can figure this out automagically.
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SCSI vs SATA
2007-07-23 10:52 SCSI vs SATA BuraphaLinux Server
2007-07-23 11:00 ` Michael Tokarev
@ 2007-07-23 11:12 ` Rene Herman
1 sibling, 0 replies; 4+ messages in thread
From: Rene Herman @ 2007-07-23 11:12 UTC (permalink / raw)
To: BuraphaLinux Server; +Cc: linux-kernel
On 07/23/2007 12:52 PM, BuraphaLinux Server wrote:
> #! /bin/bash
> drive="sda"
> vendor=$(</sys/block/${drive}/device/vendor)
> if [[ "${vendor}" = "ATA " ]]
> then
> printf "SATA\n"
> else
> printf "SCSI\n"
> fi
> exit 0
This is probably not a useful comment and a reasonable script in your local
setting but still thought I'd point out that these days most anything is
sda, so if !SATA it can generally also be USB, or FW, or ...
Rene.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SCSI vs SATA
[not found] <fa.SvaaC7eLt94EpLFzyKwtVPKbm3s@ifi.uio.no>
@ 2007-07-23 16:26 ` Robert Hancock
0 siblings, 0 replies; 4+ messages in thread
From: Robert Hancock @ 2007-07-23 16:26 UTC (permalink / raw)
To: BuraphaLinux Server; +Cc: linux-kernel
BuraphaLinux Server wrote:
> Hello,
>
> I have had a hard time determining if /dev/sda is SCSI or SATA
> from my boot scripts. It matters for smartd which needs an added
> parameter -d sat in the configuration file for SATA drives. Finally I
> came up with this, but I wonder if there is a better way? It appears
> that
> vendor is "ATA " (5 trailing spaces) for SATA. If the kernel is
> ever fixed to show proper vendor information (Maxtor, Seagate,
> whatever) then how can I know if /dev/sda is SCSI or SATA from a bash
> script? When flaming me, please also include the proper solution.
> Thanks.
>
> #! /bin/bash
> drive="sda"
> vendor=$(</sys/block/${drive}/device/vendor)
> if [[ "${vendor}" = "ATA " ]]
> then
> printf "SATA\n"
> else
> printf "SCSI\n"
> fi
> exit 0
libata follows the SAT standard for ATA device identification as a SCSI
device, which specifies the vendor is always supposed to be ATA.
Checking for vendor ATA is likely safe then, though if it's not you
can't assume it's going to be SCSI as it could also be USB, IEEE1394, etc.
--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-23 16:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-23 10:52 SCSI vs SATA BuraphaLinux Server
2007-07-23 11:00 ` Michael Tokarev
2007-07-23 11:12 ` Rene Herman
[not found] <fa.SvaaC7eLt94EpLFzyKwtVPKbm3s@ifi.uio.no>
2007-07-23 16:26 ` Robert Hancock
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox