Skip to content

Instantly share code, notes, and snippets.

@ryozi-tn
Created November 25, 2023 00:16
Show Gist options
  • Save ryozi-tn/53826db85ec3c0b0b47dd76579a25b90 to your computer and use it in GitHub Desktop.
Save ryozi-tn/53826db85ec3c0b0b47dd76579a25b90 to your computer and use it in GitHub Desktop.
ディスクの内周と外周を測ってみる.sh
[ryozi@localhost ~]$ # 外周読み取り
[ryozi@localhost ~]$ sudo fio -direct=1 -name=test -filename=$DEVICE -rw=read -bs=1M -size=$SIZE -offset=0
fio-3.35
Starting 1 process
Jobs: 1 (f=1)
Jobs: 1 (f=1): [R(1)][100.0%][r=212MiB/s][r=212 IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=7734: Sat Nov 25 09:13:47 2023
read: IOPS=202, BW=202MiB/s (212MB/s)(4096MiB/20246msec)
clat (usec): min=1883, max=341821, avg=4942.21, stdev=5418.66
lat (usec): min=1883, max=341821, avg=4942.27, stdev=5418.66
clat percentiles (msec):
| 1.00th=[ 5], 5.00th=[ 5], 10.00th=[ 5], 20.00th=[ 5],
| 30.00th=[ 5], 40.00th=[ 5], 50.00th=[ 5], 60.00th=[ 6],
| 70.00th=[ 6], 80.00th=[ 6], 90.00th=[ 6], 95.00th=[ 6],
| 99.00th=[ 6], 99.50th=[ 7], 99.90th=[ 14], 99.95th=[ 50],
| 99.99th=[ 342]
bw ( KiB/s): min=73728, max=221184, per=100.00%, avg=207411.20, stdev=23030.75, samples=40
iops : min= 72, max= 216, avg=202.55, stdev=22.49, samples=40
lat (msec) : 2=0.17%, 4=0.02%, 10=99.56%, 20=0.15%, 50=0.07%
lat (msec) : 500=0.02%
cpu : usr=0.02%, sys=0.24%, ctx=8192, majf=0, minf=266
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=4096,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=202MiB/s (212MB/s), 202MiB/s-202MiB/s (212MB/s-212MB/s), io=4096MiB (4295MB), run=20246-20246msec
Disk stats (read/write):
sdb: ios=8164/0, merge=0/0, ticks=33394/0, in_queue=33393, util=99.52%
[ryozi@localhost ~]$ # 内周読み取り
[ryozi@localhost ~]$ sudo fio -direct=1 -name=test -filename=$DEVICE -rw=read -bs=1M -size=$SIZE -offset=$OFFSET
test: (g=0): rw=read, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=psync, iodepth=1
fio-3.35
Starting 1 process
Jobs: 1 (f=1): [R(1)][100.0%][r=90.0MiB/s][r=90 IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=7751: Sat Nov 25 09:14:32 2023
read: IOPS=92, BW=92.6MiB/s (97.1MB/s)(4096MiB/44236msec)
clat (usec): min=1932, max=55396, avg=10799.18, stdev=1665.47
lat (usec): min=1932, max=55396, avg=10799.22, stdev=1665.47
clat percentiles (usec):
| 1.00th=[ 9372], 5.00th=[10028], 10.00th=[10028], 20.00th=[10159],
| 30.00th=[10683], 40.00th=[10814], 50.00th=[10945], 60.00th=[10945],
| 70.00th=[10945], 80.00th=[11076], 90.00th=[11076], 95.00th=[11207],
| 99.00th=[11338], 99.50th=[12256], 99.90th=[54789], 99.95th=[55313],
| 99.99th=[55313]
bw ( KiB/s): min=86016, max=102400, per=99.92%, avg=94743.27, stdev=3519.88, samples=88
iops : min= 84, max= 100, avg=92.52, stdev= 3.44, samples=88
lat (msec) : 2=0.02%, 4=0.02%, 10=4.64%, 20=95.12%, 50=0.07%
lat (msec) : 100=0.12%
cpu : usr=0.00%, sys=0.11%, ctx=8192, majf=0, minf=264
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=4096,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=92.6MiB/s (97.1MB/s), 92.6MiB/s-92.6MiB/s (97.1MB/s-97.1MB/s), io=4096MiB (4295MB), run=44236-44236msec
Disk stats (read/write):
sdb: ios=4085/0, merge=0/0, ticks=44089/0, in_queue=44089, util=99.79%
[ryozi@localhost ~]$
[ryozi@localhost ~]$ # 外周書き込み
[ryozi@localhost ~]$ sudo fio -direct=1 -name=test -filename=$DEVICE -rw=write -bs=1M -size=$SIZE -offset=0
test: (g=0): rw=write, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=psync, iodepth=1
fio-3.35
Starting 1 process
Jobs: 1 (f=1): [W(1)][100.0%][w=203MiB/s][w=203 IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=7768: Sat Nov 25 09:14:52 2023
write: IOPS=204, BW=205MiB/s (215MB/s)(4096MiB/19981msec); 0 zone resets
clat (usec): min=2018, max=49871, avg=4870.87, stdev=1385.69
lat (usec): min=2025, max=49878, avg=4877.64, stdev=1385.68
clat percentiles (usec):
| 1.00th=[ 4293], 5.00th=[ 4293], 10.00th=[ 4293], 20.00th=[ 4424],
| 30.00th=[ 4490], 40.00th=[ 4621], 50.00th=[ 4686], 60.00th=[ 5080],
| 70.00th=[ 5145], 80.00th=[ 5276], 90.00th=[ 5407], 95.00th=[ 5473],
| 99.00th=[ 5473], 99.50th=[ 6652], 99.90th=[16581], 99.95th=[49546],
| 99.99th=[50070]
bw ( KiB/s): min=182272, max=223232, per=99.91%, avg=209736.21, stdev=9239.54, samples=39
iops : min= 178, max= 218, avg=204.82, stdev= 9.02, samples=39
lat (msec) : 4=0.12%, 10=99.54%, 20=0.27%, 50=0.07%
cpu : usr=0.18%, sys=0.29%, ctx=4098, majf=0, minf=11
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=0,4096,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):
WRITE: bw=205MiB/s (215MB/s), 205MiB/s-205MiB/s (215MB/s-215MB/s), io=4096MiB (4295MB), run=19981-19981msec
Disk stats (read/write):
sdb: ios=46/8156, merge=0/0, ticks=6/32723, in_queue=32729, util=99.53%
[ryozi@localhost ~]$ # 内周書き込み
[ryozi@localhost ~]$ sudo fio -direct=1 -name=test -filename=$DEVICE -rw=write -bs=1M -size=$SIZE -offset=$OFFSET
test: (g=0): rw=write, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=psync, iodepth=1
fio-3.35
Starting 1 process
Jobs: 1 (f=1): [W(1)][100.0%][w=95.0MiB/s][w=95 IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=7799: Sat Nov 25 09:15:36 2023
write: IOPS=92, BW=92.6MiB/s (97.1MB/s)(4096MiB/44247msec); 0 zone resets
clat (usec): min=1984, max=125141, avg=10795.91, stdev=2313.25
lat (usec): min=1989, max=125146, avg=10801.89, stdev=2313.24
clat percentiles (msec):
| 1.00th=[ 10], 5.00th=[ 11], 10.00th=[ 11], 20.00th=[ 11],
| 30.00th=[ 11], 40.00th=[ 11], 50.00th=[ 11], 60.00th=[ 11],
| 70.00th=[ 11], 80.00th=[ 12], 90.00th=[ 12], 95.00th=[ 12],
| 99.00th=[ 12], 99.50th=[ 13], 99.90th=[ 34], 99.95th=[ 56],
| 99.99th=[ 126]
bw ( KiB/s): min=73728, max=102400, per=99.95%, avg=94743.27, stdev=4054.53, samples=88
iops : min= 72, max= 100, avg=92.52, stdev= 3.96, samples=88
lat (msec) : 2=0.15%, 4=0.07%, 10=4.66%, 20=94.87%, 50=0.15%
lat (msec) : 100=0.07%, 250=0.02%
cpu : usr=0.06%, sys=0.15%, ctx=4100, majf=0, minf=9
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=0,4096,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):
WRITE: bw=92.6MiB/s (97.1MB/s), 92.6MiB/s-92.6MiB/s (97.1MB/s-97.1MB/s), io=4096MiB (4295MB), run=44247-44247msec
Disk stats (read/write):
sdb: ios=46/8172, merge=0/0, ticks=29/73037, in_queue=73067, util=99.85%
[ryozi@localhost ~]$
# 対象デバイスIDとストレージサイズを得る
sudo fdisk -l
# 出力例:
# Disk /dev/sdb: 5.46 TiB, 6001175126016 bytes, 11721045168 sectors
# Disk model: WDC WD60EZAX-00C
# Units: sectors of 1 * 512 = 512 bytes
# Sector size (logical/physical): 512 bytes / 4096 bytes
# I/O size (minimum/optimal): 4096 bytes / 4096 bytes
# bytes単位でストレージサイズ指定
STORAGE_SIZE=6001175126016
# デバイス指定 ※大事なデータがあるデバイスは指定しないこと
DEVICE=/dev/sdX
# 計測サイズ
DATA_SIZE=$((1024*1024*1024*4))
# 内周の開始位置
OFFSET=$(($STORAGE_SIZE - $SIZE))
# 外周読み取り
sudo fio -direct=1 -name=test -filename=$DEVICE -rw=read -bs=1M -size=$SIZE -offset=0
# 内周読み取り
sudo fio -direct=1 -name=test -filename=$DEVICE -rw=read -bs=1M -size=$SIZE -offset=$OFFSET
# 外周書き込み
sudo fio -direct=1 -name=test -filename=$DEVICE -rw=write -bs=1M -size=$SIZE -offset=0
# 内周書き込み
sudo fio -direct=1 -name=test -filename=$DEVICE -rw=write -bs=1M -size=$SIZE -offset=$OFFSET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment