LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Learn the DD command (https://www.linuxquestions.org/questions/linux-newbie-8/learn-the-dd-command-362506/)

onebuck 04-11-2012 09:01 AM

Member response
 
Hi,

Quote:

excerpt from 'man dd';
of=FILE
write to FILE instead of stdout
So;
Code:

dd if=/dev/sda5  of=/media/discoduroexterno/imagenes/partitionimage.dd
Plus you can look earlier in this thread for examples. Or look further down and see the suggested threads.

rknichols 04-11-2012 10:28 AM

Quote:

Originally Posted by JZL240I-U (Post 4650111)
The standard output shows only printed characters and not the full range of hexadecimal values, ...

Where on Earth did you get an idea like that? In the absence of an "of=" argument, dd writes exactly the same data to stdout as would have gone to the "of=" file. Yes, if that output goes to a terminal you will see garbage, but redirecting to a file should be fine.

@RagonichaFulva: Does that 47GB size of the image file match the size of the original sda5 partition? That "bad geometry" message suggests that the original file system was 285GB. Was the original filesystem type really ext4? What does the file command report as the type of the partitionimage.dd file, i.e., the output from
Code:

file partitionimage.dd

RagonichaFulva 04-11-2012 10:33 AM

I can't assure it, but I'd say that the partition was bigger than 47 GBytes.

I'll check the file command and paste the output.

Thanks for your assistance.

rknichols 04-11-2012 12:46 PM

Quote:

Originally Posted by RagonichaFulva (Post 4650259)
I can't assure it, but I'd say that the partition was bigger than 47 GBytes.

That would be most unfortunate. The image file should be exactly the same size as the original partition. If that was really an ext4 file system, it would also be useful to see the output from
Code:

tune2fs -l partitionimage.dd

JZL240I-U 04-12-2012 02:15 AM

Quote:

Originally Posted by rknichols (Post 4650252)
Where on Earth did you get an idea like that? In the absence of an "of=" argument, dd writes exactly the same data to stdout as would have gone to the "of=" file. Yes, if that output goes to a terminal you will see garbage, but redirecting to a file should be fine...

Simple. When you write it to stdout, the driver for your graphic card will interpret it to display it on your screen. So you lose in due course lots of data / information. That is at least what I reasoned. Do I understand you all right that stdout can circumvent the graphics driver?

TobiSGD 04-12-2012 05:35 AM

Quote:

Originally Posted by JZL240I-U (Post 4650787)
Simple. When you write it to stdout, the driver for your graphic card will interpret it to display it on your screen. So you lose in due course lots of data / information. That is at least what I reasoned. Do I understand you all right that stdout can circumvent the graphics driver?

There is no circumvention needed. Data written to stdout is, if not redirected, "translated" by the shell into characters and control codes (like color codes, the beep, ...) and then displayed. The graphics card drivers will not interpret characters displayed on screen.

JZL240I-U 04-12-2012 05:39 AM

Quote:

Originally Posted by TobiSGD (Post 4650896)
...Data written to stdout is, if not redirected, "translated" by the shell into characters and control codes (like color codes, the beep...

Okay, so it is not the graphics driver but the shell which does the pruning -- or does it? I mean, is there a difference in the files when created via ">" as opposed to "of="?

TobiSGD 04-12-2012 06:23 AM

Quote:

Originally Posted by JZL240I-U (Post 4650901)
I mean, is there a difference in the files when created via ">" as opposed to "of="?

No, when stdout is redirected the shell does not interpret it.

JZL240I-U 04-16-2012 06:36 AM

I confess I doubted you but you stand vindicated ;): I "dd"ed my 125 MB boot partition with ">" and "of=" and then ran sha256sum on both files: They are identical. Ah, well, it was a nice theory of mine as long as it lasted. Kudos to all participants involved in relieving the darkness of my ignorance ;) and thanks for the ongoing instructions on LQ.

TobiSGD 04-16-2012 08:25 AM

Hey, we all are learning. It is good to see that you take a reasonable route to get rid of your doubts. Some members could learn from that.

greasedupdeafguy 04-17-2012 09:53 AM

Hi, can someone help me explain this command in detail?

dd if=/dev/hda of=/mnt/diska/cd-001.dd

I am having a hard time explaining the of= part.

Thx

JZL240I-U 04-17-2012 09:57 AM

Code:

man dd
:rolleyes:. Umm, sorry. "of=" stands for the output file = (is, or rather will be) the following path (/mnt/diska/) and filename (cd-001.dd)...

greasedupdeafguy 04-17-2012 10:18 AM

Quote:

Originally Posted by JZL240I-U (Post 4655138)
Code:

man dd
:rolleyes:. Umm, sorry. "of=" stands for the output file = (is, or rather will be) the following path (/mnt/diska/) and filename (cd-001.dd)...

thx, so if I would say that this command creates a duplicate of the (hda) and then places it at /mnt/diska/ with the filename cd-001.dd I would be right? My first thought was that this created a dd file on the mounted cd-rom but thats totally wrong?

Satyaveer Arya 04-17-2012 10:23 AM

Quote:

of=/mnt/diska/cd-001.dd
cd-001.dd would be the filename you're giving in /mnt/diska directory which you've mounted under /mnt/ where you want to save the data of /dev/hda.
Am I right? Please make me correct if I'm wrong.

JZL240I-U 04-17-2012 11:23 AM

Quote:

Originally Posted by greasedupdeafguy (Post 4655157)
thx, so if I would say that this command creates a duplicate of the (hda) and then places it at /mnt/diska/ with the filename cd-001.dd I would be right?

Yes it duplicates all, including the internal structures of the disk (master boot record, partition table, all partitions including empty space (if so ordered)).

Quote:

Originally Posted by greasedupdeafguy (Post 4655157)
My first thought was that this created a dd file on the mounted cd-rom but thats totally wrong?

Yes. It does not burn a CD (but it could write to a CD-RW).


All times are GMT -5. The time now is 12:03 AM.