In reply to reference comment commit: > It would be nice to have something more elegant than sleep, any idea? Adding fsync(2) might be superficial when writing to device file, but perhaps it helps ensuring what is meant to write is wrote. In any case it is difficult to think this could make libfdisk worse. Reference: a60d6b52179d851d1d1165a06afa778ac9868107 Signed-off-by: Sami Kerola <kerolasa@xxxxxx> --- libfdisk/src/gpt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index 94b4d292e..49357c449 100644 --- a/libfdisk/src/gpt.c +++ b/libfdisk/src/gpt.c @@ -1978,6 +1978,8 @@ static int gpt_write_partitions(struct fdisk_context *cxt, ssz = write(cxt->dev_fd, ents, towrite); if (ssz < 0 || (ssize_t) towrite != ssz) return -errno; + if (fsync(cxt->dev_fd) != 0) + return -errno; return 0; } -- 2.15.1 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html