Steve Litt <sl...@troubleshooters.com> wrote:

> I did a test. I created hello.txt, put "hello world" in it, saved it,
> and yanked out the thumb three seconds later. Of course the
> whole /media/sdd1 tree vanished. When I plugged in the thumb again,
> hello.txt contained exactly what I'd typed in it. Now of course, this
> is an anecdote, not a mathematical proof or a statistical study, but it
> does point to the possibility that sometimes all your stuff gets
> written to the thumb and everything's OK when you yank.

Timing is everything.
When you write data to disk, it initially goes into the write cache as a dirty 
page. Unless the user (or their program) explicitly syncs that out, then there 
it sits until ...
The cache gets written out when the background system processes clean up and 
write the dirty pages out to disk. How long this takes depends on tuneable 
kernel parameters and how busy the system is. If the system, and in particular 
the storage, is otherwise idle then IIRC your small file will get written 
almost instantly. If the system is really busy, with a large dirty cache, then 
it'll take a lot longer.
As another test, try running "cat /dev/zero > /media/sdxn/testfile" then save 
your new file and immediately pull the drive.

This page seems to be a decent writup :
http://www.westnet.com/~gsmith/content/linux-pdflush.htm


It's not something I've every fiddled with on Linux, but I do recall hearing an 
"interesting" tale of a SCO Openserver admin who didn't know what a process was 
and got rid of it. This was the cache flushing daemon - and he found out the 
hard way, when the system crashed, what it did ...

_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to