Two things must be saved together: the database and the filestore. Missing one gives you records without attachments, or files without records.
What to back up
- PostgreSQL dump:
pg_dump -Fc -f mydb.dump mydb - Filestore:
~/.local/share/Odoo/filestore/mydb(checkdata_dirin your config) odoo.confand any custom addons folder
How often
Daily is the minimum. Keep 7 daily, 4 weekly, 3 monthly. Store at least one copy on a different machine or provider.
Restore test (do this monthly)
createdb restore_test
pg_restore -d restore_test mydb.dump
cp -r filestore/mydb ~/.local/share/Odoo/filestore/restore_test
odoo -d restore_test --stop-after-init
Then open it and check: can you log in, open an invoice, and download an attachment?
Common mistakes
- Backing up the database only
- Keeping the backup on the same disk as the server
- Never opening the restored copy
If the restore test fails, you just learned it for free. Learning it during an outage costs much more.