Funky file contents when os.rename or os.remove are interrupted

Russell Warren russandheather at gmail.com
Wed Oct 11 12:28:23 EDT 2006


Thanks, guys... this has all been very useful information.

The machine this is happening on is already running NTFS.

The good news is that we just discovered/remembered that there is a
write-caching option (in device manager -> HDD -> properties ->
Policies tab) available in XP.  The note right beside the
write-cache-enable checkbox says:

"This setting enables write caching to improve disk performance, but a
power outage or equipment failure might result in data loss or
corruption."

Well waddya know...  write-caching was enabled on the machine.  It is
now disabled and we'll be power-cycle testing to see if it happens
again.

Regarding the comment on journaling file systems, I looked into it and
it looks like NTFS actually does do journaling to some extent, and some
effort was expended to make NTFS less susceptible to the exact problem
I'm experiencing.  I'm currently hopeful that the corrupted files we've
seen are entirely due to the mistake of having write-caching enabled
(the default).

> Then, Windows has nothing to do with it, either. It calls the routines
> of the file system driver rather directly.

It looks like that is not entirely true... this write-caching appears
to sit above the file system itself.  In any case, it is certainly not
a Python issue!

One last non-python question... a few things I read seemed to vaguely
indicate that the journaling feature of NTFS is an extension/option.
Wording could also indicate a simple feature, though.  Are there
options you can set on your file system (aside from block size and
partition)?!  I've certainly never heard of that, but want to be sure.
I definitely need this system to be as crash-proof as possible.

Thanks again,
Russ




More information about the Python-list mailing list