Re: pen-drive write cache turning off
LeVA wrote:
Hi!
I'm using linux kernel 2.6.11.6, and I have a pendrive (usb 1.0, the slower
one ;). When I copy stuff to it, or delete stuff from it, it happens quickly.
But after I umount it, my cpu usage is getting high, and I can see on my
pendrive's led, that my system is now performing the read/write transactions.
My question is: can I control this write cache thru some /proc file, or with
command line, or mount option, or kernel .config variable, or that's just the
way it is, and I have to wait minutes after umounting my pendrive, so I can
disconnect it?
Add "sync" to the mount options.
/dev/cardreader1 /media/cardreader1 auto
user,rw,noauto,sync,noatime,quiet 0 0
The default is async, the behaviour that you describe.
The automagic udev/hal/dbus/gnome-volume-manager/etc system uses sync
but if you provide a rule with a symlink and an fstab entry with a
mountpoint you need to specify the options yourself.
Of course, with this mode, the copy operation is syncronous and will
block and not return until complete, but then the unmount will be quick.
So, you can wait now or you can wait later, but the wait is the same.
Depending on people's habits, there may be slightly less tendency for
people to unplug the device before the write operation is complete with
the sync option since it's more obvious (depending on what is doing the
writing) that the copy operation is still active (ie a copy operation on
the command line, emacs, etc, doesn't return until complete).
Lastly, the mount man page can be interpreted as suggesting that sync
might not work for vfat filesystems but I just ran a test and it does. I
think when they say "some Linux filesystems" they indeed mean LINUX
filesystems IE vfat is not a Linux filesystem so the sync/async options
work.
...RickM...
Reply to: