hardware:raspberry_pi:sdcard_overclock

文書の過去の版を表示しています。


Raspberry Pi で SD カードをオーバークロック🔥💥する方法🤤

注意!! UHS 認定されていないカードの場合、データが破損する可能性があるので、バックアップは必須です😊
USB Image Tool - USB フラッシュ、SD カードのバックアップ/復元

以下の環境でオーバークロックして検証する。
OS: DietPi v7.4.2
Device model: RPi Zero W (armv6l)
Kernel: Linux DietPi-002 5.10.52+ #1441 Tue Aug 3 18:08:18 BST 2021 armv6l GNU/Linux

TOSHIBA EXCERIA 32GB MicroSDHC Class3 UHS-I U3 001

Kingston UHS-II SD Reader USB Device, exFAT
TOSHIBA EXCERIA 32GB MicroSDHC Class3 UHS-I U3 002 King exFAT

------------------------------------------------------------------------------
CrystalDiskMark 7.0.0 x64 (C) 2007-2019 hiyohiyo
                                  Crystal Dew World: https://crystalmark.info/
------------------------------------------------------------------------------
* MB/s = 1,000,000 bytes/s [SATA/600 = 600,000,000 bytes/s]
* KB = 1000 bytes, KiB = 1024 bytes

[Read]
Sequential 1MiB (Q=  8, T= 1):    97.552 MB/s [     93.0 IOPS] < 85037.34 us>
Sequential 1MiB (Q=  1, T= 1):    95.505 MB/s [     91.1 IOPS] < 10957.39 us>
    Random 4KiB (Q= 32, T=16):     8.475 MB/s [   2069.1 IOPS] <128238.92 us>
    Random 4KiB (Q=  1, T= 1):     5.920 MB/s [   1445.3 IOPS] <   690.47 us>

[Write]
Sequential 1MiB (Q=  8, T= 1):    57.942 MB/s [     55.3 IOPS] <142239.11 us>
Sequential 1MiB (Q=  1, T= 1):    59.038 MB/s [     56.3 IOPS] < 17703.84 us>
    Random 4KiB (Q= 32, T=16):     0.258 MB/s [     63.0 IOPS] <645155.98 us>
    Random 4KiB (Q=  1, T= 1):     0.206 MB/s [     50.3 IOPS] < 19796.31 us>

Profile: Default
   Test: 1 GiB (x5) [Interval: 5 sec] <DefaultAffinity=DISABLED>
   Date: 2021/08/08 4:57:13
     OS: Windows 10 Professional [10.0 Build 21322] (x64)
$ sudo apt install python3
$ curl -O https://www.tomoyan.net/_media/hardware/sd_memory_card/read_sd_attr.py
$ chmod +x read_sd_attr.py
$ python3 read_sd_attr.py
===== SD and MMC Block Device Attributes Reader Ver 0.02 =====
device: /sys/block/mmcblk0/device
----------------------------------------
cid: 02544d554330443320e834cba100f2fb\n
csd: 400e00325b590000e8ff7f800a4000af\n
scr: 02b5840332022902\n
date: 02/2015\n
fwrev: 0x0\n
hwrev: 0x2\n
manfid: 0x000002\n
name: UC0D3\n
oemid: 0x544d\n ('TM')
prv: None
serial: 0xe834cba1\n
erase_size: 512\n
preferred_erase_size: 4194304\n
raw_rpmb_size_mult: None
rel_sectors: None
ocr: 0x00200000\n
dsr: 0x404\n
cmdq_en: None
----------------------------------------

SD カードがオーバークロックされていない状態を、Kernel のデバッグ情報で確認する。

$ sudo cat /sys/kernel/debug/mmc0/ios
clock:          50000000 Hz
actual clock:   50000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      2 (4 bits)
timing spec:    2 (sd high-speed)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)

ベンチマークスクリプトをダウンロードする。
sdbench.sh
元になったスクリプトは http://www.nmacleod.com/public/sdbench.sh です。

$ curl -O https://www.tomoyan.net/_media/hardware/raspberry_pi/sdbench.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2922  100  2922    0     0   2690      0  0:00:01  0:00:01 --:--:--  2693
$ curl -O https://raw.githubusercontent.com/geerlingguy/raspberry-pi-dramble/master/setup/benchmarks/microsd-benchmarks.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2247  100  2247    0     0   4642      0 --:--:-- --:--:-- --:--:--  4632

