|
linux如何测SSD速度
在Linux中,可以使用dd命令来测试SSD的读写速度。以下是测试SSD速度的基本命令:
写速度测试:
dd if=/dev/zero of=tempfile bs=1G count=1 oflag=dsync
读速度测试:
dd if=tempfile of=/dev/null bs=1G count=1 iflag=dsync
移除临时文件:
rm tempfile
这些命令的含义如下:
if=/dev/zero 表示输入文件是 /dev/zero,它提供了无限的零字节流。
of=tempfile 表示输出文件是 tempfile,用于写入测试数据。
bs=1G 设置块大小为1GB。
count=1 表示复制1个块,即1GB。
oflag=dsync 确保每次写操作都同步到磁盘。
iflag=dsync 确保每次读操作都从磁盘同步数据。
写速度测试命令创建了一个1GB的文件,并确保每次写入都同步到磁盘,从而提供了SSD的写入速度。读速度测试命令则测试从刚才创建的文件中读取数据的速度。最后,移除临时文件命令用于清理测试过程中创建的临时文件。
提示:AI自动生成,仅供参考
测速结果:(写mmc)
unicoder@rock-5a:/mnt$ sudo dd if=/dev/zero of=tempfile bs=1G count=1 oflag=dsync
输入了 1+0 块记录
输出了 1+0 块记录
1073741824 字节 (1.1 GB, 1.0 GiB) 已复制,19.5804 s,54.8 MB/s
(读mmc)
unicoder@rock-5a:/mnt$ sudo dd if=tempfile of=/dev/null bs=1G count=1 oflag=dsync
输入了 1+0 块记录
输出了 1+0 块记录
1073741824 字节 (1.1 GB, 1.0 GiB) 已复制,1.30319 s,824 MB/s
(写SSD)
输入了 1+0 块记录
输出了 1+0 块记录
1073741824 字节 (1.1 GB, 1.0 GiB) 已复制,6.45849 s,166 MB/s
(读ssd)
输入了 1+0 块记录
输出了 1+0 块记录
1073741824 字节 (1.1 GB, 1.0 GiB) 已复制,0.947989 s,1.1 GB/s
|
|