Live data from Hacker News

The Cult of DD

eklitzke.org

41–50 of 178 posts

Re: The Cult of DD

#41
But who cares? Why not just let the command figure out the right buffer size automatically?

Because it can be a lot slower. dd is low level, hence powerful and dangerous.

And, if we are going down that rabbit hole, you don't need cat[1]

“The purpose of cat is to concatenate (or "catenate") files. If it's only one file, concatenating it with nothing at all is a waste of time, and costs you a process.”

[1]http://porkmail.org/era/unix/award.html#cat

Re: The Cult of DD

#43
post #27

Earlier quoted context omitted.

If one of the biggest the biggest lifetime regrets is a $50k financial loss, your friend is doing pretty well.

$50k is a massive sum for a lot of people...

Well yeah, he's in med school. Maybe one day it won't be a massive sum, but, for now, he's broke.

Re: The Cult of DD

#44
post #23

One thing I'll often use dd for is recovering data from a failing drive. Can head ignore read errors? dd can. As far as I'm concerned, dd is lower-level than most of the other utilities and provides more control over what's happening. The author does have a point that the syntax is strange though.

>One thing I'll often use dd for is recovering data from a failing drive. Funnily enough, I ended up using it to accidentally name the wrong drive in the argument, and lost years of photos, music, video etc. though I suppose I can't blame dd for that :)

Don't drink and dd. Spoken from experience.

Re: The Cult of DD

#45

An even easier solution: don't make people fall into the command line to format a USB reliably. The command line should be reserved for times where you need the fine grain control to do something that DD is meant to do. A GUI should implement everything else in a reliable way that doesn't break half the time or crash on unexprected input.

I'm a Linux sysadmin/developer and I've literally never used a Linux GUI.

Re: The Cult of DD

#46

There's one good (?) reason to use dd with devices: it specifies target in the same command. For devices, writing to them usually requires root privileges, so it's easy to: sudo dd .... of=/dev/... But there's no trivial cat equivalent: sudo cat ... > target Will open target as your current user anyway. You can play around with tee and redirection of course. But that's getting more complicated than the original.

This. The alternative:

    sudo sh -c 'cat some.img > /dev/sdb'
or even more baroque:

    cat some.img | sudo tee /dev/sdb > /dev/null
is a pain by comparison, and the `sudo sh -c` variant has env implications when spawning a sub-shell.

I have an ARM/linux installer script that writes the u-boot image to a specific offset before the first partition:

    dd if=${UBOOT_DIR}/MLO of=$LO_DEVICE count=1 seek=1 bs=128k
    dd if=${UBOOT_DIR}/u-boot.img of=$LO_DEVICE count=2 seek=1 bs=384k
This is admittedly somewhat esoteric, but it seems like a stretch to say `dd` does not have some place, especially when transferring binary data in very specific ways.

Re: The Cult of DD

#47

An even easier solution: don't make people fall into the command line to format a USB reliably. The command line should be reserved for times where you need the fine grain control to do something that DD is meant to do. A GUI should implement everything else in a reliable way that doesn't break half the time or crash on unexprected input.

Some of us don't "fall" into the command line, we reluctantly get out of it, and only for specific purposes.

Re: The Cult of DD

#48
Dude's missing an important point:

If you mess up the syntax on a dd invocation, a nice thing happens: nothing.

Use a shell command and pipes, and your command better be perfect before you hit return.

Re: The Cult of DD

#49

There's one good (?) reason to use dd with devices: it specifies target in the same command. For devices, writing to them usually requires root privileges, so it's easy to: sudo dd .... of=/dev/... But there's no trivial cat equivalent: sudo cat ... > target Will open target as your current user anyway. You can play around with tee and redirection of course. But that's getting more complicated than the original.

Even simpler:

    sudo cp image.iso /dev/sdb

Re: The Cult of DD

#50

An even easier solution: don't make people fall into the command line to format a USB reliably. The command line should be reserved for times where you need the fine grain control to do something that DD is meant to do. A GUI should implement everything else in a reliable way that doesn't break half the time or crash on unexprected input.

I've tried the gui tools in the past, but dd just seems far easier.
Post reply on HN