Write speed:
TIME dd If =/dev/Zero of = test. dbf bs = 8 k count = 300000
Among them,/dev/zero is a pseudo device, which only generates a null compaction stream and does not generate Io for it. Therefore, Io will be concentrated in the of file, and the of file is only used for writing, therefore, this command is equivalent to testing the disk write capability.
The output result is similar (because the test time is generally longer and more accurate, you can set the count to be larger ):
300000 + 0 records in
300000 + 0 records out
Real 0m36. 669 s
User 0m0. 185 s
Sys 0m9. 340 s
Therefore, the write speed is 8*300000/1024/36.669 = 63.916 m/s.
Read speed:
TIME dd If =/dev/sda1 of =/dev/null BS = 8 K
Because/dev/sdb1 is a physical partition, reading it will generate Io,/dev/null is a pseudo device, which is equivalent to a black hole, of this device will not generate Io, so, the IO of this command only occurs on/dev/sdb1, which is equivalent to testing the disk's read capability.
The output result is similar:
448494 + 0 records in
448494 + 0 records out
Real 0m51. 070 s
User 0m0. 054 s
Sys 0m10. 028 s
Therefore, the reading speed on sda1 is 8*448494/1024/51.070 = 68.61 m/s.
In addition, if cygwin is installed in windows, the time and DD commands can also be used, and the output result directly contains the time and speed of Io. If you are interested, you can try it, however, I tested that the read and write speed was only over 40 m per second. I don't know if it was the platform reason. Maybe cygwin's mechanism is different from that in Linux.