Updated: 4 November 2026 · Applies to: Odoo 20 on Ubuntu 24.04 LTS (package installation)
An Odoo backup has two parts: the PostgreSQL database and the filestore (attachments, images and documents that Odoo saves as files). If you only save the database, attachments are lost after a restore. Odoo's documentation asks for daily backups of both, copied to a remote location. This guide shows the manual way for a production server and the Database Manager way for small setups.
Find your database and filestore
sudo -u postgres psql -l sudo ls /var/lib/odoo/.local/share/Odoo/filestore
The first command lists your databases. The second shows one folder per database: that is the filestore. On a package installation Odoo's data directory is the home folder of the odoo user, /var/lib/odoo, plus .local/share/Odoo. If the folder is missing, look for a data_dir line in /etc/odoo/odoo.conf.
Back up manually (recommended for production)
- Set the name of your database (replace
yourdb) and a date:DB=yourdb DATE=$(date +%Y%m%d) mkdir -p ~/odoo-backups
- Dump the database in PostgreSQL's compact custom format:
sudo -u postgres pg_dump -Fc $DB > ~/odoo-backups/$DB-$DATE.dump
- Pack the filestore of that database:
sudo tar czf ~/odoo-backups/$DB-filestore-$DATE.tar.gz -C /var/lib/odoo/.local/share/Odoo/filestore $DB
- Pack your configuration file too:
sudo cp /etc/odoo/odoo.conf ~/odoo-backups/odoo.conf-$DATE
- Check the files and copy them to another server or storage:
ls -lh ~/odoo-backups
To run this every night, put the commands in a script and start it from cron; delete backups older than you need. A backup that only exists on the same server does not protect you from losing the server.
Restore manually on a server with Odoo installed
- Stop Odoo:
sudo systemctl stop odoo - Create an empty database owned by the Odoo user and restore the dump into it:
sudo -u postgres createdb -O odoo yourdb sudo -u postgres pg_restore -d yourdb --no-owner --role=odoo ~/odoo-backups/yourdb-YYYYMMDD.dump
If the database already exists, drop it first withsudo -u postgres dropdb yourdb, only when you are sure. - Restore the filestore:
sudo mkdir -p /var/lib/odoo/.local/share/Odoo/filestore sudo tar xzf ~/odoo-backups/yourdb-filestore-YYYYMMDD.tar.gz -C /var/lib/odoo/.local/share/Odoo/filestore sudo chown -R odoo:odoo /var/lib/odoo/.local/share/Odoo/filestore
- Start Odoo:
sudo systemctl start odoo, and log in to check your data and attachments.
Restoring into a newer major version of Odoo does not upgrade the data. Use Odoo's upgrade process for that.
Back up with the Database Manager (small setups)
- Open
/web/database/managerof your Odoo address. It must not be disabled (How to reset the Odoo master password (admin_passwd)?). - Click Backup next to the database, enter the Master Password and choose the format zip (includes filestore).
- Click Backup. Your browser downloads a zip file with the database and the filestore.
- To restore, click Restore Database, choose the file, enter the master password and a name, and confirm.
Odoo's documentation says the Database Manager is not designed for production use and not for large databases, where it may hit memory limits. On a server that is reachable from the internet, switch it off and use the manual method.
Test your backups
A backup you never restored is a guess. Restore into a second database name on a test server every few months and open a few records with attachments.
Frequently asked questions
Is a snapshot of the whole VPS enough?
A snapshot taken while Odoo and PostgreSQL run can be inconsistent. Use it as an extra, and keep the database dumps as the real backup.
How large will the backup be?
The database dump plus all attachments. Check with sudo du -sh /var/lib/odoo/.local/share/Odoo/filestore/yourdb.
Official documentation: Odoo 20 documentation: Deploying Odoo.
Need a server for Odoo, or a hand with the setup?
- Odoo hosting: cloud, VPS or dedicated servers for Odoo.
- KVM VPS with NVMe storage: full root access to install Odoo yourself.
Prefer a hand with the setup? Our engineers can do it for you: Hire an Expert, or use our on-demand server management.