実行可能属性を設定する。

$ chmod +x sdbench.sh
$ chmod +x microsd-benchmarks.sh

ベンチマークを実行する。
※ sdbench.sh は hdparm コマンドを使用するので、予めインストールしておく。(DietPi は標準でインストールされている)$ sudo apt install hdparm

$ sudo ./sdbench.sh
CONFIG:
CLOCK : 50.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads:  66 MB in  3.08 seconds =  21.45 MB/sec
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads:  66 MB in  3.08 seconds =  21.42 MB/sec
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads:  66 MB in  3.08 seconds =  21.42 MB/sec

WRITE:
=====
536870912 bytes (537 MB, 512 MiB) copied, 34.9133 s, 15.4 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 32.3773 s, 16.6 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 40.5927 s, 13.2 MB/s

READ:
====
536870912 bytes (537 MB, 512 MiB) copied, 23.0244 s, 23.3 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 23.0492 s, 23.3 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 22.9968 s, 23.3 MB/s

RESULT (AVG):
============
core_freq   turbo     sd clock       WRITE        READ        HDPARM
   400        0      50.000 MHz   14.36 MB/s   22.24 MB/s   21.43 MB/s

初回実行時は、インストールとビルドが行なわれてからベンチマークが実行される。

$ sudo ./microsd-benchmarks.sh
Raspberry Pi Dramble microSD benchmarks
microSD clock: 50.000 MHz

Installing build tools...
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
以下の追加パッケージがインストールされます:
  binutils binutils-arm-linux-gnueabihf binutils-common cpp cpp-8 dpkg-dev g++ g++-8 gcc gcc-8
  libasan5 libbinutils libc-dev-bin libc6-dev libcc1-0 libdpkg-perl libfl2 libgcc-8-dev libgomp1
  libisl19 libmpc3 libmpfr6 libstdc++-8-dev libubsan1 linux-libc-dev make patch xz-utils
提案パッケージ:
  binutils-doc cpp-doc gcc-8-locales debian-keyring gcc-8-doc libstdc++6-8-dbg gcc-multilib
  manpages-dev autoconf automake libtool flex bison gdb gcc-doc libgcc1-dbg libgomp1-dbg
  libitm1-dbg libatomic1-dbg libasan5-dbg liblsan0-dbg libtsan0-dbg libubsan1-dbg libmpx2-dbg
  libquadmath0-dbg glibc-doc bzr libstdc++-8-doc make-doc ed diffutils-doc
推奨パッケージ:
  fakeroot libalgorithm-merge-perl manpages manpages-dev libfile-fcntllock-perl
以下のパッケージが新たにインストールされます:
  binutils binutils-arm-linux-gnueabihf binutils-common build-essential cpp cpp-8 dpkg-dev g++
  g++-8 gcc gcc-8 libasan5 libbinutils libc-dev-bin libc6-dev libcc1-0 libdpkg-perl libfl2
  libgcc-8-dev libgomp1 libisl19 libmpc3 libmpfr6 libstdc++-8-dev libubsan1 linux-libc-dev make
  patch xz-utils
