
- Kali Linux Tutorial
- Kali Linux - Home
- Installation & Configuration
- Information Gathering Tools
- Vulnerability Analyses Tools
- Kali Linux - Wireless Attacks
- Website Penetration Testing
- Kali Linux - Exploitation Tools
- Kali Linux - Forensics Tools
- Kali Linux - Social Engineering
- Kali Linux - Stressing Tools
- Kali Linux - Sniffing & Spoofing
- Kali Linux - Password Cracking Tools
- Kali Linux - Maintaining Access
- Kali Linux - Reverse Engineering
- Kali Linux - Reporting Tools
- Kali Linux Useful Resources
- Kali Linux - Quick Guide
- Kali Linux - Useful Resources
- Kali Linux - Discussion
Check if Hard Drive is SSD or HDD on Linux
Overview
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.
‘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.
- Related Articles
- Which Storage drive is better, SSD or HDD?
- Difference Between SSD and HDD
- How to Lock Your Hard Drive on Windows OS?
- Check if Directory is Mounted in Bash on Linux
- Difference between Hard Drive and Memory
- How to Format a Hard Disk on Linux OS
- How to find out bad sectors on your linux hard disk
- Play local (hard-drive) video file with HTML5 video tag?
- Would you be able to check if water is hard by using a detergent?
- Check if a point is inside, outside or on the ellipse in C++
- Check if a point is inside, outside or on the parabola in C++
- Python Pandas CustomBusinessHour - Check if the given timestamp is on offset or not
- Which is more hard, sponge or iron?
- Check if Caps Lock and Num Lock is on or off through Console in C#
- Check if Input, Output and Error is redirected on the Console or not in C#
