Subject: Re: bug#7420: [Feature request]: add option to dd to fsync|fdatasync after each block written

From: Pádraig Brady <[email-masked]>
Date: Sun, 25 Jan 2015 17:51:45 +0000

unarchive 7420
tag 7420 notabug
close 7420
stop

On 17/11/10 10:19, Марк Коренберг wrote:
> [Feature request]: add option to dd to fsync|fdatasync after each block written
> 
> Suppose I want to show progress with:
> 
> pv image.img | dd bs=16M of=/dev/sdc
> 
> it will not work, as dd will write to sdc momentarily. dd will hang on
> close(1) waiting for actual write to complete (tested on USB stick
> Linux 2.6.32)
> 
> I decide to use  oflag=direct. It help, OK. But: http://kerneltrap.org/node/7563
> 
> It will be nice if, dd will be able to fsync/fdatasync after each block.
> 
> I think, it is useful for other usages.

This is useful.
However supporting functionality was added to the next kernel version 2.6.33
Or rather O_SYNC ad O_DSYNC were properly distinguished: http://lwn.net/Articles/350225/
Both options were available to through dd long before that.
In summary dd oflag=dsync should now do exactly as you expect.

thanks,
Pádraig.