From: Robert Hancock <hancockr@shaw.ca>
To: BuraphaLinux Server <buraphalinuxserver@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: SCSI vs SATA
Date: Mon, 23 Jul 2007 10:26:50 -0600 [thread overview]
Message-ID: <46A4D6CA.2050006@shaw.ca> (raw)
In-Reply-To: <fa.SvaaC7eLt94EpLFzyKwtVPKbm3s@ifi.uio.no>
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/
next parent reply other threads:[~2007-07-23 16:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.SvaaC7eLt94EpLFzyKwtVPKbm3s@ifi.uio.no>
2007-07-23 16:26 ` Robert Hancock [this message]
2007-07-23 10:52 SCSI vs SATA BuraphaLinux Server
2007-07-23 11:00 ` Michael Tokarev
2007-07-23 11:12 ` Rene Herman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46A4D6CA.2050006@shaw.ca \
--to=hancockr@shaw.ca \
--cc=buraphalinuxserver@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox