


How to determine whether a Linux disk is a solid state drive or a mechanical hard drive
Three ways to determine whether a Linux disk is a solid state drive or a mechanical hard drive:
Determine the return value of cat /sys/block/*/queue/rotational (where * is the name of your hard disk device, such as sda, etc.). If it returns 1, it means that the disk can be rotated, then it is an HDD;
If it returns 0, it means the disk cannot be rotated, then it is an SSD.
[pythontab@pythontab.com ~]$ cat /sys/block/sda/queue/rotational 0 [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
There is a problem with this method, that is, there are not only hard disks under /sys/block/, but also other block devices, which are all interfering with your judgment.
Use the lsblk command to judge. The parameter -d means to display the device name, and the parameter -o means to display only specific columns.
[pythontab@pyhontab.com ~]$ lsblk -d -o name,rota NAME ROTA sda 0 sdb 0 sdc 0 sdd 0
The advantage of this method is that it only lists the content you want to see, and the result is relatively concise and clear. Still the same rule, if ROTA is 1, it means it can be rotated, otherwise it cannot be rotated.
You can view it through the fdisk command. The parameter -l means to list the disk details. In the output results, the line starting with Disk represents the disk introduction. Below are some detailed parameters. We can try to find some HDD-specific keywords in these parameters, such as: "heads" (head), "track" (track) ) and "cylinders".
The following are the output results of HDD and SSD respectively
Disk /dev/sda: 120.0 GB, 120034123776 bytes 255 heads, 63 sectors/track, 14593 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00074f7d [pythontab@pyhontab.com ~]$ sudo fdisk -l Disk /dev/nvme0n1: 238.5 GiB, 256060514304 bytes, 500118192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xad91c214 ......
You can use third-party tools to judge, such as smartctl. The results of these tools are more intuitive, but they need to be installed separately.
The above is the detailed content of How to determine whether a Linux disk is a solid state drive or a mechanical hard drive. For more information, please follow other related articles on the PHP Chinese website!

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.

Introduction: Securing the Digital Frontier with Linux-Based Ethical Hacking In our increasingly interconnected world, cybersecurity is paramount. Ethical hacking and penetration testing are vital for proactively identifying and mitigating vulnerabi

The methods for basic Linux learning from scratch include: 1. Understand the file system and command line interface, 2. Master basic commands such as ls, cd, mkdir, 3. Learn file operations, such as creating and editing files, 4. Explore advanced usage such as pipelines and grep commands, 5. Master debugging skills and performance optimization, 6. Continuously improve skills through practice and exploration.

Linux is widely used in servers, embedded systems and desktop environments. 1) In the server field, Linux has become an ideal choice for hosting websites, databases and applications due to its stability and security. 2) In embedded systems, Linux is popular for its high customization and efficiency. 3) In the desktop environment, Linux provides a variety of desktop environments to meet the needs of different users.

The disadvantages of Linux include user experience, software compatibility, hardware support, and learning curve. 1. The user experience is not as friendly as Windows or macOS, and it relies on the command line interface. 2. The software compatibility is not as good as other systems and lacks native versions of many commercial software. 3. Hardware support is not as comprehensive as Windows, and drivers may be compiled manually. 4. The learning curve is steep, and mastering command line operations requires time and patience.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Notepad++7.3.1
Easy-to-use and free code editor