ทดสอบความเร็วของฮาร์ดดิสก์ (Harddisk) ด้วยคำสั่ง dd บน Linux
2 min readSep 12, 2019
มีการนำเอาตัว SIMATIC IOT2040 ของ SIEMENS มาใช้งาน โดยมี microSD Card มำหน้าที่เป็นฮาร์ดดิสก์ ของตัว SIMATIC IOT2040
microSD ที่ใช้เป็นของ SanDisk 16GB C10 ความเร็วที่บอกหน้ากล่อง speed up to 80 MB/s*** 533X
ทดสอบความเร็วการเขียนข้อมูลด้วยคำสั่ง
dd if=/dev/zero of=./test bs=2048k count=2048 oflag=direct
ทดสอบความเร้วการอ่านข้อมูลด้วยคำสั่ง
dd if=./test of=/dev/zero bs=2048k count=2048
จะทำการทดสอบเขียนและอ่านข้อมูุลที่ขนาดไฟล์แตกต่างกัน มีขนาดดังนี้ 2048k, 512k, 128k, 32k, 8k, 1k ทุดขนาดอ่านและเขียนข้อมูล 2048 รอบ ได้ผลการทดสอบดังนี้
ผลการทดสอบการเขียนข้อมูล
root@iot2000:~# dd if=/dev/zero of=./test bs=2048k count=2048 oflag=direct
2048+0 records in
2048+0 records out
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 393.483 s, 10.9 MB/s
root@iot2000:~# dd if=/dev/zero of=./test bs=512k count=2048 oflag=direct
2048+0 records in
2048+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 95.629 s, 11.2 MB/s
root@iot2000:~# dd if=/dev/zero of=./test bs=128k count=2048 oflag=direct
2048+0 records in
2048+0 records out
268435456 bytes (268 MB, 256 MiB) copied, 28.8343 s, 9.3 MB/s
root@iot2000:~# dd if=/dev/zero of=./test bs=32k count=2048 oflag=direct
2048+0 records in
2048+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 10.2787 s, 6.5 MB/s
root@iot2000:~# dd if=/dev/zero of=./test bs=8k count=2048 oflag=direct
2048+0 records in
2048+0 records out
16777216 bytes (17 MB, 16 MiB) copied, 5.8351 s, 2.9 MB/s
root@iot2000:~# dd if=/dev/zero of=./test bs=1k count=2048 oflag=direct
2048+0 records in
2048+0 records out
2097152 bytes (2.1 MB, 2.0 MiB) copied, 4.64093 s, 452 kB/s
root@iot2000:~#
ผลการทดสอบการอ่านข้อมูล
root@iot2000:~# dd if=./test of=/dev/zero bs=2048k count=2048
2048+0 records in
2048+0 records out
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 194.259 s, 22.1 MB/s
root@iot2000:~# dd if=./test of=/dev/zero bs=512k count=2048
2048+0 records in
2048+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 48.6626 s, 22.1 MB/s
root@iot2000:~# dd if=./test of=/dev/zero bs=128k count=2048
2048+0 records in
2048+0 records out
268435456 bytes (268 MB, 256 MiB) copied, 12.156 s, 22.1 MB/s
root@iot2000:~# dd if=./test of=/dev/zero bs=32k count=2048
2048+0 records in
2048+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 1.04999 s, 63.9 MB/s
root@iot2000:~# dd if=./test of=/dev/zero bs=8k count=2048
2048+0 records in
2048+0 records out
16777216 bytes (17 MB, 16 MiB) copied, 0.24692 s, 67.9 MB/s
root@iot2000:~# dd if=./test of=/dev/zero bs=1k count=2048
2048+0 records in
2048+0 records out
2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.0624776 s, 33.6 MB/s
สรุปการทดสอบ
- การเขียน จะทำความเร็วได้สูงสุดประมาณ 11MB/s
- การอ่าน จะทำความเร็วได้สูงสุดประมาณ 60MB/s ในไฟล์ขนาดกลาง และ 22MB/s ในไฟล์ขนาดใหญ่
วันหน้าจะทดสอบในตัว raspberry pi เพื่อดูความแตกต่าง