You are not logged in.

#1 2015-03-10 01:40:48

Resistance
Member
Registered: 2012-09-04
Posts: 26

[SOLVED]Dd question.

Hi,
I seem to be confused about a dd command I saw in the Wiki (https://wiki.archlinux.org/index.php/Se … e_manually).

It is my understanding that to write to a partition (using dd), we have at least two possibilites :

dd [...] of=/dev/sdxN
dd [...] of=/dev/sdx seek=NB 

where NB is the number of bytes, relative to the start of the device, at which the partition begins (this is the number under the "Start" column of "fdisk -l", yes ? The man page of fdisk doesn't seem to explain its output).

Therefore, the following command

dd if=data_source of=/dev/sdXA bs=512 count=3839709184 seek=2048 

is incorrect as it would skip 2048 bytes from the beggining of the partition A of /dev/sdX.

Please do explain if (and so where) I am mistaken (I mean, if there's one command whose behavior one should understand, it's dd's, right ?).

Thank you.

Last edited by Resistance (2015-03-10 16:12:57)

Offline

#2 2015-03-10 02:22:51

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: [SOLVED]Dd question.

While I carefully read your post, let me just say STOP

dd is an extremely dangerous command.  Many have quipped that it means destroy data.   Do not experiment with this command with any disk you would not use to scrape mud off of your shoe.

What are you trying to do?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2015-03-10 02:27:10

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: [SOLVED]Dd question.

.... But yes, I think I agree with everything you wrote.  But using an offset from the start of the physical device to get inside a logic volume scares the hell out of me.  Please make sure that any data on that physical drive about which you might care is backed up.


Edit....   OTOH, if this is a your concern, I recommend a sledge hammer or a thirty aught-6 round.

Last edited by ewaller (2015-03-10 02:34:00)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2015-03-10 03:17:09

Resistance
Member
Registered: 2012-09-04
Posts: 26

Re: [SOLVED]Dd question.

Thank you for reply.

Indeed, cautiousness can not be stressed enough when using dd.

The purpose of this command is explained on the Wiki page linked in the OP ; I read it to solve some other unrelated issue and tried to correct the command when I encountered it, but my edit got reverted back (see https://wiki.archlinux.org/index.php?ti … on=history).

Not sure how I should deal with this (just leaving it wouldn't be right, now, would it ?).

Last edited by Resistance (2015-03-10 03:20:14)

Offline

#5 2015-03-10 03:26:37

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: [SOLVED]Dd question.

Oh, I don't know.   Give it a day then call it closed.  I am always amazed what the members of this forum present.  It just takes us a day as we are pretty well spread over the globe.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#6 2015-03-10 09:03:02

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [SOLVED]Dd question.

I also think you are right, but instead of removing the seek, you should remove the A in /dev/sdXA. That section only talks about calculating and using this offset. If you then suddenly use dd without any offset, that's just confusing -- you'd have to rewrite some more to explain these two ways of using dd (or just remove this calculation completely because it seems unnecessarily complex, but perhaps it's somehow better than using /dev/sdXA?).

And maybe you could contact the user who reverted your change or discuss this on the "talk" page?

Offline

#7 2015-03-10 16:13:22

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [SOLVED]Dd question.

Resistance wrote:

Therefore, the following command

dd if=data_source of=/dev/sdXA bs=512 count=3839709184 seek=2048 

is incorrect as it would skip 2048 bytes from the beggining of the partition A of /dev/sdX.

The command will skip 2048 blocks of size 512, which would make sense if it were of=/dev/sdX instead of of=/dev/sdXA

Anyway, the examples have been modified since and everything looks kosher now.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#8 2015-03-10 16:45:27

nstgc
Member
Registered: 2014-03-17
Posts: 393

Re: [SOLVED]Dd question.

ewaller wrote:

Edit....   OTOH, if this is a your concern, I recommend a sledge hammer or a thirty aught-6 round.

If this is the case, then they already have your data so there is no point in either of those solutions.

Offline

#9 2015-03-10 17:01:12

bstaletic
Member
Registered: 2014-02-02
Posts: 658

Re: [SOLVED]Dd question.

Ok, dd just got a little bit scarier in my eyes. Why would anyone use

dd ... of=/dev/sdX seek=N bs=M

instead of

dd ... of=/dev/sdxy bs=M

The first option seems more error prone.

Offline

Board footer

Powered by FluxBB