SCSI vs SATA

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux