Linuxでストレージの型番やシリアルを確認する方法(HDD SSD NVMe)

SATA接続のストレージを調べる方法【要root】
SATA・NVMe接続のストレージの詳細情報を調べる方法【要root】
接続情報からストレージの型番を調べる方法【一般ユーザ可】

[参考記事] CPUやストレージの温度を調べる方法(CPU HDD SSD NVMe)
[参考記事] 各ストレージの速度一覧 規格速度や実効速度(HDD/SSD/M2/NVMe/USBメモリ)
[参考記事] LinuxでNTFS(Windows形式)のフォーマットをする方法

SATA接続のストレージを調べる方法

hdparmコマンドを使います。
デバイス名が/dev/sdaのようにあらわされるストレージの情報を調べることができます。
M.2接続でもNVMe(PCIe)ではないSATAのものも調べられます。

hdparmは標準コマンドなのでインストールなしで使用できます。
実行にはroot権限が必要です。

# hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
        Model Number:       ST8000DM004-2CXXXX
        Serial Number:      WSCXXXXX
        Firmware Revision:  0001    
        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
        Used: unknown (minor revision code 0x006d) 
        Supported: 10 9 8 7 6 5 
        Likely used: 10
Configuration:
        Logical         max     current
        cylinders       16383   16383
        heads           16      16
        sectors/track   63      63
        --
        CHS current addressable sectors:    16514064
        LBA    user addressable sectors:   268435455
        LBA48  user addressable sectors: 15628053168
        Logical  Sector size:                   512 bytes
        Physical Sector size:                  4096 bytes
        Logical Sector-0 offset:                  0 bytes
        device size with M = 1024*1024:     7630885 MBytes
        device size with M = 1000*1000:     8001563 MBytes (8001 GB)
        cache/buffer size  = unknown
        Form Factor: 3.5 inch
        Nominal Media Rotation Rate: 5425
