Linux 测试磁盘性能

简介:

 目前的机械磁盘运作方式,主要体现在磁盘读写寻找磁道的过程,磁盘缓存功能对于读写速度是很重要的。磁盘的寻道过程是机械方式,这样就决定其随机速度明显低于顺序读写,一般普通的磁盘的IO可以达到每秒 40--60MB,稍微好一点的话是每秒100MB左右,在多进程或多线程并发读取磁盘的情况下随着并发数的增加,磁盘的IO效率会打打下降。

    在 Linux下我们可以用dd命令对磁盘读写速度进行测试。

    用time进行计时。dd 用于复制, 从if 读出,写到of, 如果 if=/dev/zero 这样就不会产生IO,可以用来测试只写的速度,如果of=/dev/null 这样也不会产生IO,可以用来测试只读的速度。

    bs 表示每次读或写的单位大小。 count读写块的数目

    测试只写的速度:

    # time dd if=/dev/zero of=/mpc bs=8K count=1000
    1000+0 records in
    1000+0 records out
    8192000 bytes (8.2 MB) copied, 0.0109971 s, 745 MB/s

    real    0m0.031s
    user    0m0.000s
    sys     0m0.010s

     测试只读的情况:

     # time dd if=/mpc of=/dev/null bs=8K
     1000+0 records in
     1000+0 records out
     8192000 bytes (8.2 MB) copied, 0.0028807 s, 2.8 GB/s

     real    0m0.005s
     user    0m0.000s
     sys     0m0.000s

     测试读写的情况:

     # time dd if=/mpc of=/mpc2 bs=20K
     400+0 records in
     400+0 records out
     8192000 bytes (8.2 MB) copied, 0.0114427 s, 716 MB/s
     real    0m0.015s
     user    0m0.000s
     sys     0m0.010s    

    ps:测试的数据量越大,越准确。

 

 






本文转自 位鹏飞 51CTO博客,原文链接:http://blog.51cto.com/weipengfei/978801,如需转载请自行联系原作者

目录
相关文章
|
24天前
|
Linux Shell C语言
【Shell 命令集合 磁盘维护 】Linux 分区管理的工具 sfdisk命令使用教程
【Shell 命令集合 磁盘维护 】Linux 分区管理的工具 sfdisk命令使用教程
29 1
|
24天前
|
存储 Shell Linux
【Shell 命令集合 磁盘维护 】Linux 管理硬盘分区 mpartition命令使用教程
【Shell 命令集合 磁盘维护 】Linux 管理硬盘分区 mpartition命令使用教程
35 1
|
24天前
|
存储 Shell Linux
【Shell 命令集合 磁盘维护 】Linux mkfs.ext2 命令使用教程
【Shell 命令集合 磁盘维护 】Linux mkfs.ext2 命令使用教程
36 1
|
24天前
|
存储 Shell Linux
【Shell 命令集合 磁盘维护 】Linux 创建DOS文件系统 mkdosfs命令使用指南
【Shell 命令集合 磁盘维护 】Linux 创建DOS文件系统 mkdosfs命令使用指南
31 2
|
24天前
|
存储 算法 Shell
【Shell 命令集合 磁盘维护 】Linux 创建启动磁盘 mkbootdisk命令使用教程
【Shell 命令集合 磁盘维护 】Linux 创建启动磁盘 mkbootdisk命令使用教程
27 1
|
25天前
|
存储 安全 Shell
【Shell 命令集合 磁盘维护 】Linux mformat 命令使用教程
【Shell 命令集合 磁盘维护 】Linux mformat 命令使用教程
28 0
|
24天前
|
Shell Linux API
【Shell 命令集合 磁盘维护 】Linux 查找指定目录下的所有符号链接文件 symlinks 命令使用教程
【Shell 命令集合 磁盘维护 】Linux 查找指定目录下的所有符号链接文件 symlinks 命令使用教程
31 1
|
24天前
|
Shell Linux C语言
【Shell 命令集合 磁盘维护 】Linux 创建一个初始化内存盘 mkinitrd命令使用教程
【Shell 命令集合 磁盘维护 】Linux 创建一个初始化内存盘 mkinitrd命令使用教程
32 0
|
24天前
|
存储 Shell Linux
【Shell 命令集合 磁盘维护 】Linux 创建Minix文件系统 mkfs.minix 命令使用教程
【Shell 命令集合 磁盘维护 】Linux 创建Minix文件系统 mkfs.minix 命令使用教程
33 0
|
24天前
|
存储 Shell Linux
【Shell 命令集合 磁盘维护 】Linux 建立ext2文件系统 mke2fs命令使用教程
【Shell 命令集合 磁盘维护 】Linux 建立ext2文件系统 mke2fs命令使用教程
30 2