💾 Archived View for callistix.srht.site › tipsandtricks › ddvscat.gmi captured on 2024-08-18 at 17:11:30. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-02-05)

-=-=-=-=-=-=-

`dd` vs `cat` for writing disk images

Usually you would use the `dd` command to copy a disk image to an SD card and then tune the `bs` parameter for speed. But it might be that `cat` is faster, simply like this:

cat <disk.img> >/dev/<device>

Let's see if this is true.

SD card writing tests with a 30G image:

$ time dd if=rpi_debian.img of=/dev/sde bs=1M
real    32m23.274s

$ time dd if=rpi_debian.img of=/dev/sde bs=10M
real    32m16.737s

$ time dd if=rpi_debian.img of=/dev/sde bs=100M
real    32m17.373s

$ time cat rpi_debian.img >/dev/sde
real    11m56.924s

SD card reading tests with a 30G card:

$ time dd if=/dev/sde of=rpi.img bs=1M

$ time dd if=/dev/sde of=rpi.img bs=10M
real    27m9.273s

$ time dd if=/dev/sde of=rpi.img bs=100M
real    27m22.742s

# time cat /dev/sde >rpi.img
real    26m1.219s

`cat` clearly performs better. `dd`, you have served me well, but it's time to say good bye.

🏠 callistix Gemini capsule

Created: 6/Jan/2024

Modified: 21/Jan/2024