Ubuntu 24.04
Sponsored Link

ディスクの設定情報を表示する2024/07/01

 
コンピューターに搭載されたディスクの設定等の情報を表示します。
[1] 必要なパッケージをインストールします。
SCSI や SATA 接続のデバイスについては [hdparm]、NVMe 接続の M.2 SSD 等のデバイスについては [nvme-cli] をインストールします。
root@dlp:~#
apt -y install hdparm nvme-cli
[2] [hdparm] の基本的な操作です。当例では設定情報の表示のみを例示します。
# ディスクの設定情報を表示

root@dlp:~#
hdparm /dev/sda


/dev/sda:
 multcount     = 16 (on)
 IO_support    =  1 (32-bit)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 15566/255/63, sectors = 250069680, start = 0

# ディスクの詳細な情報を表示

root@dlp:~#
hdparm -I /dev/sda


/dev/sda:

ATA device, with non-removable media
        Model Number:       TOSHIBA THNSNH128GCST
        Serial Number:      Y3TS108TTPEY
        Firmware Revision:  HTRAN101
        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
        Supported: 9 8 7 6 5
        Likely used: 9
Configuration:
        Logical         max     current
        cylinders       16383   16383
        heads           16      16
        sectors/track   63      63
        --
        CHS current addressable sectors:    16514064
        LBA    user addressable sectors:   250069680
        LBA48  user addressable sectors:   250069680
        Logical  Sector size:                   512 bytes
        Physical Sector size:                   512 bytes
        Logical Sector-0 offset:                  0 bytes
        device size with M = 1024*1024:      122104 MBytes
        device size with M = 1000*1000:      128035 MBytes (128 GB)
        cache/buffer size  = unknown
        Form Factor: 2.5 inch
        Nominal Media Rotation Rate: Solid State Device
.....
.....

# デバイスとキャッシュの読み出し性能をテストする

root@dlp:~#
hdparm -Tt /dev/sda


/dev/sda:
 Timing cached reads:   20864 MB in  1.99 seconds = 10484.78 MB/sec
 Timing buffered disk reads: 1522 MB in  3.00 seconds = 507.15 MB/sec
[3] [nvme-cli] の基本的な操作です。当例では設定情報の表示のみを例示します。
# NVMe デバイスを表示する

root@dlp:~#
nvme list

Node                  Generic               SN                   Model                                    Namespace  Usage                      Format           FW Rev
--------------------- --------------------- -------------------- ---------------------------------------- ---------- -------------------------- ---------------- --------
/dev/nvme0n1          /dev/ng0n1            BTNH93310Q5T1P0B     INTEL SSDPEKNW010T8                      0x1          1.02  TB /   1.02  TB    512   B +  0 B   002C

# デバイス情報を表示する

root@dlp:~#
nvme id-ctrl -H /dev/nvme0n1


NVME Identify Controller:
vid       : 0x8086
ssvid     : 0x8086
sn        : BTNH93310Q5T1P0B
mn        : INTEL SSDPEKNW010T8
fr        : 002C
rab       : 6
ieee      : 5cd2e4
cmic      : 0
  [3:3] : 0     ANA not supported
  [2:2] : 0     PCI
  [1:1] : 0     Single Controller
  [0:0] : 0     Single Port

mdts      : 5
cntlid    : 0x1
ver       : 0x10300
rtd3r     : 0x7a120
rtd3e     : 0x1e8480
oaes      : 0x200
  [31:31] : 0   Discovery Log Change Notice Not Supported
  [27:27] : 0   Zone Descriptor Changed Notices Not Supported
.....
.....

# SMART ログを表示する

root@dlp:~#
nvme smart-log /dev/nvme0n1

Smart Log for NVME device:nvme0n1 namespace-id:ffffffff
critical_warning                        : 0
temperature                             : 36 °C (309 K)
available_spare                         : 100%
available_spare_threshold               : 10%
percentage_used                         : 1%
endurance group critical warning summary: 0
Data Units Read                         : 1421357 (727.73 GB)
Data Units Written                      : 9200666 (4.71 TB)
host_read_commands                      : 10750557
host_write_commands                     : 58813993
controller_busy_time                    : 538
power_cycles                            : 55
power_on_hours                          : 24735
unsafe_shutdowns                        : 4
media_errors                            : 0
num_err_log_entries                     : 0
Warning Temperature Time                : 0
Critical Composite Temperature Time     : 0
Thermal Management T1 Trans Count       : 284
Thermal Management T2 Trans Count       : 0
Thermal Management T1 Total Time        : 2072
Thermal Management T2 Total Time        : 0

# エラーログを表示する

root@dlp:~#
nvme error-log /dev/nvme0n1

Error Log Entries for device:nvme0n1 entries:64

.....
.....

.................
 Entry[63]
.................
error_count     : 0
sqid            : 0
cmdid           : 0
status_field    : 0(Successful Completion: The command completed without error)
phase_tag       : 0
parm_err_loc    : 0
lba             : 0
nsid            : 0
vs              : 0
trtype          : The transport type is not indicated or the error is not transport related.
csi             : 0
opcode          : 0
cs              : 0
trtype_spec_info: 0
log_page_version: 0
.................
[4] 接続方式に関係なく使用可能なベンチマークツール [fio (Flexible I/O Tester)] コマンドでのディスク性能のテストです。
root@dlp:~#
apt -y install fio
root@dev:~#
df -h /mnt

Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1  938G  432G  459G  49% /mnt

