First, some details about the command
dd if=/dev/zero of=jessie-arm64.img bs=1M count=0 seek=5120
From the man page of dd :
if=FILE
read from FILE instead of stdin
of=FILE
write to FILE instead of stdout
bs=BYTES
read and write up to BYTES bytes at a time
count=N
copy only N input blocks
seek=N skip N obs-sized blocks at start of output
We have count=0
, so 0 input block will be copied but we have seek=5120
so 5120 blocks of size obs
will be skipped. obs
is the output block size, in our case it's not specified so obs=bs=1M
.
If you want you can even remove the if=/dev/zero
and obtain the same result.
dd of=jessie-arm64.img bs=1M count=0 seek=5120
Now the question of optimum value for bs
, we observe in the source code of dd that even if count=0
blocks are copied, we have seek=5120
(seek_records
in the source code) and the bs
(obs
, output_blocksize
int the source code) value is used.
if (seek_records != 0 || seek_bytes != 0)
{
size_t bytes = seek_bytes;
uintmax_t write_records = skip (STDOUT_FILENO, output_file,
seek_records, output_blocksize, &bytes);
if (write_records != 0 || bytes != 0)
{
memset (obuf, 0, write_records ? output_blocksize : bytes);
do
{
size_t size = write_records ? output_blocksize : bytes;
if (iwrite (STDOUT_FILENO, obuf, size) != size)
{
error (0, errno, _("writing to %s"), quoteaf (output_file));
quit (EXIT_FAILURE);
}
if (write_records != 0)
write_records--;
else
bytes = 0;
}
while (write_records || bytes);
}
}
The optimum value of bs
is dependant of your hardware, here is an article explaining how to measure it. I will not go in detailed explanations here, because this answer is becoming too long.
Remarks:
1) You can observe your image in hexadecimal format with :
cat jessie-arm64.img | xxd
2) This is valid for the dd command from the GNU coreutils. If you are using a BSD-style dd
command such as in macOS, you have to use bs=1m
instead of bs=1M
.