Occasionally I need to copy big files to relatively slow USB sticks.
(Usually ISO images to my pendrive with Ventoy to install an OS somewhere or run a rescue mission. BTW if you are still using stuff like Rufus or dd for that purpose, check out Ventoy, it's awesome)
And for a long time, a pet peeve of mine was that the big file was copied "instantly", but then unmounting that pendrive took forever with no progress bar. I'd much rather have a real progress bar that shows how fast the stick actually writes.
After some research, I learned that Linux happily lets gigabytes of dirty data pile up in RAM before it starts throttling the program doing the writing. So the file manager thinks the copy is done when really it’s just sitting in memory, and unmount has to flush all of it. So I made a udev rule that sets a 16 MB limit on dirty cache for USB disks:
# /etc/udev/rules.d/90-usb-dirty-limit.rules
ACTION=="add", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", ENV{ID_BUS}=="usb", RUN+="/bin/sh -c 'echo 1 > /sys/class/bdi/%M:%m/strict_limit; echo 16777216 > /sys/class/bdi/%M:%m/max_bytes'"
16 MB of dirty cache should be plenty for most pendrives (and it's the limit of data the OS will "pretend" to have instantly copied). If you regularly use a fast USB SSD you might want a bigger number there like 128 MB, since a tiny buffer can cost some throughput on really fast drives.