I'm writing some images back to block devices, with dd
, and getting very strange output I've never seen before.
# xz -dc goren.img.xz | dd bs=1M of=/dev/storage2/goren
35+2475166 records in
35+2475166 records out
21474836480 bytes (21 GB) copied, 222.912 s, 96.3 MB/s
# xz -dc gronn.img.xz | dd bs=1M of=/dev/storage2/gronn
50+2413782 records in
50+2413782 records out
21474836480 bytes (21 GB) copied, 233.478 s, 92.0 MB/s
# xz -dc grummle.img.xz | dd bs=1M of=/dev/storage2/grummle
63+2443466 records in
63+2443466 records out
21474836480 bytes (21 GB) copied, 222.898 s, 96.3 MB/s
# xz -dc hozen.img.xz | dd bs=1M of=/dev/storage2/hozen
19+2556787 records in
19+2556787 records out
21474836480 bytes (21 GB) copied, 250.989 s, 85.6 MB/s
The output I expected to see in each case (and what I got when creating the image files) is:
20480+0 records in
20480+0 records out
As far as I can tell the images are being written correctly, though I am concerned with the number of records shown. This is obviously not correct in any of the cases. Though, as I said, the written images match the originals, pass filesystem checks, etc.
I'm using Fedora 21 x86_64 with coreutils 8.22.
dd
isn't reading 1M blocks reliably from the pipe but I'm too busy to dig up the source code and look. Try... | dd ibs=1024 obs=1m ...
to change the input block size to a smaller value and see what you get. – Andrew Henle May 06 '15 at 21:39dd
with pipes – Stéphane Chazelas May 06 '15 at 21:56dd
isn't the right tool. – Gilles 'SO- stop being evil' May 06 '15 at 22:43dd
does not, in general, just copy its input to its output. It copies bits and pieces, here and there, in a difficult-to-control fashion, unless you use the right parameters (absolutely avoidbs
) with the right file types (plain files are block devices can be ok, forget about pipes and character devices). – Gilles 'SO- stop being evil' May 06 '15 at 22:54