LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 08-24-2010, 09:43 AM   #646
djbelieny
LQ Newbie
 
Registered: Aug 2010
Posts: 1

Rep: Reputation: 0
Outstanding !


Great post, the most comprehensive dd tutorial ever.
Thank you
 
Old 08-24-2010, 11:54 PM   #647
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: LFS-Version SVN-20091202, Arch 2009.08
Posts: 1,496

Rep: Reputation: 68
I had a quick question about this particular modifier, conv=notrunc. What exactly does this do as the man page is a bit sketchy about it? In the past I have created disk images of dvd's and even hard drives and have never had issues with them.

Anyone shed some light on why it would be needed and possible ramifications if it is not used?
 
Old 08-25-2010, 09:03 AM   #648
vsurlan
Member
 
Registered: Jun 2004
Location: Zagreb, Croatia
Distribution: Debian Lenny
Posts: 49

Rep: Reputation: 15
Is it just me or does it really look like a link to the manual page for dd would fit nicely in the original post as well?

Something like: Manual page for dd would be perfect.
 
Old 08-27-2010, 01:52 AM   #649
mariapeter12
LQ Newbie
 
Registered: Jun 2010
Posts: 9

Rep: Reputation: 0
Good tutorial about DD command in linux but we should not forget that the incorrect use of the DD command may Cause Data loss in Linux So proper care must be taken while using this Powerful Command.
 
Old 09-01-2010, 02:52 PM   #650
tiekookeit
LQ Newbie
 
Registered: Jan 2009
Location: Brazil
Distribution: debian
Posts: 16

Rep: Reputation: 1
just AWESOME
 
0 members found this post helpful.
Old 09-06-2010, 12:56 AM   #651
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
Smile At Least Try It ...

Quote:
Originally Posted by archtoad6 View Post
I seem to only be posting corrections, sorry. ...

From the bash man page (search for "metacharacter"):


This means that the '>' separates words on the CLI the same as a space does, & therefore putting spaces around a '>' is NOT necessary for the command to work.

Furthermore, that is also my personal experience.

Anyone who wants to can test this by comparing the results of the following 2 commands:
Code:
>space_test0
> space_test1
Each will create an empty file in the current directory.

