3

For various benefits Linux uses a memory cache for writes to removable stogare devices like memory sticks. This cache seems to be quite large on my system, which leads to some annoying behavior. For instance, when I copy an image to the stick, it finishes within seconds, but the following sync takes a couple of minutes, with no process indication. This also makes it harder to do speed measurements or similar things.

I know I can disable the cache with mount -o sync, but as I understand, this is not recommended for flash storage devices. I cannot use mount -o flush because that only works with FAT file systems.

However a simple solution would be to just reduce the cache size to, say, 1 MB. Then sync will always take no longer than a few seconds and when copying large files with tools like pv they would actually show reasonable values (for process bar, transfer speed etc.).

Is there a way to configure the cache size in Linux?

ipsec
  • 233
  • 1
    You can adjust this system wide with the vm.dirty_expire_centisecs sysctl param. However I do not know of a way to do this per-mount. There's a good explanation of what's going on here: http://www.westnet.com/~gsmith/content/linux-pdflush.htm – phemmer Jul 06 '14 at 22:52

0 Answers0