Target ibs / obs / bs in dd

I have a script that creates a file system in a file on a linux machine. I see that to create a file system it uses 'dd' with the option bs = x, reads from / dev / zero and writes to a file. I think it’s usually useful to read ibs / obs / bs from real hardware devices, since they have certain block size restrictions. However, in this case, since it is reading from a virtual device and writing to a file, I see no reason to use the parameter "bs = x bytes". Is my understanding here wrong? (Just in case this helps, this file system is later used to download qemu vm)

+5
source share
3 answers

Block size is the number of bytes that are read and written at the same time. Presumably, there is an option count=, and this is indicated in units of block size. If there is a parameter skip=or seek=, they will also be in units of block size. However, if you are reading and writing a regular file and there are no errors on the disk, the block size does not really matter as long as you can scale these parameters accordingly, and they are still integers. However, some sizes may be more effective than others.

+3
source

, . - , , - , .

60-, 70-, , 80-? , , ? Exabyte QIC - - ; ? .

. .

----+-------+-----+-------+-----+----
... | block | IRG | block | IRG | ...
----+-------+-----+-------+-----+----

, . , 5120 , 512 , , 512 , ; . , 512 , 5120 , ; 512 , , . , , , . ASCII , IRG ; . , , IRG, , , . - - , .

: , . tar ( 512 ). - , , 100 (-, ). , , . , . , 512 , , , , , , , , , , ... , , , 512- , . ... . ( , , .) , - (, 5120 512), , ( , , 20 , , ).

- - . , 256 , QIC . - , ; , , CD DVD ( ).

. dd . , , , 4 , , , 16 , ibs ( ) obs ( ). !

, count (). 'dd bs=1024 count=1024 if=/dev/zero of=/my/file/of/zeroes', 1 . 1 .

dd ; , .

+10

For reading from / dev / zero it does not matter. ibs / obs / bs indicate how many bytes will be read at a time. It is useful to choose a number based on how bytes are read / written in the operating system. For example, Linux typically reads from a hard disk in 4096 byte chunks. If you have any idea how the main hardware is read / written, it might be a good idea to specify ibs / obs / bs. By the way, if you specify bs, it will override everything that you specify for ibs and obs.

+2
source

All Articles