Linux check ssd or hdd

How to Find If My Linux System Runs on SSD or HDD

So why would you want to find out whether your Linux system is running on SSD or HDD? There are various valid reasons for this question.

Firstly, you might not be tech-savvy enough to understand the hardware infrastructure associated with your Linux system. Secondly, knowing whether your Linux system runs on SSD or HDD helps set reasonable performance expectations for your Linux machine.

Understanding HDD vs SSD

Traditionally, hard drives were defined as spinning devices with non-volatile storage. The implication of the latter statement is that the hard drives were able to retain the integrity of stored data even after a sudden power loss or when power was instantly turned off.

Therefore, the combination of a metal platter with a magnetic coating cover gives us the physical definition of a hard disk drive. For a user or application to successfully read/write data on a hard disk drive, the metal platter with a magnetic coating needs to be in a spinning state. The HDD performance depends on these spins rate such that a faster spin equals better HDD performance.

SSD or Solid State Drive takes advantage of interconnected flash memory chips to store data. Also, when power is turned off or during a sudden blackout, SSD to does not lose already stored data.

However, in comparison to HDD’s metal platter, SSD’s flash memory chips are more reliable due to their unmatched speed. Also, SSD outshines HDD in terms of applications’ launch time, their responsiveness, and startup time.

Finding Out If Linux System Runs on SSD or HDD

For this portion of the article, we are going to look at practical steps that will reveal if your Linux system is running on SSD or HDD.

1. Check Linux Disk is Rotational or Not

Linux operating system distributions that are using kernel version 2.6.29 or later versions have the capability of automatically detecting whether they run on SSD or HDD.

Querying the file /sys/block/sda/queue/rotational on your Linux terminal will confirm to us whether the disk you are using is rotational or not. As per our earlier discussion on HDD vs SSD, only HDD is rotational due to the metal platter that needs to be in a constant spinning state for us to read/write data.

If querying this file outputs 1, then the machine is using HDD and if the output is 0, the machine is using SSD.

We can use the cat command to implement the needed file query command:

$ cat /sys/block/sda/queue/rotational

Check Linux Disk is Rotational

The above output confirms that the disk is rotational hence HDD.

2. Using the lsblk Command

The lsblk command is primarily used to list block devices on your system. It can however help us determine if the disk we are using is rotational (HDD) or not (SSD).

Читайте также:  Все процессы linux centos

Check Linux Disk is Running on SSD or HDD

An output of 1 confirms that this system is using HDD.

3. Using dmesg Command

The dmesg command is effective in printing or control the kernel ring buffer. We can however pipe it to a grep command and retrieve information on the disk model we are using. Afterward, a simple Google search should tell us whether we are using HDD or SSD.

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

Check Linux Disk Model

Pasting ST320LT020-9YG14 on Google should tell us whether we are using HDD or SSD.

Check Disk is SSD or HDD

4. Querying /proc/scsi/scsi Proc File

The /proc/scsi/scsi file contains the disk model information of our system.

Check Linux Disk Model Info

A simple Google search on the revealed disk model should tell us whether we are using HDD or SSD.

Know of other cool ways of identifying whether a Linux system is running on SSD or HDD? Feel free to leave a comment or feedback.

Источник

Check if Hard Drive is SSD or HDD on Linux

To determine whether our file system uses SSD or HDD technology, we need to know which type of storage device is used by our operating system.

There are many different aspects of Linux storage. There seem to be just as many tools available for reading and configuring our storage. We use words like “drive’, ‘volume’, and ‘mount point’ when we want to describe hard drives, optical discs, and USB sticks. But to understand the underlying technology, we only really care about two things −

  • What physical disk or block device we are looking at (from df)
  • The hardware parameters of that disk (from hdparm) We’ll see how we can determine whether our files are stored on fast solid state media (SSD) or a slower, mechanical hard disk.

What Disk Are We On, Anyway?

We’ll start off by checking our disk usage with the ‘disk free’ command.

$ df -Th -x tmpfs Filesystem Type Size Used Avail Use% Mounted on /dev/sdb2 ext4 228G 173G 44G 80% / /dev/sdb1 vfat 511M 6.3M 505M 2% /boot/efi /dev/sdc1 fuseblk 466G 352G 114G 76% /media/a/9EE8E134E8E10AFB1 /dev/mapper/wonder--vg-root ext4 902G 57G 799G 7% /media/a/450c0236-eea5-4a7

To see the file system type, we use −T; to see the total disk space used by files, we use −h; and to exclude temporary files from our output, we use −x tmpfstype. We only want physical hard disks.

From this, we know that our root filesystem is located on a disk called /dev/sda. We also see two disks named sdc and mapper. We can use commands like `mount` and `mountpoint` to clarify where our file system is mapped to which hard disk partitions.

Using hdparm with Care

The “Hard Disk Parameters” command, hdparm, can be used to either get or set drive parameters. That means we can read all kinds of information from our drives. But in addition, it means we can change settings that may harm performance or destroy our data.

We’ll need to run hdparm as root. This means our actions may have immediate and direct consequences.

hdparm and Solid State Drives

Let’s say we want to find out more about the hardware behind our root filesystem. We remember that it’s on the sdb drive. So we can use hdparm with the −I option to ask for detailed information −

