GNU bug report logs - #51345
dd with conv=fsync sometimes returns when its writes are still cached

Previous Next

Package: coreutils;

Reported by: Sworddragon <sworddragon2 <at> gmail.com>

Date: Sat, 23 Oct 2021 09:20:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Sworddragon <sworddragon2 <at> gmail.com>, 51345 <at> debbugs.gnu.org
Subject: bug#51345: dd with conv=fsync sometimes returns when its writes are still cached
Date: Sat, 23 Oct 2021 13:55:19 +0100
On 23/10/2021 09:18, Sworddragon wrote:
> On Knoppix 9.1 with the Linux Kernel 5.10.10-64 x86_64 and GNU Coreutils
> 8.32 I wanted to overwrite my USB Thumb Drive a few times with random data
> via "dd if=/dev/random of=/dev/sdb bs=1M conv=fsync". While it usually
> takes ~2+ minutes to perform this action dd returned once after less than
> 60 seconds which made me a bit curious. On a later attempt dd returned with
> this command after ~1 minute again but the LED on my USB Thumb Drive was
> still blinking and an immediated executed sync on the terminal blocked for
> ~1 minute and once it returned the LED on my USB Thumb Drive also stopped
> blinking.
> 
> Knoppix 9.1 was booted as a live system from a DVD and the only another
> persistent storage attached to it was an internal HDD which was already
> overwritten the same way via a past booting session.
> 
> 
> Unfortunately Linux is not my main operating system anymore so I randomly
> encountered this issue on a nearly 1 year old distribution which might be
> slightly outdated. But the issue is pretty severe as it can lead to
> significant data loss so it is worth at least reporting it (and having the
> "bad" behavior to always call sync after dd nonetheless will probably now
> continue to stay for quite a while).
> 

Well we're relying on the kernel here to not return from fync()
until appropriate.  You could try running the following immediately after,
to see if it also returns quickly:

  blockdev --flushbufs /dev/sdb

Note a subsequent `sync /dev/sdb` would probably not be effective,
since that would only consider data written by theh sync process
(which would be nothing).

cheers,
Pádraig




This bug report was last modified 3 years and 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.