On Sun, May 16, 2021 at 06:33:57PM -0400, Stefan Monnier wrote:
> >> On Sun, May 16, 2021 at 01:31:49PM -0500, Richard Owlett wrote:
> >> > I'll bite ;}
> >> > When is it the right tool?
> >> 
> >> When you're using it to convert ebcdic to ascii, while swapping bytes and
> >> reblocking an ancient file from a barely readable archival tape.
> >> 
> >> > When is it not?
> >> 
> >> When copying a file.
> >> 
> > When copying a file and writing it to another medium, perhaps eg when 
> > writing
> > a DVD .iso file directly to a USB stick, it's ideal.
> 
> Not sure about ideal:
> 
>     cat <foo.iso >/dev/sdb
> 
> is one char longer than
> 
>     dd <foo.iso >/dev/sdb
> 
> but it's often faster (you can speed up `dd` by providing a larger
> `bs=` argument, but then you've lost the length advantage ;-)

Agreed. When writing to USB flash media I've the impression that
there's a sweet spot somewhere between 64K and 1M block size.

The maximum is pretty flat, so I just use 1M (easier to remember),
but it's significant wrt the default 512B. It possibly depends on
the rest of the hardware.

This is one point. The other, which adds more convenience is that
dd has an explicit argument for (input and) output file name, whereas
cat relies on redirection. This becomes relevant when you try to

  sudo cat thing > that_other_thing

and realise that the ">" is *not* in the sudo context (and what
you would have to do to "fix" that).

Instead,

  sudo dd if=thing of=this_other_thing

Just Works out of the box. More relevant when doing ">>" (use
dd's oflag=append then).

Another nice thing is oflag=sync: when writing to big media, it
makes sure that data doesn't end up in the buffer cache making
you wait during the final sync.

And oh, 'status=progress' in combination with the above.

So... yay, dd.

Cheers
 - t

Attachment: signature.asc
Description: Digital signature

Reply via email to