Linux 硬碟簡單的測速

# hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   29992 MB in  1.99 seconds = 15061.91 MB/sec
 Timing buffered disk reads:  438 MB in  3.01 seconds = 145.69 MB/sec

這個是 SAS 15K 的速度

# hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   20900 MB in  2.00 seconds = 10464.95 MB/sec
 Timing buffered disk reads:  896 MB in  3.00 seconds = 298.28 MB/sec

這個是 SAS 15K 兩顆做 RAID 0 的速度

# hdparm -tT /dev/md127

/dev/md127:
 Timing cached reads:   22506 MB in  2.00 seconds = 11269.49 MB/sec
 Timing buffered disk reads:  718 MB in  3.00 seconds = 239.31 MB/sec

這是 SATA 7.2K 兩顆做 RAID 0 的速度

# hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   9284 MB in  2.00 seconds = 4647.05 MB/sec
 Timing buffered disk reads:  476 MB in  3.01 seconds = 158.34 MB/sec

這是 SATA-3.3 7.2K ( TOSHIBA MG09ACA1 )

# hdparm -Tt --direct /dev/sda

/dev/sda:
 Timing O_DIRECT cached reads:   1010 MB in  2.00 seconds = 504.67 MB/sec
 Timing O_DIRECT disk reads: 778 MB in  3.00 seconds = 259.25 MB/sec

# hdparm -Tt /dev/sda

/dev/sda:
 Timing cached reads:   21666 MB in  2.00 seconds = 10847.00 MB/sec
 Timing buffered disk reads: 778 MB in  3.01 seconds = 258.74 MB/sec

# dd if=/dev/zero of=test bs=1G count=32 conv=fdatasync oflag=direct
32+0 records in
32+0 records out
34359738368 bytes (34 GB, 32 GiB) copied, 126.451 s, 272 MB/s

這是 SSD 硬碟. 意外發現. 我好像沒有驅動好. T_T

#  hdparm -I /dev/sda | grep SATA
Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5
           *    SATA-I signaling speed (1.5Gb/s)
           *    SATA-II signaling speed (3.0Gb/s)

理論上 SATA II 可以達到 3.0Gb/s 也就是 384 MB/s 怪哉~

# hdparm -tT /dev/sdb

/dev/sdb:
 Timing cached reads:   11688 MB in  2.00 seconds = 5852.55 MB/sec
 Timing buffered disk reads:  1564 MB in  3.00 seconds = 521.01 MB/sec

這是磁碟陣列 XD

# hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   25788 MB in  1.99 seconds = 12943.70 MB/sec
 Timing buffered disk reads:  376 MB in  3.00 seconds = 125.22 MB/sec

這是 NVMe M.2 (WD SN750 SE 1TB M.2 2280 PCIe SSD)

# hdparm -Tt --direct /dev/nvme0n1

/dev/nvme0n1:
 Timing O_DIRECT cached reads:   6414 MB in  2.00 seconds = 3207.40 MB/sec
 Timing O_DIRECT disk reads: 11112 MB in  3.00 seconds = 3703.95 MB/sec

# hdparm -Tt /dev/nvme0n1

/dev/nvme0n1:
 Timing cached reads:   37392 MB in  2.00 seconds = 18724.39 MB/sec
 Timing buffered disk reads: 11276 MB in  3.00 seconds = 3757.17 MB/sec

# dd if=/dev/zero of=test bs=1G count=32 conv=fdatasync oflag=direct
32+0 records in
32+0 records out
34359738368 bytes (34 GB, 32 GiB) copied, 9.7308 s, 3.5 GB/s

# dd if=/dev/zero of=test bs=4MB count=1k conv=fdatasync
1024+0 records in
1024+0 records out
4096000000 bytes (4.1 GB, 3.8 GiB) copied, 1.71345 s, 2.4 GB/s

這是 NVMe (Kingston DC1500M U.2 PCIe NVMe SSD)

# hdparm -Tt --direct /dev/nvme0n1

/dev/nvme0n1:
 Timing O_DIRECT cached reads:   5374 MB in  2.00 seconds = 2687.61 MB/sec
 Timing O_DIRECT disk reads: 7860 MB in  3.00 seconds = 2619.70 MB/sec

# hdparm -Tt /dev/nvme0n1

/dev/nvme0n1:
 Timing cached reads:   21698 MB in  2.00 seconds = 10863.17 MB/sec
 Timing buffered disk reads: 7006 MB in  3.00 seconds = 2334.91 MB/sec

# dd if=/dev/zero of=test bs=1G count=32 conv=fdatasync oflag=direct
32+0 records in
32+0 records out
34359738368 bytes (34 GB, 32 GiB) copied, 22.4043 s, 1.5 GB/s

# dd if=/dev/zero of=test bs=4MB count=1k conv=fdatasync
1024+0 records in
1024+0 records out
4096000000 bytes (4.1 GB, 3.8 GiB) copied, 3.71871 s, 1.1 GB/s

另外一個比較舊的磁碟陣列

# dd if=/dev/zero of=test bs=64k count=64k conv=fdatasync