無需安裝 Blackmagic Disk Speed Test 等工具,終端機 dd 指令即可精準測試磁碟順序讀寫速度:
time dd if=/dev/zero bs=1024k of=tstfile count=1024
if=/dev/zero:零字元輸入源。bs=1024k:區塊大小 1MB (1024KB)。of=tstfile:輸出檔案 (當前目錄)。count=1024:寫入 1024 個區塊 = 1GB 資料。time:顯示執行時間統計。1024+0 records in
1024+0 records out
1073741824 bytes transferred in 4.196358 secs (255874697 bytes/sec)
real 0m4.205s
user 0m0.004s
sys 0m0.712s
寫入速度 = bytes/sec ÷ 1024 ÷ 1024 = 244 MB/s (範例為 2011 MacBook Air)。
dd if=tstfile bs=1024k of=/dev/null count=1024
of=/dev/null:丟棄輸出,純測試讀取。
tstfile 會佔用空間,測試後刪除:rm tstfile。fio 或專業工具,dd 僅測順序性能。