Specify Different Units
Yes, it is possible to specifiy different units for bs
and skip
and count
. However, there are only two choices for the skip
and count
units. skip
and count
must match the bs
value or be specified in bytes. To set the units to bytes you must add an additional operand of iflag=skip_bytes
for skip
and iflag=count_bytes
for count
or iflag=skip_bytes,count_bytes
for both.
In your case, this command should accomplish your goal:
dd if=image.iso of=test iflag=skip_bytes,count_bytes bs=4M \
skip=$((1161215*512)) count=$((32768*512))
It appears you want to extract exactly 16M. Set bs=4M count=4
and use only skip_bytes
:
dd if=input.file of=output.file iflag=skip_bytes bs=4M \
skip=$((1161215*512)) count=4
Example for testing:
An input file with the contents:
aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
With count_bytes
(extract exactly count
bytes):
$ dd if=input.file of=output.file iflag=skip_bytes,count_bytes bs=8 skip=5 count=20
yields 20 characters:
cddeeffgghhiijjkkllm
Without count_bytes
(count
is multiplied by bs
):
dd if=input.file of=output.file iflag=skip_bytes bs=8 skip=5 count=3
yields 24 characters:
cddeeffgghhiijjkkllmmnno
Your version of dd
may not include iflag
, skip_bytes
, or count_bytes
.
These examples were tested on Debian 9 using dd (coreutils) 8.26.
Update: skip_bytes
and count_bytes
are supported from coreutils v8.16(March 2012), so nearly all distributions will support it by default