Re: Mounting USB Storage devices with "sync" option ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mi, 31.01.24 06:43, Fedora Development ML (devel@xxxxxxxxxxxxxxxxxxxxxxx) wrote:

> I created a simple PoC udev rule to mount USB Storage devices with the "sync option.
> Available here : https://github.com/larina3315/personal-stuff/blob/main/linux/10-usb-storage.rules
>
> Currently, USB Storage devices are mounted without the "sync"
> option, causing their writes to be cached.  This causes an issue,
> especially with GUI file managers like GNOME Files, where after a
> file copy operation, it would notify the user that the operation has
> been completed. If the user then tries to unmount the USB Storage
> device, they get notified that data is still being written to disk
> and that they should not remove the USB Storage device from their
> PC/Laptop/device.
>
> This can take a more severe form if the user is using a CLI/GUI
> utility that DOES NOT inform the user that data is still being
> written, like the 'cp' CLI utility, the user might be misled into
> thinking that all writes have finished and plug the USB drive out,
> at which point data corruption due to unfinished writes occur.
>
> This is why, I think functionality should be included in Fedora
> Linux (or atleast in Fedora Workstation and other desktop spins)
> such that USB Storage devices are mounted with the "sync" options by
> default.

This tanks performance when writing to the device though. There's a
much better approach however: use an automount in between with a very
short timeout (2s or so). This means the mount appears continously
available from application PoV but the backing fs is only mounted for
a brief time around accesses. This allows caching and asynchronous
behaviour to work, but after 2s everything is forced out to disk
anyway and it is guaranteed the superblock of the disk is put back
into a clean state.

systemd supports this natively, for example with a simple
"systemd-mount -A /dev/sda1".

I wished the desktop UIs would use this, or that udisks would learn
such a mode too, and in fact default to it.

Lennart

--
Lennart Poettering, Berlin
--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux