in the in Linux, the ability to read and write disks is a very necessary task. Although there are some very professional software to do this, but in some cases, due to technical limitations, or users do not need to be professional, it is necessary to consider the Linux Embedded command DD, it is an easy-to-use, and the function of a slightly powerful command.
First, the first thing to know about two special devices
/dev/null : Recycle Bin, bottomless pit , you can throw some useless stuff in .
/dev/zero : Generate characters , so you can simulate files and file transfers without having to file them
Second, the reading and writing ability test
Disk write capability test:
Time DD If=/dev/zero of=/test bs=8k count=300000
because/dev/zerois a pseudo-device that produces only a stream of empty characters, which does not produceIO, So,IOwill focus on offile, ofthe file is written only, so this command is equivalent to the write capability of the test disk.
Test Disk read capability :
Time DD IF=/DEV/SDB1 Of=/dev/null bs=8k
because/DEV/SDB1is a physical partition, and reading it will produceIO,/dev/nullis a pseudo device, equivalent to a black hole, ofto the device will not produceIO, so, this command of theIOonly occurs in/DEV/SDB1also equivalent to the read capability of the test disk.
Test simultaneous read and write capability
Time DD IF=/DEV/SDB1 Of=/test1 bs=8k
under this command, one is the physical partition, the other is the actual file, and the read and write will be generated IO (To /DEV/SDB1 It's reading, right. /test1.dbf is written), assuming that they are all on a disk, this command is equivalent to testing the disk while reading and writing.
DD Tool Use
If input device or file
of output devices or files
b s dd buffer. Set dd when the io Copy How much data, it and the input file and output file block size is not directly linked. In general,the larger theBS , the faster the copy .
s Kip The number of dd buffers that are skipped from the input file when DD is set to begin copying data. Generally used when the bare device has offset .
Seek to set dd to start writing data by skipping the number of DD buffers from the output file . Generally used when the bare device has offset .
Count sets the number of io for DD . If countis omitted, indicates that the input file is completely copied to the output file .
of course, DD Tools also have more powerful features that are not commonly used and are not introduced here.
This article is from the "Network Technology" blog, please be sure to keep this source http://zqxiang.blog.51cto.com/2806551/1410064