LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   SSD vs. HDD (https://www.linuxquestions.org/questions/linux-hardware-18/ssd-vs-hdd-909194/)

Claxton 10-20-2011 02:04 PM

SSD vs. HDD
 
Hello

Any efficient way on knowing whether my PC contains an SSD or an HDD?
Can linux differentiate between the 2?

Thanks

lithos 10-20-2011 02:19 PM

You can get hardware info from your server with
Code:

$ lshw
command:
then find the hard drives info and google for the string from the output you get:
Code:

*-disk
          product: FUJITSU MPC3064AT  <--- for example this
          vendor: Fujitsu
          physical id: 0
          bus info: ide@0.0
          logical name: /dev/hda
          capacity: 6187MiB (6488MB)

google gives: Hard Drives ATA - IDE 6GB-5400RPM means it's a hard drive with platters at 5400RPM
SSD don't have it.

I hope this helps you.

onebuck 10-20-2011 02:25 PM

Hi,

Welcome to LQ!

Quote:

Originally Posted by Claxton (Post 4503662)
Hello

Any efficient way on knowing whether my PC contains an SSD or an HDD?
Can linux differentiate between the 2?

Thanks

Quote:

form 'man lsscsi;
lsscsi - list SCSI devices (or hosts) and their attributes

SYNOPSIS
lsscsi [--classic] [--device] [--generic] [--help] [--hosts] [--kname] [--list] [--long] [--pro-
tection] [--transport] [--verbose] [--version] [H:C:T:L]

DESCRIPTION
Uses information in sysfs (linux kernel series 2.6 and later) to list scsi devices (or hosts)
currently attached to the system. Options can be used to control the amount and form of informa-
tion provided for each device.

If a H:C:T:L argument is given then it acts as a filter and only devices that match it are
listed. The colons don't have to be present, and '-', '*', '?' or missing arguments at the end
are interpreted as wildcards. '-' needs to stand alone or else it is taken as the beginning of an
option (e.g. '-:-:-:-' is illegal). '*' needs to be escaped from the shell. A leading '[' and
trailing ']' are permitted (e.g. '[1:0:0]' matches all luns on 1:0:0). May also be used to filter
--hosts in which case only the H is active and may be either a number or in the form "host<n>"
where <n> is a host number.

By default in this utility device node names (e.g. "/dev/sda" or "/dev/root_disk") are obtained
by noting the major and minor numbers for the listed device obtained from sysfs (e.g. the con-
tents of "/sys/block/sda/dev") and then looking for a match in the "/dev" directory. This "match
by major and minor" will allow devices that have been given a different name by udev (for exam-
ple) to be correctly reported by this utility.

In some situations it may be useful to see the device node name that linux would produce by
default, so the --kname option is provided. An example of where this may be useful is kernel
error logs which tend to report disk error messages using the disk's default kernel name.

Information about this utility including examples can also be found at:
http://sg.danny.cz/scsi/lsscsi.html .

My output;
Quote:

~# lsscsi
[0:0:0:0] disk ATA INTEL SSDSA2M040 2CV1 /dev/sda
[4:0:0:0] cd/dvd HL-DT-ST DVD+-RW GSA-T11N A102 /dev/sr0
[6:0:0:0] disk WDC WD50 00BEVT-22A0RT0 /dev/sdb
~# lsscsi -d
[0:0:0:0] disk ATA INTEL SSDSA2M040 2CV1 /dev/sda [8:0]
[4:0:0:0] cd/dvd HL-DT-ST DVD+-RW GSA-T11N A102 /dev/sr0 [11:0]
[6:0:0:0] disk WDC WD50 00BEVT-22A0RT0 /dev/sdb [8:16]
Obviously my SSD is /dev/sda'. Which is a Intel SSD within this laptop.

Claxton 10-20-2011 02:26 PM

Quote:

Originally Posted by lithos (Post 4503673)
You can get hardware info from your server with
Code:

$ lshw
command:
then find the hard drives info and google for the string from the output you get:
Code:

*-disk
          product: FUJITSU MPC3064AT  <--- for example this
          vendor: Fujitsu
          physical id: 0
          bus info: ide@0.0
          logical name: /dev/hda
          capacity: 6187MiB (6488MB)

google gives: Hard Drives ATA - IDE 6GB-5400RPM means it's a hard drive with platters at 5400RPM
SSD don't have it.

I hope this helps you.

yes that is a way, but I need to do this within a shell script a it needs to determine the drive type without google, no internet connection. Can linux do it by itself using any other command hdparm or sdparm ?

Claxton 10-20-2011 02:28 PM

Quote:

Originally Posted by onebuck (Post 4503676)
Hi,

Welcome to LQ!



My output;Obviously my SSD is /dev/sda'. Which is a Intel SSD within this laptop.

Thank you this lssci command is probably what I need, will look into it!

jefro 10-20-2011 09:09 PM

Bios may contain info.

fukawi1 10-20-2011 10:21 PM

Quote:

Originally Posted by Claxton (Post 4503684)
Thank you this lssci command is probably what I need, will look into it!

As I understand it, lsscsi will only give you the model of the drive.

For example:
Code:

fukawi1 ~ # lsscsi
[2:0:0:0]    cd/dvd  TSSTcorp CDDVDW SH-S223C  SB02  /dev/sr0
[2:0:1:0]    disk    ATA      TOSHIBA THNS064G AGTA  /dev/sda
[3:0:1:0]    disk    ATA      SAMSUNG SP2504C  VT10  /dev/sdb

Doesn't specifiy that /dev/sda is an SSD drive, and /dev/sdb is HDD.

This may be a hacky way of doing it via a script, but, perhaps using hdparm -t:
Code:

fukawi1 ~ # hdparm -t /dev/sda1

/dev/sda1:
 Timing buffered disk reads: 128 MB in  0.69 seconds = 184.36 MB/sec
fukawi1 ~ # hdparm -t /dev/sdb1

/dev/sdb1:
 Timing buffered disk reads: 218 MB in  3.02 seconds =  72.22 MB/sec

combined with grep + awk
Code:

fukawi1 ~ # hdparm -t /dev/sda | grep Timing | awk ' {print $11 }'
140.47

and then an if <= $fastestHDDspeed then its not ssd.

Thats probably not particularly accurate, since there may be a blurred line between HDD speeds, and older/slower SSD speeds, and Im sure there is an easier(better?) way to do it, but I am known for doing things the hard way ;)


All times are GMT -5. The time now is 03:52 AM.