DD Command – Meaning of Two Numbers in DD’s ‘a+b Records’ Stats

dd

The first 2 lines in dd stats have the following format:

a+b records in
c+d records out

Why 2 numeric values? What does this plus sign mean?
It's usually a+0, but sometimes when I use bigger block size, dd prints 0+b records out

Best Answer

It means full blocks of that bs size plus extra blocks with size smaller than the bs.

pushd "$(mktemp -d)"
dd if=/dev/zero of=1 bs=64M count=1 # and you get a 1+0
dd if=1 of=/dev/null bs=16M # 4+0
dd if=1 of=/dev/null bs=20M # 3+1
dd if=1 of=/dev/null bs=80M # 0+1
_crap=$PWD; popd; rm -rf "$_crap"; unset _crap
# frostschutz's case
yes | dd of=/dev/null bs=64M count=1 # 0+1

Edit: frostschutz's answer mentions another case to generate non-full blocks. Worth reading. See also https://unix.stackexchange.com/a/17357/73443.

Related Question