Live data from Hacker News

The Cult of DD

eklitzke.org

91–100 of 178 posts

Re: The Cult of DD

#91
post #27
post #26

Somewhat related short story: Earlier this week my friend said that he dd'd away just over 50 bitcoins, back when they were worth ~$3 each. "One of the biggest regrets of my life."

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

Actually it's a $150 loss.

Re: The Cult of DD

#92
post #77

For those of you that are blissfully unaware of what the JCL DD command looks like, here's a example (with only the DD section of the JCL shown): //SYSPRINT DD SYSOUT=* //SYSLIN DD DSN=&&OBJAPBND, // DISP=(NEW,PASS),SPACE=(TRK,(3,3)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200), // UNIT=&SAMPUNIT //SYSLIB DD DSN=SYS1.MACLIB,DISP=SHR //SYSIN DD DSN=&SAMPLIB(IEWAPBND),DISP=SHR

It links a file name (as referenced within a program) to the proper physical file[0], conceptually like an environment variable in UNIX and Windows.

Ah, I miss elements of the mainframe days.

[0] https://www.ibm.com/support/knowledgecenter/zosbasics/com.ib...

Re: The Cult of DD

#93
post #72

"This is a strange program of obscure provenance that somehow, still manages to survive in the 21st century." -> links to wikipedia page with direct discription of lineage back to 5th ed research unix "That weird bs=4M argument in the dd version isn’t actually doing anything special—all it’s doing is instructing the dd command to use a 4 MB buffer size while copying. But who cares? Why not just let the command figure…

Thank you for saving me the effort. I cringe upon seeing people throwing the word "standard" like that.

Re: The Cult of DD

#94
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.

Actually it's a $150 loss.

In this case, opportunity cost was real and even quantifiable.

Re: The Cult of DD

#95

This is a great example of why downvoting submissions should be a thing. Or at least showing the up/down tuple. I would say every upvote represents someone misled and likely to further propagate this nonsense.

You can flag submissions.

Re: The Cult of DD

#97
post #90
post #83

Earlier quoted context omitted.

It doesn't need to hunt for the directory entry, just needs to call `fstat()` on the stdin file descriptor.

Unless the input file is a device, and then you need to call: ioctl(STDIN_FILENO, BLKGETSIZE64, &size)

But I guess this is orthogonal to where the file descriptor comes from (i.e. stdin or opening a file whose name is passed in the args)

Re: The Cult of DD

#98
post #38

Earlier quoted context omitted.

dd is awful and error-prone for this sort of use. Use noerror, but forget sync? Corrupt output file if there is an error. Use a bigger bs so it's not slow as treacle? A single faulty sector blows away a whole bs of data, and your output image may get unwanted padding appended to the end. Recoverable error? dd's not going to retry. Use ddrescue or FreeBSD's recoverdisk(1). They're faster, they're safer, they're more e…

ddrescue is excellent.

ddrescue is so good that that particular example feels a little strawman-ish

Re: The Cult of DD

#99
post #72

"This is a strange program of obscure provenance that somehow, still manages to survive in the 21st century." -> links to wikipedia page with direct discription of lineage back to 5th ed research unix "That weird bs=4M argument in the dd version isn’t actually doing anything special—all it’s doing is instructing the dd command to use a 4 MB buffer size while copying. But who cares? Why not just let the command figure…

>> if you want progress information with cat you can combine it with the pv command

Since coreutils-8.24[1], dd "accepts a new status=progress level to print data transfer statistics on stderr approximately every second."

> Because the command probably doesn't figure out the right size automatically . . . this can mean massive performance differences between invocations

For anyone who's wondering, here are two good threads on determining optimal block size: https://superuser.com/questions/234199/good-block-size-for-d... http://stackoverflow.com/questions/6161823/dd-how-to-calcula...

[1] http://savannah.gnu.org/forum/forum.php?forum_id=8309

Re: The Cult of DD

#100
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 :)

I think there's a rule that you're not really qualified to discuss command line tools in public until you've used dd to inadvertently eradicate an entire partition.
Post reply on HN