13

Does dd act at the filesystem level or go to the raw device directly?

2
  • dd works on device level.
    – Pilot6
    Sep 15, 2015 at 9:01
  • 1
    It depends on what you mean exactly. Technically it always reads the filesystem, or it wouldn't be able to determine, for one, the permissions of the regular file / device file or whatever is put to work on.
    – kos
    Sep 15, 2015 at 9:44

1 Answer 1

17

dd works on whatever you chose it to work on.

You can take the terminal streams (stdin and stdout), or anything represented by a file descriptor as in- and output of dd.

And as almost everything on Linux has a file descriptor, you can use files, directories, character devices (e.g. /dev/null, /dev/random), block devices (e.g. partitions/file systems like /dev/sda1 or directly entire disks like /dev/sda).

As you can see, dd is a pretty powerful and versatile tool, but make sure you use it with caution as it's also known as "disk destroyer" if you accidentally use it with unintended arguments.

If you're interested in more information about dd, read its manpage (run man dd) or look for example at Answer to "dd vs cat — is dd still relevant these days?" (Unix&Linux.SE) or What does the command name "dd" stand for?

7
  • Is dd powerful in itself or mostly takes advantage of the fact that as almost everything on Linux has a file descriptor?
    – A.L
    Sep 15, 2015 at 13:37
  • @A.L Good question, I don't really know. You could look at its source code probably if you're interested. But does it matter?
    – Byte Commander
    Sep 15, 2015 at 13:40
  • No, that was just nitpicking about the assumption dd is a pretty powerful and versatile tool.
    – A.L
    Sep 15, 2015 at 13:41
  • 1
    Check your command 5 times and write it on a piece of paper and check it another 5 times. Mixing up IF and OF is instant destruction of potentially a lot of data.
    – Nelson
    Sep 15, 2015 at 13:52
  • 3
    dd has some nice features, but the most time it is used in ways which would work equally well with cp, cat, the shell ... in this answer some things which are hard without dd are listed. But dd if=/dev/sda of=/mnt/ext/backup can better be done with cat /dev/sda > /mnt/ext/backup for example
    – Josef
    Sep 15, 2015 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .