< RETRO BLOG >

What if the cult of dd is right?

by jpk on 2019-01-23 11:47:26

Are you a believer?

There are articles out there talking about the useless usage of dd and why cat is better. Cat is faster because it automatically adjusts the blocksize and dd is slow because it internally only works with 512 byte blocks. This and That.

I did some simple tests with time, dd and cat, added some obscure parameters to dd, because cat is better.

Testing dd with status and specific blocksize

$ time dd if=/dev/sdd of=test.dd status=progress bs=8M
15921577984 bytes (16 GB, 15 GiB) copied, 878 s, 18.1 MB/s
1899+1 records in
1899+1 records out
15931539456 bytes (16 GB, 15 GiB) copied, 879.018 s, 18.1 MB/s

0.04s user 23.33s system 2% cpu 14:39.03 total

Testing dd

$ dd if=/dev/sdd of=test.dd
31116288+0 records in
31116288+0 records out
15931539456 bytes (16 GB, 15 GiB) copied, 869.783 s, 18.3 MB/s
16.13s user 159.22s system 20% cpu 14:29.80 total

Testing cat with pv

$ time cat /dev/sdd | pv > test.raw
14.8GiB 0:14:43 [17.2MiB/s] [        <=>                            ]
0.28s user 25.84s system 2% cpu 14:43.18 total

Testing cat

$ time cat /dev/sdd > test.raw
0.18s user 21.21s system 2% cpu 14:42.25 total

Y U DO IT WRONG

Somehow my cat is not as fast as dd.

KTHBYE