This is a constant annoyance I have with my Manjaro systems, and with Linux in general. It seems that whenever my desktop environment (Plasma) mounts removable devices, such as flash drives or SSDs, for some reason it thinks it’s a good idea to cache writes to it. Is there a way to disable this?
What I’m trying to prevent from happening are two things:
data loss if the drive was removed without ejecting/unmounting
Misleading “write speed” displays and progress bars.
I don’t usually mount my removable devices via command line, so I’m not sure if this also happens if I mount it that way. Also, I still want write-caching for internal drives.
I’ve tried hdparm method and it didn’t work for me.
I was copying large files from HDD to USB sticks that had 10-20 Mb/s write speeds.
Without any udev rules applied plasma showed absolutely insane speeds like 600-800 Mb/s. With hdparm udev rule applied shown speeds were about 200 Mb/s, which equals to reading speed of my HDD. Sync udev rule produced basically the same result (~ 200 Mb/s).
Method that worked for me was usb-dirty-pages-udev. It shows accurate write speeds for USB sticks and as soon as copiyng progress bar reaches 100% flash drives can be safely removed immediately. Although that method requires kernel >= 6.2.
And all udev rules require USB disks to be automounted to work.