1, first familiar with two special equipment:
(1)/dev/null: Recycle Bin, bottomless pit.
(2)/dev/zero: produces characters.
2. Test disk write capability
Copy the Code code as follows:
Time DD If=/dev/zero of=/testw.dbf bs=4k count=100000
Because/dev//zero is a pseudo-device, it produces only a stream of empty characters, it does not produce Io, so the IO is concentrated in the of file, the of file is used only for writing, so this command is equivalent to the write capability of the test disk. Adding Oflag=direct at the end of the command skips the memory cache, and adding Oflag=sync skips the HDD cache.
3. Test disk reading Ability
Copy the Code code as follows:
Time DD If=/dev/sdb Of=/dev/null bs=4k
Because/dev/sdb is a physical partition, reading it will produce io,/dev/null is a pseudo device, equivalent to a black hole, of which the device does not produce IO, so the IO of this command only occurs on the/DEV/SDB and is equivalent to the read capability of the test disk. (CTRL + c termination test)
4, test and read and write ability
Copy the Code code as follows:
Time DD If=/dev/sdb of=/testrw.dbf bs=4k
Under this command, one is a physical partition, one is the actual file, and the read/write will produce IO (read to/dev/sdb, write to/TESTRW.DBF), assuming they are all on a disk, this command is equivalent to testing the disk while reading and writing ability.
How to test Linux disk read and write speed using the DD command