$ sudo hdparm -I /dev/sdb /dev/sdb: ATA device, with non-removable media Model Number: Samsung SSD 840 EVO 250GB

From these first few lines, we discover our disk drive has “SSD” in the name. That’s a pretty good indicator that it is indeed a Solid State Drive.

Читайте также:  Linux отправить post запрос

‘Solid State’ Means No Moving Parts

But here’s another example of an SSD drive with a less human-readable name −

$ sudo hdparm -I /dev/sdb /dev/sdb: ATA device, with non-removable media Model Number: Samsung SSD 840 EVO 250GB .

Let’s see if we can find out which model this is. If we look at the output from hdparm, we see that there’s another command line option that lets us get the exact number of seconds −

$ sudo hdparm -I /dev/sdc | grep 'Nominal Media Rotation Rate' Nominal Media Rotation Rate: Solid State Device

What does “Nominal Media Rotation Rate” mean? We’re going to be distinguishing between two different kinds of drives.

A hard disk drive is a mechanical device. Its read/write operations occur by spinning disks coated with magnetic material. These systems are vulnerable to mechanical failures. However, it’s also restricted by how fast the reader’s hand (like a phonographic stylus) can move across the spinning record. The speed at which they rotate is called their rotation rate.

A solid state drive (SSD) stores our data on nonvolatile random access semiconductor storage media, similar to a USB thumb drive. It has no moving parts! There are slower and faster types of solid state drives (SSDs). However, the problem isn’t now in moving the data from one place to another. It’s not in getting it to the CPU; it’s in getting the data from the hard drive to the RAM.

Let’s see what hdparm has got to say about a hard disk drive (HDD).

$ sudo hdparm -I /dev/mapper/wonder--vg-root | grep 'Nominal Media Rotation Rate' Nominal Media Rotation Rate: 7200

This output indicates that this hard disc has moving parts. The platter spins at 7200 revolutions per minute (rpm).

We check the «nominal media rotation rate» of our hard drive. If it’ s a number, it‘s a hard disk drive (HDD). Solid state devices (SSDs) are faster than traditional hard drives because they don’t use moving parts.

Conclusion

Linux will tell us lots of information about our storage devices. There’s so much information out there, it’s hard to know where to start. We go through all that information to uncover the specific details of our storage system.

  • We first list our mounted drives with df.
  • We then run the hdpamd −i command as root.
  • Finally, we’re using grep to get right to our information.

Источник

Ways to Check SSD or HDD in Linux OS

At some moment, you must have been curious to know if you are using Solid State Drive (SSD) or Hard Disk Drive (HDD) on your Laptop/pC. If so, checking the type of disk drive is quite easy on Linux. There are different methods to verify and check if you are using an SSD or HDD. The Linux operating system can automatically detect SSD since the kernel 2.6.29 was introduced.

In this article, we are going to discuss the ways to check if it is an SSD or HDD on Ubuntu 20.04 LTS server.

Читайте также:  Linux content management system

Checking with the use of lsblk command

To check the disk type if it is SSD or HDD in Linux, we can use lsblk command. It is due to the rotational feature of the disk. If the lsblk command is not found on your Linux distribution like Ubuntu 20.04 then you can install it with the command below.

$ sudo apt install util-linux

Then to check the disk types, run the following command by using lsblk as shown below.

To be clear, if the ROTA value is 1, then your disk type is HDD and if the ROTA value is 0 then it is SSD. Here, you can see 1 on the above screenshot for the ROTA value of sda, vda which means it is HDD.

Checking if the disk is rotational

Hard disk drive (HDD) works with the rotation of the disk while SSD does not have such rotational disk. To verify if you are using an SSD or HDD, you have to check if it is rotational or not. If it is rotational then the value must be 1, if not then it is 0.

To check that value, you have to print the value of /sys/block/sdX/queue/rotational. For further details, run the command as shown below.

$ cat /sys/block/sda/queue/rotational

Here, the value is 1 which means the disk type is Hard disk drive(HDD). If the value is 0 then it is an SSD.

Another example of checking if the disk is rotational, run the command as shown below.

$ cat /sys/block/vda/queue/rotational

Here, the value is also 1 which means the disk type is Hard disk drive(HDD). If the value is 0 then it is an SSD.

Checking with the use of monitoring tool- smartctl

This is the smart way to check the disk type if it is SSD or HDD. As the smart monitoring tool is such a package which consists of the unique command line tool called smartctl. So to install such a tool on ubuntu 20.04 LTS server, you can run the command as shown below.

$ sudo apt install smartmontools -y

Now check if the smartd service is running or not with the following command.

$ sudo systemctl status smartd

If it is not active by default, you can start it with the command as shown below.

$ sudo systemctl start smartd

As the smartd service is running, run the command as shown below to check if you are using HDD or SSD.

$ sudo smartctl -a /dev/sda | grep 'Rotation Rate'

Here, we are checking for drive sda.

With the above command, if the drive is SSD then the output will be as shown below.

Rotation Rate: Solid State Device

And, if the drive is HDD then the output will be as shown below.

Rotation Rate: 5400 rpm

Conclusion

In this article, we have discussed the ways to check if the disk is HDD or SSD in a Linux operating system like Ubuntu 20.04 LTS server. If you have been curious about it, try any of the above ways to find it. Thank you!

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.

Источник

Оцените статью
Adblock
detector