I DO generally put a space before '>' for clarity, especially if it's in a code snippet that I'm going to post. (See my post #361 above.)
OK, archtoad,

Do it the way you want. But if you don't even try what I said then don't post that you don't know how to do it. The > is a redirect operator. Why don't you just try what I said?

Last edited by AwesomeMachine; 09-17-2010 at 09:56 AM.
 
0 members found this post helpful.
Old 09-06-2010, 01:23 AM   #652
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
Post Notrunc ...

Quote:
Originally Posted by exvor View Post
I had a quick question about this particular modifier, conv=notrunc. What exactly does this do as the man page is a bit sketchy about it? In the past I have created disk images of dvd's and even hard drives and have never had issues with them.

Anyone shed some light on why it would be needed and possible ramifications if it is not used?
exvor,

This is a popular subject. The conversion parameter, notrunc, tells dd not to truncate the output file. This applies if the output file currently exists.

If you want to write a sector of 0xffh bytes to the beginning of an existing file:

Code:
dd if=/dev/zero bs=512 count=1 | sed 's,\x00,\xff,g' | of=/home/sam/existing.file
will replace the entire file with 512 0xffh bytes, leaving the file 512 bytes long and eliminating the preexisting contents.
Code:
dd if=/dev/zero bs=512 count=1 | sed 's,\x00,\xff,g' | of=/home/sam/existing.file conv=notrunc
tells dd to just replace the specified bytes and leave the rest of the output file alone. Without this option, dd would create an output file 512 bytes long.

Last edited by AwesomeMachine; 09-06-2010 at 02:49 AM.
 
Old 09-07-2010, 08:53 PM   #653
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: LFS-Version SVN-20091202, Arch 2009.08
Posts: 1,496

Rep: Reputation: 68
Ahh ok that makes sense now.
 
Old 09-26-2010, 02:29 AM   #654
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
Smile I'll try again.

Quote:
Originally Posted by vsurlan View Post
Is it just me or does it really look like a link to the manual page for dd would fit nicely in the original post as well?

Something like: Manual page for dd would be perfect.
Hi vsurlan,

I actually put a link to the htmlized man page, but when I saved the whole post it was too large and the system refused to save, so I had to cut out some new content and that got cut. If you look at the second post the man page is written out pretty much verbatim.
 
Old 10-15-2010, 02:15 AM   #655
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,688

Rep: Reputation: Disabled
Creating analogs for /dev/zero as input for dd...

Hi AwesomeMachine and other knowledgeable persons .

How is /dev/zero working? I mean what mechanism tells dd to use an endless stream of binary zeros e.g. for an input file in dd if=/dev/zero ... ? I can't imagine that the zeros truly get freshly created for more than one blocksize (bs) -- or do they?

Reason for my inquiry (apart from the joy in generalized knowledge) is this: last night I wiped an old 10 GB disk with "dd if=/dev/urandom of=/dev/sdb". That took more than 1 1/2 hours on my old 700 Mhz Athlon.

After this experience my idea was to first create a file of, say, 1 MB of random data and then using this block of data repeatedly as input for dd. Would that be possible and how would one go about that?
 
Old 10-15-2010, 09:35 AM   #656
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
Quote:
Originally Posted by JZL240I-U View Post
How is /dev/zero working?
My understanding is that the device driver behind the device responds to the read request by writing zeros.

Quote:
Originally Posted by JZL240I-U View Post
Would that be possible and how would one go about that?
you could use something like:

Code:
while true
do
  cat filewithrandomdata
done | dd of=/dev/sdb
HTH.
-RN.
 
Old 10-18-2010, 02:44 AM   #657
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,688

Rep: Reputation: Disabled
Quote:
Originally Posted by rn_ View Post
My understanding is that the device driver behind the device responds to the read request by writing zeros....
How wasteful . I mean, creating once the necessary block of zeros and then never increasing the address pointer would do admirably without pestering the CPU for zeros. Ah well...

Quote:
Originally Posted by rn_ View Post
...you could use something like:...
Thanks, I copied that and will try it next time.

<edit> Okay, I tried it. It still took close to an hour. While it is an improvement it still is nothing like fast. CPU-load stayed at 100%. </edit>

Last edited by JZL240I-U; 10-21-2010 at 08:49 AM.
 
Old 10-18-2010, 03:11 AM   #658
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,356

Rep: Reputation: 135Reputation: 135
Nice article,very much helpful
 
Old 10-18-2010, 09:13 AM   #659
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
Quote:
Originally Posted by JZL240I-U View Post
How wasteful . I mean, creating once the necessary block of zeros and then never increasing the address pointer would do admirably without pestering the CPU for zeros. Ah well...
perhaps that's exactly what it does; i wouldn't know because i haven't seen the code, and if i did, i doubt if i'd be able to make heads or tails of it.
 
Old 10-18-2010, 09:50 AM   #660
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,451
Blog Entries: 4

Rep: Reputation: 1505Reputation: 1505Reputation: 1505Reputation: 1505Reputation: 1505Reputation: 1505Reputation: 1505Reputation: 1505Reputation: 1505Reputation: 1505Reputation: 1505
Hi,

You can always 'man command';

Quote:
excerpt 'man null';
NAME

null, zero - data sink DESCRIPTION

Data written on a null or zero special file is discarded. Reads from the null special file always return end of file, whereas reads from zero always return \0 characters.
null and zero are typically created by:

mknod -m 666 /dev/null c 1 3
mknod -m 666 /dev/zero c 1 5
chown root:mem /dev/null /dev/zero

NOTES

If these devices are not writable and readable for all users, many programs will act strange. FILES

/dev/null
/dev/zero SEE ALSO

chown(1), mknod(1)
 
  


Reply

Tags
backup, best, clonezilla, cloning, command, data, dd, disk, drive, duplicate, erase, explanation, formatting, ghost, hard, image, iso, memory, ping, popular, recover, recovery, rescue, search, security, stick, upgrade, usb, wipe


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Learn The DD command AwesomeMachine Linux - Newbie 17 08-17-2006 05:22 AM
The best way to learn? iz3r Programming 7 02-07-2005 12:00 AM
Best way to learn Linux from the command line patpawlowski Linux - General 2 03-01-2004 04:37 PM
I want to learn C. KptnKrill Programming 14 12-18-2003 02:03 PM
Best way to learn.... InEeDhElPlInUx Linux - Newbie 5 10-11-2003 02:02 AM


All times are GMT -5. The time now is 10:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration