(1) /dev/null: recycle bin, bottomless pit.
(2) /dev/zero: generates characters.
2. Test disk write capability
The code is as follows:
time dd if=/dev/zero of=/testw.dbf bs=4k count=100000
Because /dev//zero is a pseudo-device, which generates only null character streams, no IO will be generated to it, so that the IO will be concentrated in the of file, which is only used for writing, so this command is equivalent to testing the disk's write capability. Adding oflag=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 capability
The code is as follows:
time dd if=/dev/sdb of=/dev/null bs=4k
Because /dev/sdb is a physical partition, the read of it generates IO, and /dev/null is a pseudo-device, which is equivalent to a black hole, and the read of to the device does not generate IO. device does not generate IO, so the IO for this command occurs only on /dev/sdb, which is also equivalent to testing the read capability of the disk. (Ctrl+c to terminate the test)
4. Test the ability to read and write at the same time
The code is as follows:
time dd if=/dev/sdb of=/testrw.dbf bs=4k
Under this command, one is the physical partition and the other is the actual file, and the reading and writing to them both generates IO (the reading and writing to /dev/sdb is the black hole). dev/sdb for reads and /testrw.dbf for writes), and assuming they are both in a single disk, this command is equivalent to testing the simultaneous read and write capabilities of the disk.