bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19065: dd design bug


From: Bob Proulx
Subject: bug#19065: dd design bug
Date: Sun, 16 Nov 2014 12:05:58 -0700
User-agent: Mutt/1.5.23 (2014-03-12)

tag 19065 + unreproducible moreinfo
thanks

bt wrote:
> The following undocumented behavior of dd is (IMO) a design flaw.

If dd actually did this then that would be quite annoying.  And I
could see anyone becoming very frustrated with it.  But the reason
this is not documented in dd is that dd doesn't do this.

> If dd is used to copy one partition to another, as in
> 
> #dd if=/dev/sda3 of=/dev/sdb3 ...
> 
> and if in fact sdb3 does not exist, then dd will overwrite the first part of
> an existing partition *sda1*. 

If this is happening then it is a problem with your operating system
filesystem and not the dd command.  Since dd is simply copying from
one file to another file.  If the destination file is somehow
connected to a different partition then that would be an issue for the
filesystem and not a utility using the file system.

> It doesn't make sense that if the "of=" device doesn't exist, then
> another pre-existing device, not mentioned in the command line, is
> overwritten.  Several websites have incorrect information about the
> behavior of dd in this situation.
> At the very least, this should be documented--maybe I'm missing
> something, but didn't see it in the man pages or the texinfo manual.

What you are missing is that dd in the above is acting just like 
'cp /dev/sda3 /dev/sdb3' or 'cat /dev/sda3 > /dev/sdb3' or other
simple copy commands.  Since dd is simply copying a file it doesn't
know anything about your partitioning.

If /dev/sdb3 does not exist then when dd runs it will create a file
/dev/sdb3 in /dev.  That is simply a file from the perspective of dd
or any other utility.  What handles /dev depends upon your system.
You didn't say what system you were using.  What system are you using?
How is it handling /dev?

What is in your partition table?  There are many different ways to
browse the partition table.  I am not the most proficient with parted
but parted is likely the most capable in the face of newer GPT
formats.  I am perhaps not even likely to be able to interpret the
answer but I think this information would be needed and if not me then
perhaps another may be able to interpret it.

  parted /dev/sdb unit s print

Bob





reply via email to

[Prev in Thread] Current Thread [Next in Thread]