dd question (from man page)

Cameron Simpson cs at zip.com.au
Mon Nov 17 22:03:07 UTC 2014

On 17Nov2014 13:22, Rick Stevens <ricks at alldigital.com> wrote:
>On 11/17/2014 11:28 AM, jd1008 issued this missive:
>> Man page says:
>> ...
>>        fdatasync
>>               physically write output file data before finishing
>>        fsync  likewise, but also write metadata
>> There is no explanation about this, as dd is supposed to be agnostic
>> about the type of the data.
>> If a disk is being dd'ed  out to a file and the disk is mounted,
>> (which is a BAAAAD thing to do), then even there, dd is agnostic
>> about FS data and FS metadata.
>> So, what data and metadata is the manpage talking about?
>I believe it's referring to LVM or BIOS RAID metadata.

Not at all. dd neither knows nor cares about the underlying disc metaphor 
(RAID, whatever). These two terms refer to the fdatasync and fsync system 
calls; see "man 2 fdatasync" and "man 2 fsync". To quote from the fdatasync 
manual entry:

    fdatasync() flushes all data buffers of a file to disk (before the system
    call returns).  It resembles fsync() but is not required to  update the
    metadata such as access time.

and has some followon discussion.

Cameron Simpson <cs at zip.com.au>

Never attribute to malice that which can be attributed to stupidity.
- Hanlon's Razor

More information about the users mailing list