Method 1: Check if the disk is rotational

Since kernel version 2.6.29, Linux systems can automatically detect SSD. So executing the below command will tell you if a disk is SSD or HDD.

# cat /sys/block/sda/queue/rotational

If the above output is 0 (zero), then the disk is SSD (because SSD does not rotate). You should see output '1' on machines that has HDD disk.

Method 2: Using lsblk command

To install lsblk

# yum install util-linux

You can also check if the disk is rotational or not using lsblk command.

Use yum to check which package provides lsblk command.

# yum provides lsblk

Sample output:

util-linux-2.23.2-43.el7.i686 : A collection of basic system utilities
Repo : base
Matched from:
Filename : /usr/bin/lsblk

The above output confirms that util-linux is the package that distributes lsblkcommand.

Now check if the disk is rotational or not using the below command.

$ lsblk -d -o name,rota
sda 0

If the output of the above command is '0' for ROTA, then the disk is SSD. In case of output being '1', the disk is HDD.

Method 3: Using SMART monitoring tools

Smart monitoring tools is a control and monitoring utility for SATA, SCSI hard drives and solid state drive. The tool comes with a command called 'smartctl'.

To install smartmontools 

# yum install smartmontools

Use yum to check which package provides smartctl command.

# yum provides smartctl

Sample output:

1:smartmontools-6.2-8.el7.x86_64 : Tools for monitoring SMART capable hard disks
Repo : base
Matched from:
Filename : /usr/sbin/smartctl

The above output suggests that smartmontools is the package that distributes smartctl command.

Method 4: Dig through dmesg

You can quickly dig through dmesg to read the model of the disk.

$ dmesg | grep -i -e scsi -e ata

Sample output:

[ 1.312577] ata1.00: configured for UDMA/133
[ 1.312822] scsi 0:0:0:0: Direct-Access ATA SanDisk Ultra II 00RL PQ: 0 ANSI: 5

In the above output, look out for the model and just Google it to know if the disk is HDD or SSD.


Method 5: Read SCSI inside proc file system

You can find the disk model information using the below command:

$ cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 01 Id: 00 Lun: 00
 Vendor: WDC Model: WD5002ABYS-0 Rev: 02.0
 Type: Direct-Access ANSI SCSI revision: 05

You can Google the model to know if the disk is HDD or SSD.

That's it !!

Was this answer helpful? 1 Users Found This Useful (2 Votes)