storaged-project / udisks

The UDisks project provides a daemon, tools and libraries to access and manipulate disks, storage devices and technologies.
https://storaged.org/doc/udisks2-api/latest/
Other
345 stars 142 forks source link

Mount exfat filesystems with the sync option by default #1177

Open kotarou3 opened 1 year ago

kotarou3 commented 1 year ago

Removable drives are frequently formatted with the vfat and exfat filesystems

Currently vfat filesystems are mounted with the flush option by default: https://github.com/storaged-project/udisks/blob/060c9492d616f5b5287e834b50297e414c52f166/data/builtin_mount_options.conf#L4 This results in the write buffer being flushed frequently, so writes of large files end up being throttled to the disk's write speed (rather than RAM), resulting in accurate write speed indications in userspace and a speedy unmount

Flushing the write buffer frequently is especially important for removable drives with slow write speeds because:

Unfortunately, exfat doesn't support the flush option at the moment, so the closest would be sync, which flushes every write. So please consider updating the default mount options on exfat to use the sync mount option

tbzatek commented 8 months ago

I'm not totally convinced to use sync by default, it's very expensive. Of couse the current status is not good either.

As @vojtechtrefny pointed out, there might be a way to limit the dirty buffer for a particular device - see /sys/class/bdi/<bdi>/max_bytes. However, this feature has only been added in kernel 6.2 (the exfat filesystem driver was added in 5.7): https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=00df7d51263b46ed93f7572e2d09579746f7b1eb https://lore.kernel.org/all/20221119005215.3052436-6-shr@devkernel.io/