Autoflush USB thumb drive after copy
D. Hugh Redelmeier
hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Fri Feb 2 03:57:21 UTC 2007
| From: Lennart Sorensen <lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org>
| On Thu, Feb 01, 2007 at 12:17:54PM -0500, Byron Sonne wrote:
| > If it's gonna behave like that, then ls shouldn't show it as being
| > present until it's committed, like my other disks. Either it's on the
| > bloody stick or it's not.
Your other disks (on Linux) are exactly like the USB stick. If you
remove your hard drive before unmounting, you will get exactly the
same problem. (Power failure has this effect.)
Ditto for floppies.
| Well you could turn of write caching if you don't want performance at
| all, and you could run with it mounted with sync if you don't care about
| the lifespan of the device, in which case yes it will not return until
| it is done writing.
The mount(8) manpage defines sync:
sync All I/O to the file system should be done synchronously.
In case of media with limited number of write cycles
(e.g. some flash drives) "sync" may cause life-cycle
shortening.
With sync, I think that each write(1) operation would have its bits
sent to the device before the system call returned (that's my literal
interpretation). This could be gruesome, depending on the size of the
writes.
One theoretically pure approach would be to never mount the device and
use mcopy to write files (to some kind of FAT filesystem).
But I agree with Lennart that explicit unmounting (perhaps through a
GUI) is the right way to go.
This is also true of floppies. I always thought Apple had the right
idea when they made the eject function be mediated by the OS (unless
you used a paperclip). Now we have USB with that same old problem.
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list