Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to determine whether a disk is a solid-state disk or a mechanical hard disk

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this article, the editor introduces in detail "how to judge whether a disk is a solid-state hard disk or a mechanical hard disk". The content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to judge whether a disk is a solid-state hard disk or a mechanical hard disk" can help you solve your doubts.

Method one

Judge the return value of cat / sys/block//queue/rotational (where is your hard disk device name, such as sda, etc.). If you return 1, the disk can be rotated, then it is HDD.

If 0 is returned, it means that the disk cannot be rotated, so it is SSD.

[pythontab@pythontab.com ~] $cat / sys/block/sda/queue/rotational0 [pythontab@pythontab.com ~] $grep ^ / sys/block/*/queue/rotational/sys/block/ram0/queue/rotational:1/sys/block/sda/queue/rotational:0/sys/block/sdb/queue/rotational:0/sys/block/sdc/queue/rotational:0/sys/block/sdd/queue/rotational:0

The problem with this approach is that there are not only hard drives under the / sys/block/, but there may also be other block devices that interfere with your judgment.

Method two

Use the lsblk command to determine, the parameter-d indicates the display device name, and the parameter-o indicates that only specific columns are displayed.

[pythontab@pyhontab.com ~] $lsblk-d-o name,rotaNAME ROTAsda 0sdb 0sdc 0sdd 0

The advantage of this method is that it only lists what you want to see, and the result is relatively concise and clear. Again, if ROTA is 1, it can be rotated, otherwise it cannot be rotated.

Method three

You can view it through the fdisk command, and the parameter-l indicates that the disk details are listed. In the output, the line that begins with Disk represents the disk profile. Here are some detailed parameters in which we can try to find some HDD-specific keywords, such as "heads" (magnetic head), "track" (track), and "cylinders" (cylinder).

Here are the output results of HDD and SSD, respectively.

Disk / dev/sda: 120.0 GB, 120034123776 bytes255 heads, 63 sectors/track, 14593 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00074f7d [pythontab@pyhontab.com ~] $sudo fdisk-lDisk / dev/nvme0n1: 238.5 GiB, 256060514304 bytes 500118192 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0xad91c214. Other methods

You can use third-party tools, such as smartctl, whose results are intuitive, but need to be installed separately.

After reading this, the article "how to determine whether a disk is a solid-state disk or a mechanical hard disk" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it before you can understand it. If you want to know more about related articles, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report