time dd if=/dev/zero of=test bs=64k count=512 oflag=dsync
Parameter explanation:
if input file
of output file
bs The number of bytes read and written at one time
count The number of times the data block is written, it can also be set to 512.
oflag=dsync forces writing to the physical hard disk every time, that is, not writing to the cache, but writing directly to the hard disk
After execution, a 32M (64*512) test file will be generated in the current directory.
The solid state drive reaches 70MB/second, and the mechanical hard drive is estimated to be about 2MB/second.
I haven’t found a way to completely close it. The read cache can be temporarily cleared by echo 3 > /proc/sys/vm/drop_caches
crontab
0 */1 * * * root sync && echo 3 > /proc/sys/vm/drop_caches
Add parameters after the dd command. You can Google for details. Or, the test data is twice the memory
hdparm -W
hdparm -t
time dd if=/dev/zero of=test bs=64k count=512 oflag=dsync
Parameter explanation:
if input file
of output file
bs The number of bytes read and written at one time
count The number of times the data block is written, it can also be set to 512.
oflag=dsync forces writing to the physical hard disk every time, that is, not writing to the cache, but writing directly to the hard disk
After execution, a 32M (64*512) test file will be generated in the current directory.
The solid state drive reaches 70MB/second, and the mechanical hard drive is estimated to be about 2MB/second.