Monday, January 25, 2016

Identify SSD drives V/S Hard disks

                                      Identify SSD drives V/S Hard disks

Quick way to identify if disks are SSD's or Hard Drives by viewing the content of /sys/block/sd*/queue/rotational file, If this file has value 1 it indicates its Hard Drive while if it has 0 for SSD's .

Like in below example sda is hard drive while sdb-sdg are SSD drives .

[root@tss2-18 ~]# ls -l /sys/block/sd*/queue/rotational
-rw-r--r-- 1 root root 4096 Jan 25 23:08 /sys/block/sda/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sdb/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sdc/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sdd/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sde/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sdf/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sdg/queue/rotational
[root@tss2-18 ~]# cat /sys/block/sd*/queue/rotational
1
0
0
0
0
0
0

Another way to find this out would be via "lsblk" command as below .

[root@tss2-18 ~]# lsblk -d -o name,rota
NAME ROTA
sdb     0
sdc     0
sdd     0
sde     0
sdf     0
sdg     0
sda     1

Note :  ROTA means rotational device  ( 1 if true, 0 if false)

For above command to work we have to make sure "util-linux" package is installed which provides "lsblk" utility .

[root@tss2-18 ~]# which lsblk
/bin/lsblk
[root@tss2-18 ~]# rpm -qf /bin/lsblk
util-linux-ng-2.17.2-12.18.el6.x86_64

No comments:

Post a Comment