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

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

 



On Wed, Jan 31, 2024 at 06:43:00AM -0000, Abyss Ether via devel 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.

'sync' has some strong downsides though: various operations become
painfully slow (this depends a lot on the hardware and its age, and
the history of previous writes, etc.), write operations block read
operations, and the total number of writes may be increased, leading
to more wear&tear on the hardware.

We approach this problem from a different angle: the user is supposed
to sync the filesystem before removing. Graphical environments have
an "eject" button, and for non-graphical environments, the user
just needs to do a sync manually.

> 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.

The same is true for "normal" writes to a harddrive. Operations are
generally async, and the user needs to do a shutdown, during which
we sync and unmount filesystems. If you "yank" the cord, this may (*)
result in lost data and file system inconsistency.

Zbyszek


(*) There are extensive mechanisms to avoid loss of data, so
    "may" does not mean it's likely.
--
_______________________________________________
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