アップグレード: 0 個、新規インストール: 29 個、削除: 0 個、保留: 5 個。
36.9 MB のアーカイブを取得する必要があります。
この操作後に追加で 138 MB のディスク容量が消費されます。
取得:1 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf xz-utils armhf 5.2.4-1 [179 kB]
取得:2 http://raspbian.raspberrypi.org/raspbian buster/main armhf binutils-common armhf 2.31.1-16+rpi2 [2,075 kB]
取得:3 https://archive.raspberrypi.org/debian buster/main armhf linux-libc-dev armhf 1:1.20210805-1 [1,012 kB]
取得:4 http://raspbian.raspberrypi.org/raspbian buster/main armhf libbinutils armhf 2.31.1-16+rpi2 [302 kB]
取得:5 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libfl2 armhf 2.6.4-6.2 [103 kB]
取得:6 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf binutils-arm-linux-gnueabihf armhf 2.31.1-16+rpi2 [1,814 kB]
取得:7 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf binutils armhf 2.31.1-16+rpi2 [57.0 kB]
取得:8 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libc-dev-bin armhf 2.28-10+rpi1 [266 kB]
取得:9 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libc6-dev armhf 2.28-10+rpi1 [2,113 kB]
取得:10 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libisl19 armhf 0.20-2 [439 kB]
取得:11 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libmpfr6 armhf 4.0.2-1 [723 kB]
取得:12 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libmpc3 armhf 1.1.0-1 [32.1 kB]
取得:13 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf cpp-8 armhf 8.3.0-6+rpi1 [6,787 kB]
取得:14 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf cpp armhf 4:8.3.0-1+rpi2 [19.6 kB]
取得:15 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libcc1-0 armhf 8.3.0-6+rpi1 [37.9 kB]
取得:16 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libgomp1 armhf 8.3.0-6+rpi1 [64.3 kB]
取得:17 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libasan5 armhf 8.3.0-6+rpi1 [317 kB]
取得:18 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libubsan1 armhf 8.3.0-6+rpi1 [103 kB]
取得:19 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libgcc-8-dev armhf 8.3.0-6+rpi1 [595 kB]
取得:24 http://raspbian.raspberrypi.org/raspbian buster/main armhf g++ armhf 4:8.3.0-1+rpi2 [1,632 B]
取得:20 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf gcc-8 armhf 8.3.0-6+rpi1 [7,223 kB]
取得:21 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf gcc armhf 4:8.3.0-1+rpi2 [5,200 B]
取得:22 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libstdc++-8-dev armhf 8.3.0-6+rpi1 [1,545 kB]
取得:23 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf g++-8 armhf 8.3.0-6+rpi1 [7,464 kB]
取得:25 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf make armhf 4.2.1-1.2 [321 kB]
取得:26 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libdpkg-perl all 1.19.7 [1,414 kB]
取得:27 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf patch armhf 2.7.6-3+deb10u1 [115 kB]
取得:28 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf dpkg-dev all 1.19.7 [1,773 kB]
取得:29 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf build-essential armhf 12.6 [7,568 B]
36.9 MB を 44秒 で取得しました (834 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
以前に未選択のパッケージ xz-utils を選択しています。
(データベースを読み込んでいます ... 現在 26423 個のファイルとディレクトリがインストールされています
。)
.../00-xz-utils_5.2.4-1_armhf.deb を展開する準備をしています ...
xz-utils (5.2.4-1) を展開しています...
以前に未選択のパッケージ binutils-common:armhf を選択しています。
.../01-binutils-common_2.31.1-16+rpi2_armhf.deb を展開する準備をしています ...
binutils-common:armhf (2.31.1-16+rpi2) を展開しています...
以前に未選択のパッケージ libbinutils:armhf を選択しています。
.../02-libbinutils_2.31.1-16+rpi2_armhf.deb を展開する準備をしています ...
libbinutils:armhf (2.31.1-16+rpi2) を展開しています...
以前に未選択のパッケージ libfl2:armhf を選択しています。
.../03-libfl2_2.6.4-6.2_armhf.deb を展開する準備をしています ...
libfl2:armhf (2.6.4-6.2) を展開しています...
以前に未選択のパッケージ binutils-arm-linux-gnueabihf を選択しています。
.../04-binutils-arm-linux-gnueabihf_2.31.1-16+rpi2_armhf.deb を展開する準備をしています ...
binutils-arm-linux-gnueabihf (2.31.1-16+rpi2) を展開しています...
以前に未選択のパッケージ binutils を選択しています。
.../05-binutils_2.31.1-16+rpi2_armhf.deb を展開する準備をしています ...
binutils (2.31.1-16+rpi2) を展開しています...
以前に未選択のパッケージ libc-dev-bin を選択しています。
.../06-libc-dev-bin_2.28-10+rpi1_armhf.deb を展開する準備をしています ...
libc-dev-bin (2.28-10+rpi1) を展開しています...
以前に未選択のパッケージ linux-libc-dev:armhf を選択しています。
.../07-linux-libc-dev_1%3a1.20210805-1_armhf.deb を展開する準備をしています ...
linux-libc-dev:armhf (1:1.20210805-1) を展開しています...
以前に未選択のパッケージ libc6-dev:armhf を選択しています。
.../08-libc6-dev_2.28-10+rpi1_armhf.deb を展開する準備をしています ...
libc6-dev:armhf (2.28-10+rpi1) を展開しています...
以前に未選択のパッケージ libisl19:armhf を選択しています。
.../09-libisl19_0.20-2_armhf.deb を展開する準備をしています ...
libisl19:armhf (0.20-2) を展開しています...
以前に未選択のパッケージ libmpfr6:armhf を選択しています。
.../10-libmpfr6_4.0.2-1_armhf.deb を展開する準備をしています ...
libmpfr6:armhf (4.0.2-1) を展開しています...
以前に未選択のパッケージ libmpc3:armhf を選択しています。
.../11-libmpc3_1.1.0-1_armhf.deb を展開する準備をしています ...
libmpc3:armhf (1.1.0-1) を展開しています...
以前に未選択のパッケージ cpp-8 を選択しています。
.../12-cpp-8_8.3.0-6+rpi1_armhf.deb を展開する準備をしています ...
cpp-8 (8.3.0-6+rpi1) を展開しています...
以前に未選択のパッケージ cpp を選択しています。
.../13-cpp_4%3a8.3.0-1+rpi2_armhf.deb を展開する準備をしています ...
cpp (4:8.3.0-1+rpi2) を展開しています...
以前に未選択のパッケージ libcc1-0:armhf を選択しています。
.../14-libcc1-0_8.3.0-6+rpi1_armhf.deb を展開する準備をしています ...
libcc1-0:armhf (8.3.0-6+rpi1) を展開しています...
以前に未選択のパッケージ libgomp1:armhf を選択しています。
.../15-libgomp1_8.3.0-6+rpi1_armhf.deb を展開する準備をしています ...
libgomp1:armhf (8.3.0-6+rpi1) を展開しています...
以前に未選択のパッケージ libasan5:armhf を選択しています。
.../16-libasan5_8.3.0-6+rpi1_armhf.deb を展開する準備をしています ...
libasan5:armhf (8.3.0-6+rpi1) を展開しています...
以前に未選択のパッケージ libubsan1:armhf を選択しています。
.../17-libubsan1_8.3.0-6+rpi1_armhf.deb を展開する準備をしています ...
libubsan1:armhf (8.3.0-6+rpi1) を展開しています...
以前に未選択のパッケージ libgcc-8-dev:armhf を選択しています。
.../18-libgcc-8-dev_8.3.0-6+rpi1_armhf.deb を展開する準備をしています ...
libgcc-8-dev:armhf (8.3.0-6+rpi1) を展開しています...
以前に未選択のパッケージ gcc-8 を選択しています。
.../19-gcc-8_8.3.0-6+rpi1_armhf.deb を展開する準備をしています ...
gcc-8 (8.3.0-6+rpi1) を展開しています...
以前に未選択のパッケージ gcc を選択しています。
.../20-gcc_4%3a8.3.0-1+rpi2_armhf.deb を展開する準備をしています ...
gcc (4:8.3.0-1+rpi2) を展開しています...
以前に未選択のパッケージ libstdc++-8-dev:armhf を選択しています。
.../21-libstdc++-8-dev_8.3.0-6+rpi1_armhf.deb を展開する準備をしています ...
libstdc++-8-dev:armhf (8.3.0-6+rpi1) を展開しています...
以前に未選択のパッケージ g++-8 を選択しています。
.../22-g++-8_8.3.0-6+rpi1_armhf.deb を展開する準備をしています ...
g++-8 (8.3.0-6+rpi1) を展開しています...
以前に未選択のパッケージ g++ を選択しています。
.../23-g++_4%3a8.3.0-1+rpi2_armhf.deb を展開する準備をしています ...
g++ (4:8.3.0-1+rpi2) を展開しています...
以前に未選択のパッケージ make を選択しています。
.../24-make_4.2.1-1.2_armhf.deb を展開する準備をしています ...
make (4.2.1-1.2) を展開しています...
以前に未選択のパッケージ libdpkg-perl を選択しています。
.../25-libdpkg-perl_1.19.7_all.deb を展開する準備をしています ...
libdpkg-perl (1.19.7) を展開しています...
以前に未選択のパッケージ patch を選択しています。
.../26-patch_2.7.6-3+deb10u1_armhf.deb を展開する準備をしています ...
patch (2.7.6-3+deb10u1) を展開しています...
以前に未選択のパッケージ dpkg-dev を選択しています。
.../27-dpkg-dev_1.19.7_all.deb を展開する準備をしています ...
dpkg-dev (1.19.7) を展開しています...
以前に未選択のパッケージ build-essential を選択しています。
.../28-build-essential_12.6_armhf.deb を展開する準備をしています ...
build-essential (12.6) を展開しています...
binutils-common:armhf (2.31.1-16+rpi2) を設定しています ...
linux-libc-dev:armhf (1:1.20210805-1) を設定しています ...
libgomp1:armhf (8.3.0-6+rpi1) を設定しています ...
libasan5:armhf (8.3.0-6+rpi1) を設定しています ...
make (4.2.1-1.2) を設定しています ...
libmpfr6:armhf (4.0.2-1) を設定しています ...
xz-utils (5.2.4-1) を設定しています ...
update-alternatives: /usr/bin/lzma (lzma) を提供するために自動モードで /usr/bin/xz を使います
libmpc3:armhf (1.1.0-1) を設定しています ...
patch (2.7.6-3+deb10u1) を設定しています ...
libfl2:armhf (2.6.4-6.2) を設定しています ...
libdpkg-perl (1.19.7) を設定しています ...
libubsan1:armhf (8.3.0-6+rpi1) を設定しています ...
libisl19:armhf (0.20-2) を設定しています ...
libbinutils:armhf (2.31.1-16+rpi2) を設定しています ...
cpp-8 (8.3.0-6+rpi1) を設定しています ...
libc-dev-bin (2.28-10+rpi1) を設定しています ...
binutils-arm-linux-gnueabihf (2.31.1-16+rpi2) を設定しています ...
libcc1-0:armhf (8.3.0-6+rpi1) を設定しています ...
binutils (2.31.1-16+rpi2) を設定しています ...
dpkg-dev (1.19.7) を設定しています ...
libgcc-8-dev:armhf (8.3.0-6+rpi1) を設定しています ...
cpp (4:8.3.0-1+rpi2) を設定しています ...
libc6-dev:armhf (2.28-10+rpi1) を設定しています ...
libstdc++-8-dev:armhf (8.3.0-6+rpi1) を設定しています ...
gcc-8 (8.3.0-6+rpi1) を設定しています ...
gcc (4:8.3.0-1+rpi2) を設定しています ...
g++-8 (8.3.0-6+rpi1) を設定しています ...
g++ (4:8.3.0-1+rpi2) を設定しています ...
update-alternatives: /usr/bin/c++ (c++) を提供するために自動モードで /usr/bin/g++ を使います
build-essential (12.6) を設定しています ...
libc-bin (2.28-10+rpi1) のトリガを処理しています ...
Install complete!

Installing iozone...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 4040k  100 4040k    0     0   370k      0  0:00:10  0:00:10 --:--:--  516k

Building iozone for Linux-arm


Building fileop for Linux-arm


Building the pit_server

Install complete!

Running hdparm test...

/dev/mmcblk0:
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing buffered disk reads:  68 MB in  3.06 seconds =  22.21 MB/sec

Running dd test...

51200+0 レコード入力
51200+0 レコード出力
419430400 bytes (419 MB, 400 MiB) copied, 28.0597 s, 14.9 MB/s

Running iozone test...
        Iozone: Performance Test of File I/O
                Version $Revision: 3.488 $
                Compiled for 32 bit mode.
                Build: linux-arm

        Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
                     Al Slater, Scott Rhine, Mike Wisner, Ken Goss
                     Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
                     Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
                     Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
                     Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,
                     Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer,
                     Vangel Bojaxhi, Ben England, Vikentsi Lapa,
                     Alexey Skidanov, Sudhir Kumar.

        Run began: Wed Aug 11 14:05:56 2021

        Include fsync in write timing
        O_DIRECT feature enabled
        Auto Mode
        File size set to 102400 kB
        Record Size 4 kB
        Command line used: ./iozone -e -I -a -s 100M -r 4k -i 0 -i 1 -i 2
        Output is in kBytes/sec
        Time Resolution = 0.000001 seconds.
        Processor cache size set to 1024 kBytes.
        Processor cache line size set to 32 bytes.
        File stride size set to 17 * record size.
                                                              random    random     bkwd    record    stride
              kB  reclen    write  rewrite    read    reread    read     write     read   rewrite      read   fwrite frewrite    fread  freread
          102400       4      850      858     6349     6353     6269      284


iozone test complete.

microSD card benchmark complete!
Raspberry Pi Dramble microSD benchmarks
microSD clock: 50.000 MHz

Running hdparm test...

/dev/mmcblk0:
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing buffered disk reads:  68 MB in  3.06 seconds =  22.21 MB/sec

Running dd test...

51200+0 レコード入力
51200+0 レコード出力
419430400 bytes (419 MB, 400 MiB) copied, 28.0597 s, 14.9 MB/s

Running iozone test...
        Iozone: Performance Test of File I/O
                Version $Revision: 3.488 $
                Compiled for 32 bit mode.
                Build: linux-arm

        Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
                     Al Slater, Scott Rhine, Mike Wisner, Ken Goss
                     Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
                     Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
                     Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
                     Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,
                     Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer,
                     Vangel Bojaxhi, Ben England, Vikentsi Lapa,
                     Alexey Skidanov, Sudhir Kumar.

        Run began: Wed Aug 11 14:05:56 2021

        Include fsync in write timing
        O_DIRECT feature enabled
        Auto Mode
        File size set to 102400 kB
        Record Size 4 kB
        Command line used: ./iozone -e -I -a -s 100M -r 4k -i 0 -i 1 -i 2
        Output is in kBytes/sec
        Time Resolution = 0.000001 seconds.
        Processor cache size set to 1024 kBytes.
        Processor cache line size set to 32 bytes.
        File stride size set to 17 * record size.
                                                              random    random     bkwd    record    stride
              kB  reclen    write  rewrite    read    reread    read     write     read   rewrite      read   fwrite frewrite    fread  freread
          102400       4      850      858     6349     6353     6269      284


iozone test complete.

microSD card benchmark complete!

管理者で config.txt に SD カードのオーバークロック設定を行って再起動する😍

$ sudo bash -c 'printf "dtparam=sd_overclock=100\n" >> /boot/config.txt'
$ sudo bash -c 'printf "force_turbo=1\n" >> /boot/config.txt'
$ sudo reboot

dtoverlay=sdhost,overclock_50=100 で sdhost オーバーレイにオーバークロックを指示すると Wi-Fi 接続不能になるなど問題が発生した。dtparam=sd_overclock=100 で指示すれば問題は発生しない。
参考: SD-Card-Overclock - Raspberry Pi Forums

再起動したら dmesg で設定が有効になっていることを確認する🤔

$ dmesg | grep mmc0
[    2.735457] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    2.911272] mmc0: host does not support reading read-only switch, assuming write-enable
[    2.913917] mmc0: overclocking to 100000000Hz
[    2.914133] mmc0: new high speed SDHC card at address e5ea
[    2.915520] mmcblk0: mmc0:e5ea UC0D3 29.1 GiB

