On Thu, Sep 05, 2024 at 11:25:33AM +0200, Thomas Schmitt wrote:
> Hi,
> 
> to...@tuxteam.de wrote:
> > This is exactly why I'm always trying to "sell" the "oflag=sync" option of
> > dd. You are going to write each block exactly once, then plop the medium
> > out. So whithout, it'll take you 10 sec, with it'll take you as much. But
> > it's more transparent with, because without, the OS is flushing cache in
> > the background.
> 
> I let xorriso-dd-target use
>   bs=1M oflag=dsync
> with the dd run which copies the ISO image. Not only to minimize the time
> of the final sync command but also to get realistic numbers from
>   status=progress
> which elsewise reports fantastic write speeds in the beginning and then
> looks quite erratic when the kernel decides to write data to the USB stick
> before buffering more of the data sent by dd.
> 
> What i experienced as puzzling in the documentation was the difference
> between oflag=dsync and oflag=sync (not to be confused with conv=sync).
> The info document of dd is more verbous than the man page but still not
> really helpful in this aspect:
> 
>   ‘dsync’
>        Use synchronized I/O for data [...]

>   ‘sync’
>        Use synchronized I/O for both data and metadata.

[...]

> When writing to a device file, neither its length nor timestamp are of
> importance for the resulting state of the USB stick [...]

That was my take, too: in the "USB stick" case, there's practically no
difference. And when writing to a file, I'll happily take the hit of
updating the metadata too for consistent results.

So I decided to burden my dwindling memory with one letter less :-)

> change during writing and the timestamp vanishes with the device file
> when the stick gets unplugged.
> Nevertheless i add a standalone sync command to the last dd run of
> xorriso-dd-target, just to care for any other remaining buffered data
> e.g. from zeroizing the potential GPT backup header at the end of the
> USB stick.

You know far more about those innards than I can hope too :-)

> Michael Stone wrote:
> > It's a waste of time
> 
> My experience with or without bs=1M oflag=dsync is like the sniffles:
> They last seven days with a doctor and a week without.

The sticks I've used (and the CPU and what not) are *much* faster with
bs=1M than with the default (512, with bs). The oflag=sync is more about
predictability, as you write above.

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature

Reply via email to