Recovering Corrupted Data.fs ZODB files
Warning: This can trash your Zope installation. Only work on copies of your Data.fs, and make sure you have backups!
Every once in a while you'll corrupt your Zope Data.fs file, and Zope
won't start. Since the Data.fs tacks transactions on to the
end of the Data.fs file, recovering the Data.fs is most likely as easy
as deleting the last transaction or three from the Data.fs.
python lib/python/ZODB/fsrecover.py var/Data.fs
If this doesn't work, or you're using 2.1, here's how to do it yourself, using Ty Sarna's cool tranalyzer:
Lets say the last result we got was:
TID: 331F256472BAFF7 @ 6191877 obs 1 len 7352 (status 'p') By
TID: 331F2566736A2E6 @ 6199245 obs 1 len 8983 (status 'p') By
This means the last transaction started at byte 6199245 and added 8983
bytes to the Data.fs. So lets get rid of
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> f = open("Data.fs", "ab")
>>> # we'll truncate Data.fs so it's length is 6199244 - that's 1 byte less
... # then where the next transaction starts.
That's it! If it still doesn't work, we'll get rid of the next to last transaction, till it starts working.