The DD command under Linux system is one of the commonly used commands, and the DD command is also widely used. In addition to the known DD command to copy files, you can also use the DD command to test the performance of the disk. So how do you test the performance of a Linux disk using the DD command?
Here are some common DD direct command, look at his difference:
dd bs = 64k count = 4k if = /dev /zero of = test
dd bs=64k count=4k if=/dev/zero of=test; sync
dd bs=64k count=4k if=/dev/zero of=test conv=fdatasync
dd bs=64k count=4k if=/dev/zero of=test oflag=dsync
The difference between these four DD commands is the way in which the write cache is handled in memory:
1. Dd bs=64k count=4k if=/dev/zero of=test
No parameters are added. The default mode of dd does not include the “sync” (sync)” command. In other words, the dd command did not let the system actually write the file to disk before it was completed. So the above command simply reads the 128MB of data into the memory buffer (write cache). So what you get will be a super fast speed. Because in fact, dd gives you only the reading speed, until the dd is finished, the system will start to actually write data to the disk, but you can't see the speed. So if this speed is fast, it will have no effect.
Actual running results:
268435456 bytes (268 MB) copied, 1.3529 seconds, 198 MB/s
2.dd bs=64k count=4k if=/dev /zero of=test; sync
is exactly the same as in previous 1. The semicolons are separated by two separate commands. When the sync command is ready to start writing data to the disk, the previous dd command has displayed the wrong <write speed& rdquo; value on the screen. So you still can't get real write speed.
Actual running results:
268435456 bytes (268 MB) copied, 0.522815 seconds, 513 MB/s
3.dd bs=64k count=4k if=/dev /zero of=test conv=fdatasync
After adding this parameter, the dd command will actually execute the "sync" operation in the end, so this time you get the 128M data. The time it takes to get to the memory and write to disk, so the calculated time is more in line with the actual use.
Actual running results:
268435456 bytes (268 MB) copied, 2.8046 seconds, 95.7 MB/s
4.dd bs=64k count=4k if=/dev /zero of=test oflag=dsync
After adding this parameter, dd will perform a synchronous write operation each time it is executed. In other words, this command must first write the 64k to the disk after reading 64k, and then read the following 64k, a total of 128 times. This is probably the slowest way, because basically no write cache is used.
Actual operation results:
268435456 bytes (268 MB) copied, 3.40069 seconds, 78.9 MB/s
In general, the fourth method is the most strict, Can simulate the insertion operation of the database, so it is very slow, it is also a benchmark for testing the performance standard of vps hard disk. Generally speaking, if the test result exceeds 10M, it will have no effect on the normal station construction. More than 50M, is a very powerful state, saw this vps hard drive performance is very good, DD speed reached 78.9MB /s.
In these commands, bs=64k means that the block size of the read/output is 64k bytes at the same time, and count=4k means that the number of copy blocks is 4000. If the test is stricter, We run DD with 1G data:
dd if=/dev/zero of=test bs=64k count=16k oflag=dsync
means that each block size is 64k bytes. Test 16k number of blocks, the actual test results:
1073741824 bytes (1.1 GB) copied, 18.9098 seconds, 56.8 MB/s
The above is the method of testing the performance of Linux disk using DD command In fact, the principle of this method is to use the copy function of the DD command to test the read and write frequency of the disk by the speed of file transfer.
curl is an open source file transfer tool that can be used in Linux systems. If you
In the Linux system, if there is no relevant settings, then close a process, then he terminates, and
Our disk space often takes a long time to become full, or only a small amount affects the speed of t
Many users have used Docker to reflect the time when the Docker container is out of sync with the ho
How to use the command line to change the date and time of the Linux system
Linux system how to set up security management
Steps for installing Go language on Linux system
How to clear the private data in the file under Linux
How does Linux use tools to encrypt data?
How to use the expr command in Linux system
What should I do if the Linux server is attacked by a rootkit?
How to deal with the unresponsive situation of the su command in Linux
Linux no network installation GCC skills
Linux uses commands to clear the terminal screen
How to open multiple folders in one window in Windows 7
How to change the win7 disk drive? Win7 change the drive letter method to share
Easily solve the problem of Windows7 sound card driver incomplete
Optimize to make windows7 boot faster
Users are worried about the privacy rights of Win10 system.
How to set the win7 taskbar auto hide?
How to switch input Pharaoh in Win7 system with a sound
Fine-tuning Win8.1 this computer
Do not leave trouble! Completely block the sharing vulnerability of Win XP system