How to test the read and write speed of Linux disk

  

In order to test the read and write speed of Linux disk, you can use the dd command, the dd command is a very useful command, can be used for copying files, the following small series will show you how to Use the dd command to test the read and write speed of Linux disks.

1, the first two are familiar with special equipment:

(1) /dev /null: Recycle Bin, bottomless pit.

(2) /dev /zero: Generate characters.

2, test disk write ability

Code is as follows:

time dd if=/dev/zero of=/testw.dbf bs=4k count=100000

Because /dev//zero is a pseudo device, it only produces a null character stream, it does not generate IO for it, so IO will be concentrated in the file, of file is only used for writing, so this command is equivalent Test the write capabilities of the disk. Adding flag=direct at the end of the command will skip the memory cache, and adding oflag=sync will skip the hdd cache.

3, test disk read ability

Code is as follows:

time dd if=/dev/sdb of=/dev/null bs=4k

Because /dev/sdb is a physical partition, reading it will generate IO, /dev/null is a pseudo device, which is equivalent to a black hole, and the device will not generate IO, so the IO of this command only occurs in /On dev/sdb, it is equivalent to testing the readability of the disk. (Ctrl+c terminates the test)

4, test simultaneous read and write capabilities

The code is as follows:

time dd if=/dev/sdb of=/testrw.dbf bs =4k

Under this command, one is a physical partition, and the other is the actual file. Reading and writing to them will generate IO (read for /dev/sdb and write for /testrw.dbf). Assuming they are all on one disk, this command is equivalent to testing the simultaneous read and write capabilities of the disk.

The above is the method of testing the read and write speed of Linux disk using dd command. This paper tests the read speed, write speed and simultaneous read and write speed of Linux disk, so that the read and write speed of Linux disk is more. fully understand.

Copyright © Windows knowledge All Rights Reserved