securely overwrite files with Python

Skip Montanaro skip at
Fri Mar 5 23:54:44 CET 2004

    >> First: It is not possible. Let me cite some sentences from shred(1):
    >> CAUTION: Note that shred relies on a very important assumption: that
    >> the filesystem overwrites data in place.  This is the traditional way
    >> to do things, but many modern filesystem designs do not satisfy this
    >> assumption.

    Bob> Somewhat OT, Mac OS X 10.3 is one of the operating systems where
    Bob> this assumption is false.  Files smaller than a certain size get
    Bob> automatically moved around on the disk when it makes sense to do so
    Bob> in order to reduce fragmentation.

I'm not sure I understand how that can work.  Suppose I have multiple (hard)
links to a small file named "small".  If the OS moves it around to reduce
fragmentation (implying it will have a different inode next time it's
opened) how does it efficiently track down and change all inode references
to it?  In theory it could keep a cache mapping inode numbers back to the
directories which reference them, but that could consume a fairly large
chunk of memory to maintain.


More information about the Python-list mailing list