mmc0: overclocking to 100000000Hz が dmesg に記録されていれば設定が適用されている。

カーネルのデバッグ情報でも確認できる😎

$ sudo cat /sys/kernel/debug/mmc0/ios
clock:          50000000 Hz
actual clock:   100000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      2 (4 bits)
timing spec:    2 (sd high-speed)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)

オーバークロックが有効な状態で再度ベンチマークを実行して性能を評価する🤔

$ sudo ./sdbench.sh
CONFIG: dtparam=sd_overclock=100
CLOCK : 100.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads: 122 MB in  3.05 seconds =  40.00 MB/sec
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads: 120 MB in  3.00 seconds =  39.98 MB/sec
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads: 120 MB in  3.00 seconds =  39.95 MB/sec

WRITE:
=====
536870912 bytes (537 MB, 512 MiB) copied, 31.0221 s, 17.3 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 29.8331 s, 18.0 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 32.5621 s, 16.5 MB/s

READ:
====
536870912 bytes (537 MB, 512 MiB) copied, 11.9419 s, 45.0 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 11.8501 s, 45.3 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 11.8313 s, 45.4 MB/s

RESULT (AVG):
============
core_freq   turbo     sd clock       WRITE        READ        HDPARM
   400        0     100.000 MHz   16.46 MB/s   43.12 MB/s   40.00 MB/s
