1.查看硬盘型号
fdisk -l //查看你的硬盘编号,如sda,sdb 等
[root@root web]# fdisk -l
Disk /dev/sda: 300.0 GB, 299966445568 bytes, 585871964 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk label type: dos
Disk identifier: 0x000aaaaa
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 33794047 16384000 82 Linux swap / Solaris
/dev/sda3 33794048 34818047 512000 6 FAT16
/dev/sda4 34818048 585871359 275526656 5 Extended
/dev/sda5 34820096 585871359 275525632 83 Linux
硬盘的读写是以sector扇区为单位,1扇区是512bytes;操作系统是对硬盘的读写是以block块为单位 1块是 8 * 512bytes = 4K
2.查详细硬盘信息
smartctl --all /dev/sda
[root@root web]# smartctl --all /dev/sda
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-514.el7.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Vendor: HP
Product: LOGICAL VOLUME
Revision: 8.32
User Capacity: 299,966,445,568 bytes [299 GB]
Logical block size: 512 bytes
Logical Unit id: 0xdddddd
Serial number: 0011111111111
Device type: disk
Local Time is: Wed Apr 15 09:18:23 2020 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
Temperature Warning: Disabled or Not Supported
3.Linux查看硬盘是SSD还是HDD
cat /sys/block/sda/queue/rotational
查看/sys/block/sda/queue/rotational数值,1表示旋转就是机械硬盘,0非旋转就是固态硬盘。
4.列出所有存储设备
[root@root /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 279.4G 0 disk
├─sda1 8:1 0 500M 0 part /boot
├─sda2 8:2 0 15.6G 0 part [SWAP]
├─sda3 8:3 0 500M 0 part /boot/efi
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 262.8G 0 part /