# ブロックサイズ 4K でのシーケンシャルリード性能をテストする

root@dlp:~#
fio --bs=4k --size=1G --direct=1 --rw=read --numjobs=64 --runtime=10 --group_reporting --name=testjob4K1G --filename=/mnt/testfile4K1G


testjob4K1G: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
...
fio-3.36
Starting 64 processes
testjob4K1G: Laying out IO file (1 file / 1024MiB)
Jobs: 64 (f=64): [R(64)][100.0%][r=673MiB/s][r=172k IOPS][eta 00m:00s]
testjob4K1G: (groupid=0, jobs=64): err= 0: pid=21881: Mon Jul  1 00:47:13 2024
  read: IOPS=165k, BW=643MiB/s (674MB/s)(6434MiB/10005msec)
    clat (usec): min=88, max=4782, avg=387.44, stdev=136.53
     lat (usec): min=88, max=4782, avg=387.54, stdev=136.53
    clat percentiles (usec):
     |  1.00th=[  184],  5.00th=[  229], 10.00th=[  269], 20.00th=[  277],
     | 30.00th=[  322], 40.00th=[  334], 50.00th=[  367], 60.00th=[  408],
     | 70.00th=[  416], 80.00th=[  461], 90.00th=[  510], 95.00th=[  578],
     | 99.00th=[  807], 99.50th=[ 1057], 99.90th=[ 1827], 99.95th=[ 1942],
     | 99.99th=[ 2278]
   bw (  KiB/s): min=433679, max=695082, per=100.00%, avg=659089.49, stdev=937.47, samples=1279
   iops        : min=108403, max=173768, avg=164769.37, stdev=234.43, samples=1279
  lat (usec)   : 100=0.01%, 250=8.36%, 500=75.48%, 750=14.93%, 1000=0.65%
  lat (msec)   : 2=0.53%, 4=0.03%, 10=0.01%
  cpu          : usr=0.78%, sys=2.02%, ctx=1647337, majf=0, minf=934
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=1647195,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
   READ: bw=643MiB/s (674MB/s), 643MiB/s-643MiB/s (674MB/s-674MB/s), io=6434MiB (6747MB), run=10005-10005msec

Disk stats (read/write):
  nvme0n1: ios=1647053/9, sectors=13176424/144, merge=0/9, ticks=620747/3, in_queue=620751, util=98.60%

# ブロックサイズ 512K でのシーケンシャルリード性能をテストする

root@dlp:~#
fio --bs=512k --size=1G --direct=1 --rw=read --numjobs=64 --runtime=10 --group_reporting --name=testjob512K1G --filename=/mnt/testfile512K1G


testjob512K1G: (g=0): rw=read, bs=(R) 512KiB-512KiB, (W) 512KiB-512KiB, (T) 512KiB-512KiB, ioengine=psync, iodepth=1
...
fio-3.36
Starting 64 processes
testjob512K1G: Laying out IO file (1 file / 1024MiB)
Jobs: 64 (f=64): [R(64)][100.0%][r=1419MiB/s][r=2837 IOPS][eta 00m:00s]
testjob512K1G: (groupid=0, jobs=64): err= 0: pid=21988: Mon Jul  1 00:49:18 2024
  read: IOPS=2823, BW=1412MiB/s (1480MB/s)(13.8GiB/10023msec)
    clat (usec): min=7334, max=34826, avg=22631.35, stdev=2328.69
     lat (usec): min=7335, max=34827, avg=22631.82, stdev=2328.68
    clat percentiles (usec):
     |  1.00th=[12518],  5.00th=[21103], 10.00th=[21890], 20.00th=[22152],
     | 30.00th=[22414], 40.00th=[22676], 50.00th=[22938], 60.00th=[23200],
     | 70.00th=[23462], 80.00th=[23725], 90.00th=[24249], 95.00th=[24773],
     | 99.00th=[26870], 99.50th=[27919], 99.90th=[31327], 99.95th=[32113],
     | 99.99th=[34866]
   bw (  MiB/s): min= 1342, max= 1473, per=100.00%, avg=1413.48, stdev= 0.60, samples=1232
   iops        : min= 2684, max= 2946, avg=2826.80, stdev= 1.21, samples=1232
  lat (msec)   : 10=0.05%, 20=4.80%, 50=95.16%
  cpu          : usr=0.04%, sys=0.46%, ctx=28796, majf=0, minf=12393
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=28301,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
   READ: bw=1412MiB/s (1480MB/s), 1412MiB/s-1412MiB/s (1480MB/s-1480MB/s), io=13.8GiB (14.8GB), run=10023-10023msec

Disk stats (read/write):
  nvme0n1: ios=111248/10, sectors=28479488/144, merge=0/8, ticks=2464094/88, in_queue=2464211, util=98.53%
関連コンテンツ