$ sudo ./microsd-benchmarks.sh
Raspberry Pi Dramble microSD benchmarks
microSD clock: 100.000 MHz

Running hdparm test...

/dev/mmcblk0:
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing buffered disk reads: 124 MB in  3.01 seconds =  41.20 MB/sec

Running dd test...

51200+0 レコード入力
51200+0 レコード出力
419430400 bytes (419 MB, 400 MiB) copied, 29.1576 s, 14.4 MB/s

Running iozone test...
        Iozone: Performance Test of File I/O
                Version $Revision: 3.488 $
                Compiled for 32 bit mode.
                Build: linux-arm

        Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
                     Al Slater, Scott Rhine, Mike Wisner, Ken Goss
                     Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
                     Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
                     Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
                     Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,
                     Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer,
                     Vangel Bojaxhi, Ben England, Vikentsi Lapa,
                     Alexey Skidanov, Sudhir Kumar.

        Run began: Wed Aug 11 15:50:18 2021

        Include fsync in write timing
        O_DIRECT feature enabled
        Auto Mode
        File size set to 102400 kB
        Record Size 4 kB
        Command line used: ./iozone -e -I -a -s 100M -r 4k -i 0 -i 1 -i 2
        Output is in kBytes/sec
        Time Resolution = 0.000001 seconds.
        Processor cache size set to 1024 kBytes.
        Processor cache line size set to 32 bytes.
        File stride size set to 17 * record size.
                                                              random    random     bkwd    record    stride
              kB  reclen    write  rewrite    read    reread    read     write     read   rewrite      read   fwrite frewrite    fread  freread
          102400       4      834      852     6902     6908     6779      286


