Talk:Dd (Unix): Difference between revisions
Bad commands |
|||
Line 16: | Line 16: | ||
dd if=/dev/urandom of= /dev/sda1 bs=4k is no harder on a drive than using if=/dev/zero. When urandon runs out of randomness (entropy), the drive waits until more randomness collects in the urandom device. The write is sequential. [User: AwesomeMachine] |
dd if=/dev/urandom of= /dev/sda1 bs=4k is no harder on a drive than using if=/dev/zero. When urandon runs out of randomness (entropy), the drive waits until more randomness collects in the urandom device. The write is sequential. [User: AwesomeMachine] |
||
I think those types of commands should be removed, not because the hard disk word hard, but because it just destroys all data! |
|||
== bit-exact versus byte-exact == |
== bit-exact versus byte-exact == |
Revision as of 14:13, 2 August 2010
Computing Start‑class Low‑importance | ||||||||||
|
Kudos to whoever wrote the "fear and loathing" section. Nice to see that humerous content *can* make it into Wikipedia.
dd is a really cool program! :)
212.202.77.70 20:23, 15 May 2004 (UTC)
What does the name actually mean? dd = "disk dump"? Nixdorf 20:31, 2005 Jan 21 (UTC)
- Probably not. See this old discussion from alt.folklore.computers for a discussion. It looks like "dd" ultimately stands for "data definition". --MarkSweep 02:28, 22 Jan 2005 (UTC)
- The name section mentions "gallows humour", but I can't see any explanation of why the name dd is gallows humour. As a big fan of obscure nerd humour, I'd love to see this expanded. stib (talk) 06:15, 19 November 2007 (UTC)
Make your drives thrash and get really hot
writing from /dev/urandom to your disk is not a terribly good idea, as it will really work your disk drive very hard, resulting in lots of heat. Not sure wikipedia should be encouraging this usage of dd. —Preceding unsigned comment added by 24.89.158.2 (talk) 04:35, 23 June 2008 (UTC)
dd if=/dev/urandom of= /dev/sda1 bs=4k is no harder on a drive than using if=/dev/zero. When urandon runs out of randomness (entropy), the drive waits until more randomness collects in the urandom device. The write is sequential. [User: AwesomeMachine]
I think those types of commands should be removed, not because the hard disk word hard, but because it just destroys all data!
bit-exact versus byte-exact
Can someone explain why dd is byte-exact as opposed to bit-exact? Would bit-exact be more precise? I had the impression dd was a bitwise copy, something google supports; if one searches dd, "bit-exact" one gets more hits than dd, "byte-exact". Nephron 17:59, 21 August 2005 (UTC)
- The smallest element dd can access is a single byte. byte-exact implies bit-exact of course. The question is rather what alternate would not be byte-exact? --82.141.60.86 07:32, 13 December 2005 (UTC)
- dd does exactly the same as cat or cp on (for example) block device nodes, /dev/zero, /dev/random, etc. -- This article reflects a HUGE misunderstanding in using dd. dd is mainly for CONVERTING streams. For example are the following lines exactly the same (see POSIX for details):
dd if=/dev/sda3 of=sda3.img dd </dev/sda3 >sda3.img cat </dev/sda3 >sda3.img cp /dev/sda3 sda3.img
139.18.2.46 (talk) 10:16, 20 November 2009 (UTC)
Dd is a bitstream duplicator. That means, even though the program authors have made the minimum block size=1 byte, dd duplicates bits. There are some advantages to using a bitstream, for instance one could stream a single byte, pipe it through a boolean operator, and perform binary arithematic, or bit mask a certain bit array. Normally this is not done manually, but inside a program. [user: AwesomeMachine]
User Jack_Sparrow wrote on freenode.net/ubuntu : "dd is a sledge hammer of a tools, be sure you know where its going before you swing it." shambling 14:48, 10 August 2006 (UTC)
141.228.106.136 It is Byte exact because it can convert little endian/big endian etc.
DD means din dayal or deepak deewana or deepak gupta
DD means din dayal or deepak deewana or deepak gupta from kautilya collage
- Actually it's short for "Copy and Compare" (exactly what it does), but cc was already taken and so they called it dd. —Preceding unsigned comment added by 85.177.137.52 (talk) 11:34, 29 January 2009 (UTC)
- Close. Taken from the man page for dd:
NAME
dd - convert and copy a file
- dd is short for "convert and copy", except cc (C compiler) already existed, so it was "incremented" to dd. That being said, the source I heard this from said he learned that from one of the original authors, so take that as you will. 15.243.169.69 (talk) 22:58, 3 February 2009 (UTC)
unexplained details
I find it strange that such old unix command is not well documented in man,some information I cannot find nowhere. What exactly does the output of dd mean? 8+1 records in 8+1 records out what is +1?
- It means 8 whole blocks plus one partial block.--Pot (talk) 10:52, 17 March 2010 (UTC)
WHat happens if copied filesize is not a multiply of bs? (block_size)? Will it copy the last partial block or skip it?
- Copy partial block.--Pot (talk) 10:52, 17 March 2010 (UTC)
Now word about it in the man. This wiki page is the first place with good explanation of notrunc option I found! I am not qualified to edit the dd page, but maybe some linux guru can do it. Cirocco 15:51, 3 February 2007 (UTC)
cancel or quit dd ?
missing info .. typed "dd" at the prompt by mistake.. did not know what it was went on wiki and was unable to find a way to quit dd with out doing any thing tried [CTRL]+[C] it quited with
"0+3 records in 0+0 records out"
have no idea what it did.. If some one knows the meanig and a proper way to quit dd i this this would be usefull.
SirDabour —The preceding unsigned comment was added by 212.98.41.187 (talk) 17:31, 31 March 2007 (UTC).
I am no expert, but I suspect it was trying to copy bytes from std-in to std-out. And in this case those would seem to be your console. So, it seems like you did the right thing to quit, and it should not have changed your filesystem in any way. Maybe CTRL-Z would be another way to exit? -69.87.200.37 19:00, 12 October 2007 (UTC)
This is silly [having so many examples]
We don't need so many examples. This page shouldn't be a man page or a page of examples. Come on. —Preceding unsigned comment added by 129.78.64.102 (talk • contribs)
- I agree. I think there's a template for this kind of thing. --Ysangkok 19:06, 27 June 2007 (UTC)
- I disagree. We surely need to have lots of examples. This is one of the reasons why someone searching from Google would prefer to visit Wikipedia rather than many of the other sites having information on dd. NerdyNSK 22:28, 22 September 2007 (UTC)
Please keep the examples (and anti-examples). -69.87.200.37 18:56, 12 October 2007 (UTC)
- This discussion continued in the Anti-examples section below. --Unixguy (talk) 18:47, 27 November 2007 (UTC)
files or bytes?
The article says 'dd is a common UNIX program whose primary purpose is the low-level copying and conversion of files' but I think it would be more correct to say that dd copies and converts raw bytes rather than files. NerdyNSK 22:32, 22 September 2007 (UTC)
- Agreed. dd operates on a low-level and copies raw data ignoring any filesystem structure, cp is used for the copying of files. Flankk 06:46, 9 October 2007 (UTC)
- Actually, "dd if=file of=file2" and "cp file file2" are exactly equivalent. Any program that operates on raw device files directly (the way dd is most often used) will ignore the filesystem structure; this is not dd-specific. (Compare the strace output of dd and cp sometime: the only difference is that cp doesn't have a way to change its buffer size.) When using dd on raw disks or partitions, the files that it "copies and converts" are those device files.
- Granted, most people don't normally think in those terms. But that's why the description is worded the way it is in the dd manpage. 99.41.222.169 (talk) 02:23, 23 August 2009 (UTC)
copy commands
- Unix/*nix programs (Also sometimes used in Windows versions)
- cp -- copy files; can concatenate files
- cpio -- copy an entire directory structure from one place to another
- cat -- concatenate and display files
- dd -- copy streams, files, or devices in whole or part
- head -- display/copy the first part of a file
- tail -- display/copy the last part of a file
- DOS/Windows programs (Seldom used in *nix versions)
- COPY -- copy files or sets of files, binary or text mode, can concatenate files
- XCOPY -- eXtended version of COPY, for copying file structures
- XXCOPY -- further extended commercial program
- ROBOCOPY -- further extended version, included in Vista
Other specialized programs are used to split large files into pieces and then put the pieces back together.
There are no good standard programs to extract an arbitrary piece of a file into another file. dd can be used, but requires setting blocksize to 1, which is very inefficient. In Windows, the obscure program CPART can be used.
grep and awk are powerful *nix programs for looking for patterns in a file. -69.87.200.198 00:31, 17 October 2007 (UTC)
Anti-examples
I would like to delete the section Anti-examples, perhaps just replacing it with a warning. Reasons:
- some of the anti-examples are actually legitimate usage and covered in the section Examples, e.g. wiping a disk by writing zeros on it.
- it is not necessary to give unkowledgable potential vandals an exact recipe.
- anybody knowledgable can use dd to destroy any data anyway.
--Theosch 10:56, 13 November 2007 (UTC)
- There will always be poor vandals among us. :-) It is probably more likely that a legitimate system admin would mistype a
dd
command, causing damage, than for a vandal to gain proper access and use the example to destroy data. --Unixguy (talk) 19:06, 27 November 2007 (UTC)
examples not needed...Wikipedia is not a...
Wikipedia is not a manual, guidebook, or textbook. Policy explicitly states that "a Wikipedia article should not read like a how-to style manual of instructions, advice (legal, medical, or otherwise) or suggestions, or contain "how-to"s.". The "usage", "examples" and "anti-examples" of this article are exactly that and should be deleted. I see no reason for keeping these sections in an encyclopedia. --Pak21 (talk) 15:45, 23 November 2007 (UTC)
- I was bold and removed both example sections. The usage section remains. --Unixguy (talk) 17:21, 26 November 2007 (UTC)
- I can tell this isn't going to be easily resolved. While an example or two is appropriate for any encyclopedia, it's overboard to have 18 examples, followed by 7 more "anti-examples" DD is a useful tool, and may be used or mis-used in many ways. I put in a couple examples in the main text. --Unixguy (talk) 18:51, 27 November 2007 (UTC)
- What I think would be a good compromise if we could find some verifiable sources stating a couple of examples. I had a quick look yesterday, but couldn't find anything really good. On another note, the "Usage" section seems to be a direct copy of the GNU coreutils man page for dd, which is licensed under the GPL, not the GFDL and hence cannot be included here in the essentially unchanged form it is. I'll remove it. Cheers --Pak21 (talk) 09:12, 28 November 2007 (UTC)
- I agree that the examples section was excessive and the anti-examples section superfluous. However the article now perhaps does not do enough justice to the unique possibilities of dd and I would recommend putting some of the examples back. Wikipedia_Dd was actually quite a good resource, as the dd man page is rather minimal and has no good examples. --Theosch (talk) 18:15, 10 December 2007 (UTC)
- I can tell this isn't going to be easily resolved. While an example or two is appropriate for any encyclopedia, it's overboard to have 18 examples, followed by 7 more "anti-examples" DD is a useful tool, and may be used or mis-used in many ways. I put in a couple examples in the main text. --Unixguy (talk) 18:51, 27 November 2007 (UTC)
Gallows humor
Possibly I'm a very unfunny person. Can someone please explain the gallows humor with the dd command and its syntax, as it is currently written in the article? --Abdull (talk) 21:23, 8 February 2008 (UTC)
- It is sometimes jokingly called destroy disk, since one small typo can wipe a disk. Jobarts-Talk 05:57, 23 February 2008 (UTC)
- Top tip; don't copy & paste the wikipedia article to a text file for quick reference, then forget it's in the clipboard and accidentally paste it into a terminal. It can lead to a certain amount of disk thrashing and heart palpitations as the terminal tries to interpret the various DD examples strewn throughout the article. The point of realisation is quite an experience, however, if you're not running a root terminal you'll live. Disk Destroyer indeed :) Tomfin (talk) 13:24, 1 May 2010 (UTC)
Link to a Windows version?
I think it would be nice if someone adds a link to a Windows version of dd. I am looking for a version which has all the options of the Unix dd. Can anybody help me? —Preceding unsigned comment added by Lefter (talk • contribs) 11:00, 26 March 2008 (UTC)
I added a link to a windows version and examples of use some time ago but some well meaning people removed them as they don't think wikipedia should have examples. Well done on ruining the usefulness of this page guys. —Preceding unsigned comment added by 141.228.106.136 (talk) 09:26, 3 July 2008 (UTC)
The Great Zero Challenge
From this site, quoting:
"Q. What is this?
A. A challenge to confirm whether or not a professional, established data recovery firm can recover data from a hard drive that has been overwritten with zeros once. We used the 32 year-old Unix dd command using /dev/zero as input to overwrite the drive. Three data recover companies were contacted. All three are listed on this page. Two companies declined to review the drive immediately upon hearing the phrase 'dd', the third declined to review the drive after we spoke to second level phone support and they asked if the dd command had actually completed (good question)." —Preceding unsigned comment added by 82.243.0.45 (talk) 11:22, 7 September 2008 (UTC)
Learn The DD Command External Reference
This link is to copyrighted material. It is my material, copyrighted by me. I give permission to anyone using Wikipedia to use the linked information in any way he/she sees fit. However, if one uses the material, he/she must not charge money for any derivative writings. [user: AwesomeMachine]
improve text / examples
I just /dev/zero'ed some harddisks and i found out, that the blocksize has a great performance impact
With defautl bs: 15MB/s
With bs=100M: 65MB/s
Maybe also mention that sending SIGUSR1 to gnu dd will make it print progress and writing speed.
Example code:
while sleep 1s; do killall dd -USR1 2> /dev/null; done &
dd if=/dev/zero of=/dev/hdb bs=100M
Disks over 128 GiB
Anonymous editor (Special:Contributions/64.56.224.79) wrote "Removed 137 gigabyte warning, this was a Windows 9x depdency problem."
- Are you saying that 48-bit LBA is only a problem with Windows 9x? That is false. Norton Ghost 2003 doesn't even have support for 48-bit LBA or SATA disks until it is updated (this info is in the Wikipedia article). If this was not clear, this is a direct quote of the Seagate documentation: "Certain disc utilities, such as dd, which depend on low-level disc access may not support 48-bit LBAs until they are updated." Lumenos (talk) 01:35, 8 August 2009 (UTC)
- Seagate is wrong (this may or may not be why they took down the PDF). dd does not do any "low-level disc access" itself; it goes through the kernel on its reads from or writes to the raw device files. (This can be verified with strace.) If your kernel has support for LBA48, then dd will also have support for it. Maybe that's what Seagate meant, but it's not what they said -- and it's not specific to dd. 99.41.222.169 (talk) 02:43, 23 August 2009 (UTC)
Anonymous editor went on to say, "Also, source link document is not available."
- Look, I didn't make this up. If you can't find a link, the first place to look is in the WayBackMachine at archive.org. This documentation happens to be there (I changed the link to it, in the article). However, Wikipedia contains much information that may not be available online. This is not a reason to delete things.Lumenos (talk) 01:45, 8 August 2009 (UTC)
I have personally had problems using dd/gzip on a large SATA hard disk. It appeared that it could not backup and restore the MBR or a Vista partition. Good chance this is not the reason but it is one possibility. I have searched and searched; for evidence that dd supports 48-bit LBA or SATA, and I can find nothing. I would think that we would hear more about it if others were having this problem but it may be sporadic. I did successfully restore using dd/gzip many times, on the same disk I had the problem on. Backups are often not tested until it is too late. I'm one of the few people who restore my backups right after I make them, so I will have the greatest chance of seeing if they have a non-obvious problem. You can find more details on my problem here. Lumenos (talk) 01:45, 8 August 2009 (UTC)
- At the time I wrote that, I had the mistaken idea that the extended partition table was in the MBR. When I restored the MBR with dd, I think I was expecting this to restore the extended partition table as well. My "original research" on this subject should probably be disregarded. Lumenos (talk) 21:03, 7 December 2009 (UTC)
Regardless of our opinions/experiences, Wikipedia's inclusion/exclusion policies state that you must have reliable sources. Please do not remove information from reliable sources. If you have a source that states that dd has support for 48-bit LBA or SATA please add it ALSO and do not delete this info from Seagate; so that we can see both. If you have something from a self-published source (a sorta-expert or something); I wish we could post these things in the Wikipedia but it may be against WP:SPS. You could post it here instead. Lumenos (talk) 01:45, 8 August 2009 (UTC)
- Support has been included in the Linux kernel since at least 2.4.23, released November, 2003. (Search that changelog for "LBA48". Note the "ide-disk.c: Limit disk size to 137GB if LBA48 is not available" entry. LBA48 support was present earlier; I have not found when it was added.) 99.41.222.169 (talk) 02:43, 23 August 2009 (UTC)
- Thank you for looking this up. I read somewhere that 48-bit LBA was an earlier development than SATA, so support for SATA probably came later. But I suppose all that is necessary for this article is to say that Linux dd depends on the the Linux kernel. I don't know about other *nix. Lumenos (talk) 21:03, 7 December 2009 (UTC)
- I plan to invoke WP:IAR to use your comments here as a source for the article. Lumenos (talk) 21:03, 7 December 2009 (UTC)
Recovery-oriented variants of dd
"Also, Linux lacks "raw" disk devices like *BSD has". It is worth noting that while (modern) Linux does not provide raw devices, you can pass the O_DIRECT flag requesting direct access when you are reading/writing a device ( http://www.kernel.org/doc/man-pages/online/pages/man2/open.2.html ). This sidesteps the need for a separate raw device making the paragraph seem incomplete/unnecessary...