Capabilities:
        LBA, IORDY(can be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Standard, no device specific minimum
        R/W multiple sector transfer: Max = 16  Current = 16
        Recommended acoustic management value: 208, current value: 208
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4 
             Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    SMART feature set
                Security Mode feature set
           *    Power Management feature set
           *    Write cache
           *    Look-ahead
           *    Host Protected Area feature set
           *    WRITE_BUFFER command
           *    READ_BUFFER command
           *    DOWNLOAD_MICROCODE
                Power-Up In Standby feature set
           *    SET_FEATURES required to spinup after power up
                SET_MAX security extension
           *    48-bit Address feature set
           *    Mandatory FLUSH_CACHE
           *    FLUSH_CACHE_EXT
           *    SMART error logging
           *    SMART self-test
           *    General Purpose Logging feature set
           *    WRITE_{DMA|MULTIPLE}_FUA_EXT
           *    64-bit World wide name
                Write-Read-Verify feature set
           *    WRITE_UNCORRECTABLE_EXT command
           *    {READ,WRITE}_DMA_EXT_GPL commands
           *    Segmented DOWNLOAD_MICROCODE
           *    unknown 119[6]
           *    unknown 119[7]
           *    Gen1 signaling speed (1.5Gb/s)
           *    Gen2 signaling speed (3.0Gb/s)
           *    Gen3 signaling speed (6.0Gb/s)
           *    Native Command Queueing (NCQ)
           *    Host-initiated interface power management
           *    Phy event counters
           *    READ_LOG_DMA_EXT equivalent to READ_LOG_EXT
           *    DMA Setup Auto-Activate optimization
                Device-initiated interface power management
           *    Software settings preservation
                unknown 78[7]
           *    SMART Command Transport (SCT) feature set
           *    SCT Write Same (AC2)
           *    SCT Data Tables (AC5)
                unknown 206[7]
                unknown 206[12] (vendor specific)
                unknown 206[13] (vendor specific)
           *    DOWNLOAD MICROCODE DMA command
Security: 
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
                frozen
        not     expired: security count
                supported: enhanced erase
        1008min for SECURITY ERASE UNIT. 1008min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5000c500d573248a
        NAA             : 5
        IEEE OUI        : 000c50
        Unique ID       : 0d573248a
Checksum: correct

SATA・NVMe接続のストレージの詳細情報を調べる方法

smartmontoolsパッケージ内のsmartctlコマンドを使います。
このコマンドはroot権限が必要です。

デバイス名が/dev/nvme0のようにあらわされるストレージだけでなく/dev/sdaなどの情報を調べることができます。
あくまでストレージデバイスに組み込まれているSMART機能を読み込むため/dev/md0のようなRAIDは調べることができません。
USB接続のHDDなどで変換するチップにSMARTを読み取る機能がない場合は、dオプションを使用します。(後述)

smartctlはハードディスクの自己診断機能であるSelf-Monitoring, Analysis and Reporting Technology 略してS.M.A.R.T.を表示するコマンドです。

smartmontoolsのインストール

CentOS / RedHat系

# yum -y install smartmontools

Ubuntu / Raspberry Pi OS系

$ sudo apt install smartmontools

実行例

ストレージの型番や電源投入回数、稼働時間など様々な情報が表示されます。
また表示される情報やフォーマットはメーカーや型番により違います。

# smartctl -a /dev/nvme0
smartctl 7.1 2020-04-05 r5049 [x86_64-linux-4.18.0-277.el8.x86_64] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       CT1000P1SSD8
Serial Number:                      202528C6A711
Firmware Version:                   P3CR021
PCI Vendor/Subsystem ID:            0xc0a9
IEEE OUI Identifier:                0x00a075
Controller ID:                      0
Number of Namespaces:               1
Namespace 1 Size/Capacity:          1,000,204,886,016 [1.00 TB]
Namespace 1 Formatted LBA Size:     512
Namespace 1 IEEE EUI-64:            00a075 0128c6a711
Local Time is:                      Thu Apr  1 17:40:23 2021 JST
Firmware Updates (0x14):            2 Slots, no Reset required
Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
Optional NVM Commands (0x005f):     Comp Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp
Maximum Data Transfer Size:         32 Pages
Warning  Comp. Temp. Threshold:     87 Celsius
Critical Comp. Temp. Threshold:     90 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     9.00W       -        -    0  0  0  0        5       5
 1 +     4.60W       -        -    1  1  1  1       30      30
 2 +     3.80W       -        -    2  2  2  2       30      30
 3 -   0.0300W       -        -    3  3  3  3     1000    1000
 4 -   0.0030W       -        -    4  4  4  4     6000    8000

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         0

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        38 Celsius
Available Spare:                    100%
Available Spare Threshold:          5%
Percentage Used:                    0%
Data Units Read:                    1,027,134 [525 GB]
Data Units Written:                 1,177,841 [603 GB]
Host Read Commands:                 66,953,222
Host Write Commands:                64,846,745
Controller Busy Time:               3,932
Power Cycles:                       39
Power On Hours:                     1,098
Unsafe Shutdowns:                   13
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               38 Celsius

Error Information (NVMe Log 0x01, max 256 entries)
No Errors Logged

USB接続でデバイス情報が見れない場合は、-d satなどでデバイスの種類を指定すると見れます。

-d TYPE, --device=TYPE
Specify device type to one of:
ata, scsi[+TYPE], nvme[,NSID], sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,p][,x][,N], usbprolific, usbsunplus, sntjmicron[,NSID], intelliprop,N[+TYPE], jmb39x,N[,sLBA][,force][+TYPE], marvell, areca,N/E, 3ware,N, hpt,L/M/N, megaraid,N, aacraid,H,L,ID, cciss,N, auto, test
# smartctl -a /dev/sda -d sat

接続情報からストレージの型番を調べる方法

/proc/scsi/scsiの情報を読み取ることで、型番を調べることができます。
この操作はroot権限が不要のため、一般ユーザー権限でも型番を調べられます。

SATA接続の通信に使用されるATAPIはSCSIコマンドを使用しているため、SCSIプロトコルの一覧から調べることができます。

$ cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: ST8000DM004-2CX1 Rev: 0001
  Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: HL-DT-ST Model: DVD+-RW GU90N    Rev: A1C1
  Type:   CD-ROM                           ANSI  SCSI revision: 05
Host: scsi4 Channel: 00 Id: 00 Lun: 00
  Vendor: ASMT     Model: 2115             Rev: 0   
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi6 Channel: 00 Id: 00 Lun: 00
  Vendor: ASMT     Model: 2115             Rev: 0   
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi5 Channel: 00 Id: 00 Lun: 00
  Vendor: ST8000DM Model: 004-2CX188       Rev: 0125
  Type:   Direct-Access                    ANSI  SCSI revision: 06

関連記事

スポンサーリンク

Uptime measure アップタイム測定

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る