lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-id: <46A4D6CA.2050006@shaw.ca>
Date:	Mon, 23 Jul 2007 10:26:50 -0600
From:	Robert Hancock <hancockr@...w.ca>
To:	BuraphaLinux Server <buraphalinuxserver@...il.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: SCSI vs SATA

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@...pamshaw.ca
Home Page: http://www.roberthancock.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