iozone test complete.

microSD card benchmark complete!
$ sudo ./sdbench.sh
CONFIG: dtparam=sd_overclock=133
CLOCK : 125.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads: 120 MB in  3.01 seconds =  39.85 MB/sec
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads: 120 MB in  3.02 seconds =  39.74 MB/sec
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads: 120 MB in  3.02 seconds =  39.72 MB/sec

WRITE:
=====
dd: error writing '/root/test.dat': Read-only file system
407023616 bytes (407 MB, 388 MiB) copied, 21.0707 s, 19.3 MB/s
./sdbench.sh: line 23: /usr/bin/rm: Input/output error

./sdbench.sh: line 23: /usr/bin/rm: Input/output error


READ:
====
./sdbench.sh: line 23: /usr/bin/sync: Input/output error
./sdbench.sh: line 24: awk: command not found
./sdbench.sh: line 25: awk: command not found
./sdbench.sh: line 29: awk: command not found

./sdbench.sh: error reading input file: Input/output error
バスエラー

TeamGroup 128GB MicroSDXC Class3 UHS-I U3 V30 A1 001

$ python3 read_sd_attr.py
===== SD and MMC Block Device Attributes Reader Ver 0.02 =====
device: /sys/block/mmcblk0/device
----------------------------------------
cid: 452d4220202020201014a11ed90149a9\n
csd: 400e00325b590003ae077f800a400001\n
scr: 0245844300000000\n
date: 09/2020\n
fwrev: 0x0\n
hwrev: 0x1\n
manfid: 0x000045\n
name:      \n
oemid: 0x2d42\n ('-B')
prv: None
serial: 0x14a11ed9\n
erase_size: 512\n
preferred_erase_size: 4194304\n
raw_rpmb_size_mult: None
rel_sectors: None
ocr: 0x00200000\n
dsr: 0x404\n
cmdq_en: None
----------------------------------------
$ sudo cat /sys/kernel/debug/mmc0/ios
clock:          50000000 Hz
actual clock:   50000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      2 (4 bits)
timing spec:    2 (sd high-speed)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)

