Skip to content

Conversation

@DavidVentura
Copy link

@DavidVentura DavidVentura commented Nov 6, 2023

I've had some intermittent issues with some NVMe disks ignoring the partitions I was writing with diskfs.Partition and immediately reading them back.
No amount of syscalls.Sync would make the issues go away, but changing the writing mode to O_SYNC did help.

@DavidVentura DavidVentura changed the title Open disk in O_DIRECT mode when writing Open disk in O_SYNC mode when writing Nov 6, 2023
@deitch
Copy link
Collaborator

deitch commented Nov 9, 2023

Wouldn't that make it terribly slow? It would force all writes not to return until the OS finished flushing to disk, as opposed to the usual disk behaviour.

If it is to address just the partition case, would a flush right after this Write() do it? And does the failure happen in that same function, say here?

@DavidVentura
Copy link
Author

The behavior I am seeing is that a syscall.Sync() call after diskfs.File.Close() is not always enough -- something is not getting flushed. Even when calling ReReadPartitions, we do not see the new partition table take effect.

For me, it is indeed only for the partitioning use-case, which ends up writing very little so this sync behavior is not noticeable.

I'll try to reproduce with a Flush after writing the partition and let you know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants