linux硬盘读写性能测试

1,linux硬盘读写性能测试

apt install hdparm -y
  • 不使用缓存,测试硬盘
# hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads: 676 MB in  3.00 seconds = 225.33 MB/sec
  • 查看硬盘缓存
# hdparm -I /dev/sda | grep buffer
	cache/buffer size  = unknown
  • 查看硬盘写缓存是否打开
# hdparm -W /dev/sda

/dev/sda:
 write-caching =  1 (on)
  • 关闭硬盘写缓存
# hdparm -W  0 /dev/sda
  • 打开硬盘写缓存
# hdparm -W  1 /dev/sda
# hdparm -T /dev/sda

/dev/sda:
 Timing cached reads:   27920 MB in  2.00 seconds = 13976.25 MB/sec
# hdparm -tT --direct /dev/sda

/dev/sda:
 Timing O_DIRECT cached reads:   1014 MB in  2.00 seconds = 506.59 MB/sec
 Timing O_DIRECT disk reads: 748 MB in  3.00 seconds = 248.93 MB/sec
# hdparm -t --direct /dev/sda

/dev/sda:
 Timing O_DIRECT disk reads: 692 MB in  3.01 seconds = 230.10 MB/sec
  • 测试硬盘读取速度
# for i in 1 2 3; do hdparm -t --direct /dev/sdb; done

/dev/sdb:
 Timing O_DIRECT disk reads: 692 MB in  3.00 seconds = 230.37 MB/sec

/dev/sdb:
 Timing O_DIRECT disk reads: 754 MB in  3.01 seconds = 250.80 MB/sec

/dev/sdb:
 Timing O_DIRECT disk reads: 756 MB in  3.00 seconds = 251.88 MB/sec

2,固态硬盘

# hdparm -t /dev/nvme0n1

/dev/nvme0n1:
 Timing buffered disk reads: 9176 MB in  3.00 seconds = 3058.37 MB/sec

参考:

  1. Linux测试硬盘读性能的常用工具-hdparm和dd俩搭档
  2. 打开或关闭硬盘写缓存
©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页