리눅스는 SSD 또는 HDD를 참조하기 어렵다

하드 디스크

솔리드 스테이트 하드 드라이브 32G, 기계적 하드 드라이브 500G.

테스트

32G 고체 상태 :

root@www:~# cat /sys/block/sda/queue/rotational
0

root@www:~# cat /sys/block/sda/uevent
MAJOR=8
MINOR=0
DEVNAME=sda
DEVTYPE=disk
PHYSDEVPATH=/devices/platform/ahci.0/ata1/host0/target0:0:0/0:0:0:0
PHYSDEVBUS=scsi
PHYSDEVDRIVER=sd

root@www:~# fdisk -lu
Disk /dev/sda: 32.0 GB, 32017047552 bytes
255 heads, 63 sectors/track, 3892 cylinders, total 62533296 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1              63    62524979    31262458+ 83 Linux

500G 기계 :

root@www:~# cat /sys/block/sda/queue/rotational 
1

root@www:~# cat /sys/block/sda/uevent
MAJOR=8
MINOR=0
DEVNAME=sda
DEVTYPE=disk
PHYSDEVPATH=/devices/platform/ahci.0/ata1/host0/target0:0:0/0:0:0:0
PHYSDEVBUS=scsi
PHYSDEVDRIVER=sd

root@www:~# fdisk -lu
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1              63     3919859     1959898+ 83 Linux
/dev/sda2         3919860   976768064   486424102+ 83 Linux

개요

보기 / SYS / 블록 / SDA / 큐 / 회전 수치, 회전기가 어렵다 나타내는 비 회전 SSD 0이다.

문제

1, TF 카드 또는 SD 카드 또는 U 디스크,이 값은 있나요? 얼마나? [1]가 값

2, 어떻게 하드 디스크 매개 변수를 보려면? [hdparm을 [OPTIONS] DEVICE]

hdparm을보기 SD 카드 정보 :

/dev/sda:
hdparm: ioctl 0x304 failed: Invalid argument
hdparm: HDIO_GET_IDENTITY: Invalid argument

3, 디바이스 노드 이름 검색

~ # fdisk -l
Disk /dev/sdb: 31.1 GB, 31104958464 bytes
255 heads, 63 sectors/track, 3781 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sdb1               1        3780    30362818+ 83 Linux

Disk /dev/sda: 15.5 GB, 15502147584 bytes
255 heads, 63 sectors/track, 1884 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1        1883    15125166  83 Linux
~ # 
~ # fdisk -l|grep "Disk /dev/sd[a-z]:.*GB"|awk -F ':' '{print$1}'|awk '{printf "
%s ",$2}'
/dev/sdb /dev/sda 
~ # 

4. 요약 : 하드 드라이브 정보를 볼 hdparm을 사용해서, 용량 노드있다 FDISK 검색하고, 다음 회전 값을 확인 : 하드 디스크 여부를 결정한다.

 

추천

출처blog.csdn.net/TSZ0000/article/details/90023520