For context, I'm on kernel 6.1, so using post-5.7 in-tree exFAT kernel drivers.
Currently, if I plug in an exFAT-formatted flash drive and write to it, it will write to a RAM cache and flush to flash slowly. This is not great because to userspace applications (and therefore the user), it seems like writing has completed, until you try to unmount the drive (or more accurately, the partition) and umount (or udisksctl) hangs. What's worse is if the user is unaware of this behaviour and has the bad habit of not unmounting before unplugging, it just causes silent data corruption.
So I would very much like to disable this caching behaviour. From reading man mount, there's surprisingly no mention of exFAT at all. Under the "Mount options for fat" section, there is the flush option. But if I understand correctly, this section is not applicable to exFAT because exFAT is handled by the exfat driver, which is distinct from the vfat driver which handles the likes of FAT16 and FAT32.
Indeed, if I try to mount my exFAT partition using the flush option, it simply errors:
# sda1 is my exFAT partition
$ udisksctl mount -b /dev/sda1 -o flush
Error mounting /dev/sda1: GDBus.Error:org.freedesktop.UDisks2.Error.OptionNotPermitted: Mount option `flush' is not allowed
So is disabling write cache simply not supported by the exfat drivers currently? If no, are there any workarounds?
mount -o syncshould workexfatdriver supports that :-/man mountbut that’s not conclusive. Looking at the source code, it definitely honoursIS_DIRSYNCfor sure (that’s-o dirsync), and I see it checksSB_SYNCHRONOUSandIS_SYNC(-o sync) in a couple of places, so it should be OK.