3 ms·
A bigger reason to avoid `dd` is unintuitive, "incorrect" behavior in some edge cases. I don't remember the exact conditions that trigger it, but `dd` without
by tgsovlerkhgsel 4y ago
A bigger reason to avoid `dd` is unintuitive, "incorrect" behavior in some edge cases.
I don't remember the exact conditions that trigger it, but `dd` without `iflag=fullblock` can result in
dd: warning: partial read (16384 bytes); suggest iflag=fullblock
I'm able to reliably trigger this with
$ cat /dev/zero | openssl enc -aes-128-cbc -pbkdf2 -k foo | dd status=progress bs=1M count=100000 of=/dev/null
but not when I omit the `count=...` for some reason (maybe it isn't showing the warning in that case because it doesn't matter - apparently the effect this has is one of the "blocks" being smaller, and thus fewer bytes being copied, but it doesn't add padding or anything stupid like that, see https://unix.stackexchange.com/questions/121865/create-random-data-with-dd-and-get-partial-read-warning-is-the-data-after-the https://unix.stackexchange.com/questions/121865/create-rando...).
I wish we had a cat-like tool for writing into files, for the "cat foo | do-something | sudo dd of=/dev/something" use case.
- gorgoiler 4y agoFor writing into files I usually reach for “sudo tee /dev/something” but there is also this: … | sudo cp /dev/stdin /dev/something
- tgsovlerkhgsel 4y agoHuh. That seems to work. I would have expected that to create a copy of the device file, i.e. /dev/something becoming synonymous with /dev/stdin.