Document alternative between '16m' and '16M' for Mac dd command
In the dd command line on Mac, according to 55f6527, people complained about both ‘16m’ and ‘16M’.
Then we reintroduced ‘16m’ to make /dev/rdisk work in
Now people are complaining again about ‘16m’ in https://twitter.com/recifs/status/693909221008629765.
Maybe we should document an alternative: try ‘16m’ and if it doesn’t work try ‘16M’.
To be able to write this we need to know:
- Which version works on the newer version of Mac OS X. This should be the first to be documented.
- What happens on older versions of Mac OS X when the default version fails.
#4 Updated by sycamoreone 2016-02-03 10:50:15
Apple’s dd is a version of FreeBSD’s dd which also used lower-case letters for multipliers.
POSIX only specifies the lower-case b and k multipliers, that acutally also work with GNU dd.
$ dd if=/dev/urandom of=FILE bs=1K count=1 1+0 records in 1+0 records out 1024 bytes (1.0 kB) copied, 0.000465822 s, 2.2 MB/s $ dd if=/dev/urandom of=FILE bs=1m count=1 dd: invalid number `1m'
So writing 16384k instead of 16M should work everywhere. Maybe just saying something like 512k would also work. One would need to test how much of a speed difference this actually makes when writing to a USB stick.
At least without a USB stick the difference in speed is negligible:
$ dd if=/dev/urandom of=FILE bs=1M count=100 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 9.6322 s, 10.9 MB/s $ dd if=/dev/urandom of=FILE bs=1k count=102400 102400+0 records in 102400+0 records out 104857600 bytes (105 MB) copied, 10.3759 s, 10.1 MB/s
#5 Updated by muri 2016-02-03 10:51:58
here you go:
bash-3.2# time dd if=Downloads/tails-i386-2.0/tails-i386-2.0.iso of=/dev/rdisk2 bs=16m && time sync 67+1 records in 67+1 records out 1135089664 bytes transferred in 73.570107 secs (15428680 bytes/sec) real 1m13.739s user 0m0.002s sys 0m0.690s real 0m0.070s user 0m0.001s sys 0m0.053s bash-3.2# time dd if=Downloads/tails-i386-2.0/tails-i386-2.0.iso of=/dev/rdisk2 bs=16M && time sync dd: bs: illegal numeric value real 0m0.004s user 0m0.001s sys 0m0.002s
so at least in 10.11.3, it has to be a small m
the manpage of os x isn’t sure itself
> Where sizes are specified, a decimal, octal, or hexadecimal number of bytes is expected. If the number ends with a ``b’‘, ``k’‘, ``m’‘, ``g’‘, or ``w’‘, the number is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G) or the number of bytes in an integer, respectively. Two or more numbers may be separated by an ``x’’ to indicate a product.
#7 Updated by sajolida 2016-02-04 10:02:19
- QA Check changed from Info Needed to Dev Needed
Thank you all for your feedback! The GNU vs FreeBSD explanation from sycamoreone makes lots of sense and is confirmed by muri’s testing. So I think we should stick to ‘16m’ and add a note or something saying “If you get
invalid number ‘16m’ (the error I get in GNU dd) then try with ‘16M’”.
I’ll do this.
#14 Updated by muri 2016-02-22 10:24:37
- Assignee changed from muri to sajolida
> Ready! Muri, do you mind having a look?
you’re mixing tick and backtick (grave accent) in the dd error message. it should be:
> invalid number: ‘16m’
(pasted from the command; i think these are both forward ticks or something alike; i think for reading they should be the same before and after the 16m)
other than that is fine! thanks!
btw. i’ve now tested installing brew and the standard install installs coreutils