7

Is there any difference between doing i.e. dd bs=4M if=archlinux.iso of=/dev/sdx status=progress oflag=sync or doing cp archlinux.iso /dev/sdx && sync, and reason to use one over the other? (aside from the pretty progress bar in dd)

5

One difference is efficiency, and thus speed. For example, you could get the bytes one by one and copy them to the device, with cat:

cat archlinux.iso > /dev/sdx

In theory cat will move each byte independently. That is a slow process, although in practice there will be buffers involved.

With dd and a good block size (usually related to the physical block size) it will be faster.

With cp it depends on the buffer size used by cp (not under your control) and other buffers on the way. Theoretically the efficiency lies between cat and dd.

An analogy: it is like pouring the contents of a glass into another glass.

cat will do it one drop at a time.

dd will use a spoon, and you define how big the spoon is (system limits apply)

cp will use its own spoon, and you don't know how big it is.

|improve this answer|||||
  • 1
    The analogy to the glass is really nice! – Panki Dec 20 '19 at 15:06
0

I use it mainly because of the status=progress you mentioned; what can I say, I am impatient and need to know :-)

Even if you forgot to add that and started the job, you can send it a SIGUSR1 signal and it will print the current I/O statistics to stderr (which, unless you redirected it, is your terminal).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.