Backing up and packing Plone's database file (Data.fs)

Backing up the database

See “Backup Plone” and “Backup and recover Data.fs in linux” in Plone’s documentation.

Additional notes:

  • Recent versions of Repozo can compress (gzip) the backup files in addition to doing incremental backups.
  • When doing full backups, Repozo behaves exactly as using cp to copy Data.fs, except it uses ZODB’s code to determine where the last finished transaction is and therefore do not copy unfinished transactions at the end of Data.fs.
  • Zope’s ZODB can use multiple “storages” (think of it as something like database backends). It comes with FileStorage (i.e. storing everything in Data.fs). DirectoryStorage is an alternative that is supposingly easier and faster to back up incrementally.

Packing the database

Packing a database throws away old object versions (generated by undo actions) from the database. To pack a database:

Go to Zope’s admin panel, under Control Panel → Database → [database name, e.g. main], choose how much undo info to keep, and click “pack”. Note: Data.fs.old will contain a copy of the database file before packing.

(There is a Zope product called PloneMaintenance that can do scheduled backup, although I have not tried it yet.)