How to make dd faster on Linux?

dd seems slow when I use command like

# dd if=/dev/sda2 of=./sda2.bak

How to make it faster?

You can make dd faster by specifying a good bs like

# dd if=/dev/sda2 of=./sda2.bak bs=8192

8192 is a magic number. There are may be other good sizes for bs for different systems. But 8192 works pretty well for me.

It may be a little bit old and off topic, but 8192 is tested a good number in OCaml systems programming (see “2.10 The cost of system calls and buffers”) that is the not too large and is large enough to achieve good I/O throughput.

I/O buffer vs I/O throughput

Answered by MV.

Checked the man page on my system, the default value of bs (ibs and obs) is set to 512…

One comment:

  1. I’m having issues with disk I/O speeds in latest kernel 5.8 with a brand new machine… Can you help me diagnose what’s happening?
    The weird thing about this is that I don’t have these problems when I boot into Manjaro, these problems only happen in Debian side of things (I’m using MX Linux which features an updated custom kernel 5.8.0.3, it’s not the stock Debian 10 kernel, don’t worry…)
    This problem only happens when swapping to disk is involved (some large applications require swap to be used at all times, unfortunately)
    I’ve tried playing around with swappiness values and other VM values, without results. More details can be seen in these screenshots:
    https://imgur.com/a/x7LkOvV

Leave a Reply

Your email address will not be published. Required fields are marked *