What's the difference between two dd commands that have different bs and count values, as long as they multiply to the same? For example:
dd if=/dev/random of=aa bs=1G count=2dd if=/dev/random of=aa bs=2G count=1
|
What's the difference between two
|
||||
|
As far as the end result is concerned, they will do the same. The difference is in how So, essentially, the first command would try to read 2GB in two chunks of 1GB, and the latter would try to read whole 2GB at one go and then output it to the |
|||
|
|
|
The first one will take up 1G of memory, fill it with data from the input file and output it, two times. The second one will take up 2G of memory, fill it with data from the input file and output it. |
|||
|
|
|
The result will be the same but in the first case In my opinion there is no need to use such large blocks. You can do a couple of tests but in my case I achieve a greater speed with much smaller blocks (< 1MB) |
|||
|
|
|
The used block-size should match the best speed settings for source and target device. You can best see the difference if you try to copy an LV device. The usage of very small BS-size will interrupt the read-process unnecessary. The usage of a very big BS-size will lead to long waits during write. Since standard LVs consist normally of 4 MB chunks, wich is also a good size for physical disk access I use bs=4M for these. Try to experiment with 16K or 256M - you will note the difference - and watch the disk indicator during copy... |
|||||||
|
/dev/urandom, not/dev/random. See security.stackexchange.com/questions/3936/…, security.stackexchange.com/questions/3259/…, … – Gilles Dec 14 '11 at 11:40