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

"Martin v. Löwis" martin at v.loewis.de
Wed Oct 11 06:53:28 CEST 2006


Russell Warren schrieb:
> Any insight from someone with knowledge of the internal operations of
> os.remove and/or os.rename would be greatly appreciated, although I
> expect the crux may be at the os level and not in python.

Just to confirm what others have said: Python has nothing to do with
that. It calls the relevant Win32 API rather directly.

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

It's the FAT file system that may suffer from metadata corruption in
case of power loss. If you lose power on a disk that has a FAT file
system on it, you need to run chkdsk before using the file system
again, and you *still* may see corruption. As others have said:
use NTFS if you want a reasonable chance of getting in a clean state
in case of a power loss.

Regards,
Martin



More information about the Python-list mailing list