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

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


Solution 1:

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?