ベンチマークを実行する🤔

$ sudo ./sdbench.sh
CONFIG:
CLOCK : 50.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads:  64 MB in  3.03 seconds =  21.12 MB/sec
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads:  64 MB in  3.03 seconds =  21.11 MB/sec
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads:  64 MB in  3.04 seconds =  21.08 MB/sec

WRITE:
=====
536870912 bytes (537 MB, 512 MiB) copied, 46.0372 s, 11.7 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 43.9316 s, 12.2 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 42.6504 s, 12.6 MB/s

READ:
====
536870912 bytes (537 MB, 512 MiB) copied, 23.0346 s, 23.3 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 23.0235 s, 23.3 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 23.0885 s, 23.3 MB/s

RESULT (AVG):
============
core_freq   turbo     sd clock       WRITE        READ        HDPARM
   400        0      50.000 MHz   11.59 MB/s   22.22 MB/s   21.10 MB/s
$ sudo ./microsd-benchmarks.sh
Raspberry Pi Dramble microSD benchmarks
microSD clock: 50.000 MHz

Running hdparm test...

/dev/mmcblk0:
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing buffered disk reads:  68 MB in  3.06 seconds =  22.21 MB/sec

Running dd test...

51200+0 レコード入力
51200+0 レコード出力
419430400 bytes (419 MB, 400 MiB) copied, 34.5449 s, 12.1 MB/s

