はじめに
Ubuntu でデバイスの Read/Write パフォーマンス計測したいな。。。
そうだ、 f3 しよう
容量の偽装もチェックできるし
f3 とは
F3は"Fight Flash Fraud"または"Fight Fake Flash"の略。
フラッシュメモリ(USBフラッシュドライブやSDカードなど)の性能と容量をテストするためのオープンソースソフトウェア。
F3は、元々Linuxで動作するツールとして開発されたが、現在ではWindowsやmacOSなど他のプラットフォームでも利用可能。
F3は偽造されたフラッシュメモリを検出するために使われる。
市場には、特に安価な製品の中に、容量を偽って表示しているフラッシュメモリが存在する。
例えば、USBドライブが32GBの容量があると表示していても、実際にはそれよりはるかに少ない容量しか利用できない場合がある。
F3は、このような偽装されたフラッシュメモリを検出するために開発された。
F3には主に二つのコマンド、f3writeとf3readが含まれている。
f3write: テスト対象のフラッシュメモリに特定のパターンのデータを書き込む。このデータは後で検証のために使用される。
f3read: f3writeによって書き込まれたデータを読み出し、そのデータが正しく保存されているかを検証する。読み出したデータが書き込まれたときのデータと一致しなければ、そのフラッシュメモリには何らかの問題があると判断できる。
これらのコマンドを使用することで、フラッシュメモリの真の容量とパフォーマンスを確認することができる。
前提条件
- 環境
$ uname -a
Linux smb_host 5.15.0-75-generic #82-Ubuntu SMP Tue Jun 6 23:10:23 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
インストール
$ sudo apt install f3
使い方
簡単なテスト f3probe
完全なテスト f3write/f3read
簡単テスト
デバイスを指定する、マウントは必要ない
$ sudo f3probe
F3 probe 8.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
WARNING: Probing normally takes from a few seconds to 15 minutes, but
it can take longer. Please be patient.
Probe finished, recovering blocks... Done
Good news: The device `/dev/sdd' is the real thing
Device geometry:
*Usable* size: 116.48 GB (244277248 blocks)
Announced size: 116.48 GB (244277248 blocks)
Module: 128.00 GB (2^37 Bytes)
Approximate cache size: 0.00 Byte (0 blocks), need-reset=no
Physical block size: 512.00 Byte (2^9 Bytes)
Probe time: 5'05"
さらに簡略テスト
$ sudo f3probe --destructive --time-ops /dev/sdd
F3 probe 8.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
WARNING: Probing normally takes from a few seconds to 15 minutes, but
it can take longer. Please be patient.
Good news: The device `/dev/sdd' is the real thing
Device geometry:
*Usable* size: 116.48 GB (244277248 blocks)
Announced size: 116.48 GB (244277248 blocks)
Module: 128.00 GB (2^37 Bytes)
Approximate cache size: 0.00 Byte (0 blocks), need-reset=no
Physical block size: 512.00 Byte (2^9 Bytes)
Probe time: 4'
Operation: total time / count = avg time
Read: 588.2ms / 4817 = 122us
Write: 3'59" / 4192321 = 57us
Reset: 0us / 1 = 0us
完全なテスト
書き込み
マウントしているドライブを指定する
$ sudo f3write /export
F3 write 8.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
Free space: 116.46 GB
Creating file 1.h2w ... OK!
Creating file 2.h2w ... OK!
Creating file 3.h2w ... OK!
Creating file 4.h2w ... OK!
Creating file 5.h2w ... OK!
Creating file 6.h2w ... OK!
Creating file 7.h2w ... OK!
Creating file 8.h2w ... OK!
Creating file 9.h2w ... OK!
:
:
Creating file 110.h2w ... OK!
Creating file 111.h2w ... OK!
Creating file 112.h2w ... OK!
Creating file 113.h2w ... OK!
Creating file 114.h2w ... OK!
Creating file 115.h2w ... OK!
Creating file 116.h2w ... OK!
Creating file 117.h2w ... OK!
Free space: 0.00 Byte
Average writing speed: 44.60 MB/s
読み込み
マウントしているドライブを指定する
$ sudo f3read /export
F3 read 8.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
SECTORS ok/corrupted/changed/overwritten
Validating file 1.h2w ... 2097152/ 0/ 0/ 0
Validating file 2.h2w ... 2097152/ 0/ 0/ 0
Validating file 3.h2w ... 2097152/ 0/ 0/ 0
Validating file 4.h2w ... 2097152/ 0/ 0/ 0
Validating file 5.h2w ... 2097152/ 0/ 0/ 0
Validating file 6.h2w ... 2097152/ 0/ 0/ 0
Validating file 7.h2w ... 2097152/ 0/ 0/ 0
Validating file 8.h2w ... 2097152/ 0/ 0/ 0
Validating file 9.h2w ... 2097152/ 0/ 0/ 0
:
:
Validating file 110.h2w ... 2097152/ 0/ 0/ 0
Validating file 111.h2w ... 2097152/ 0/ 0/ 0
Validating file 112.h2w ... 2097152/ 0/ 0/ 0
Validating file 113.h2w ... 2097152/ 0/ 0/ 0
Validating file 114.h2w ... 2097152/ 0/ 0/ 0
Validating file 115.h2w ... 2097152/ 0/ 0/ 0
Validating file 116.h2w ... 2097152/ 0/ 0/ 0
Validating file 117.h2w ... 964480/ 0/ 0/ 0
Data OK: 116.46 GB (244234112 sectors)
Data LOST: 0.00 Byte (0 sectors)
Corrupted: 0.00 Byte (0 sectors)
Slightly changed: 0.00 Byte (0 sectors)
Overwritten: 0.00 Byte (0 sectors)
Average reading speed: 86.88 MB/s
さいごに
かんたんでしたね