Running iozone test...
        Iozone: Performance Test of File I/O
                Version $Revision: 3.488 $
                Compiled for 32 bit mode.
                Build: linux-arm

        Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
                     Al Slater, Scott Rhine, Mike Wisner, Ken Goss
                     Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
                     Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
                     Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
                     Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,
                     Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer,
                     Vangel Bojaxhi, Ben England, Vikentsi Lapa,
                     Alexey Skidanov, Sudhir Kumar.

        Run began: Thu Aug 12 11:37:18 2021

        Include fsync in write timing
        O_DIRECT feature enabled
        Auto Mode
        File size set to 102400 kB
        Record Size 4 kB
        Command line used: ./iozone -e -I -a -s 100M -r 4k -i 0 -i 1 -i 2
        Output is in kBytes/sec
        Time Resolution = 0.000001 seconds.
        Processor cache size set to 1024 kBytes.
        Processor cache line size set to 32 bytes.
        File stride size set to 17 * record size.
                                                              random    random     bkwd    record    stride
              kB  reclen    write  rewrite    read    reread    read     write     read   rewrite      read   fwrite frewrite    fread  freread
          102400       4     2337     2485     5426     5423     4706     2509


iozone test complete.

microSD card benchmark complete!

管理者で config.txt に SD カードのオーバークロック設定を行って再起動する😍

$ sudo bash -c 'printf "dtparam=sd_overclock=100\n" >> /boot/config.txt'
$ sudo bash -c 'printf "force_turbo=1\n" >> /boot/config.txt'
$ sudo reboot

オーバークロックが有効な状態で再度ベンチマークを実行して性能を評価する🤔

$ sudo ./sdbench.sh
CONFIG: dtparam=sd_overclock=100
CLOCK : 80.000 MHz
CORE  : 400 MHz, turbo=1
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads: 102 MB in  3.05 seconds =  33.44 MB/sec
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads: 102 MB in  3.05 seconds =  33.40 MB/sec
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing O_DIRECT disk reads: 102 MB in  3.06 seconds =  33.36 MB/sec

WRITE:
=====
536870912 bytes (537 MB, 512 MiB) copied, 38.5818 s, 13.9 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 36.6868 s, 14.6 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 37.4891 s, 14.3 MB/s

READ:
====
536870912 bytes (537 MB, 512 MiB) copied, 14.7304 s, 36.4 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 14.761 s, 36.4 MB/s
536870912 bytes (537 MB, 512 MiB) copied, 14.7272 s, 36.5 MB/s

RESULT (AVG):
============
core_freq   turbo     sd clock       WRITE        READ        HDPARM
   400        1      80.000 MHz   13.63 MB/s   34.74 MB/s   33.40 MB/s
$ sudo ./microsd-benchmarks.sh
Raspberry Pi Dramble microSD benchmarks
microSD clock: 80.000 MHz

Running hdparm test...

/dev/mmcblk0:
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing buffered disk reads: 106 MB in  3.05 seconds =  34.74 MB/sec

Running dd test...

51200+0 レコード入力
51200+0 レコード出力
419430400 bytes (419 MB, 400 MiB) copied, 29.9646 s, 14.0 MB/s

Running iozone test...
        Iozone: Performance Test of File I/O
                Version $Revision: 3.488 $
                Compiled for 32 bit mode.
                Build: linux-arm

        Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
                     Al Slater, Scott Rhine, Mike Wisner, Ken Goss
                     Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
                     Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
                     Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
                     Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,
                     Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer,
                     Vangel Bojaxhi, Ben England, Vikentsi Lapa,
                     Alexey Skidanov, Sudhir Kumar.

        Run began: Thu Aug 12 11:55:28 2021

        Include fsync in write timing
        O_DIRECT feature enabled
        Auto Mode
        File size set to 102400 kB
        Record Size 4 kB
        Command line used: ./iozone -e -I -a -s 100M -r 4k -i 0 -i 1 -i 2
        Output is in kBytes/sec
        Time Resolution = 0.000001 seconds.
        Processor cache size set to 1024 kBytes.
        Processor cache line size set to 32 bytes.
        File stride size set to 17 * record size.
                                                              random    random     bkwd    record    stride
              kB  reclen    write  rewrite    read    reread    read     write     read   rewrite      read   fwrite frewrite    fread  freread
          102400       4     2408     2748     6110     6105     5177     2729


iozone test complete.

microSD card benchmark complete!
  • hardware/raspberry_pi/sdcard_overclock.1628737221.txt.gz
  • 最終更新: 2021/08/12 12:00
  • by ともやん