Technical Lab · 0057

Odoo Backup, Restore & Disaster Recovery Bangladesh — because "we never had a problem" is not a backup strategy.

I have helped Bangladesh businesses recover from Odoo data loss. The pattern is always the same: the backup was "being done" by someone who was doing it manually, inconsistently, to a local drive that was on the same server that failed. This guide describes what to back up, how to automate it, where to store it in Bangladesh's infrastructure context, and — critically — how to verify that your backup actually works before you need it.

Bangladesh-Specific Risk Factors

Bangladesh presents a set of infrastructure risks that make a robust backup strategy more important than in more stable environments. Being aware of these risks is the first step to designing a backup architecture that addresses them.

Power Instability

Load shedding, voltage fluctuations, and sudden power cuts remain common even in Dhaka industrial and commercial areas. Sudden shutdown during a database write can corrupt a PostgreSQL database. UPS + generator is not optional for production Odoo servers.

Cyclone & Flood Risk

Chittagong and coastal factory areas face cyclone risk. Dhaka has significant flooding risk in low-lying areas. On-premise servers in affected zones can be physically destroyed. Off-site backup must be geographically separate.

Theft & Fire

Server room security is inconsistent in Bangladesh SME premises. A single server rack in a ground-floor office with the database and backup drive in the same room is a single-point-of-failure scenario that ends businesses.

Internet Reliability

If Odoo is cloud-hosted and internet is down, operations stop entirely. On-premise Odoo with local backup continues operating during internet outages. Factor this into your hosting decision.

Human Error

The most common cause of data loss worldwide — including Bangladesh. An Odoo admin accidentally deletes a product category. A developer runs a migration script on production instead of staging. A well-tested restore process protects against these scenarios.

NBR Audit Requirement

Bangladesh tax law requires businesses to maintain financial records for a minimum of 5 years. An Odoo server failure that destroys accounting history creates legal compliance exposure, not just operational disruption.

A backup that has never been tested is not a backup — it is a hope. Test it monthly. Your disaster recovery is only as good as your last successful restore drill.

What Needs to Be Backed Up in Odoo

Odoo data lives in two distinct locations. Both must be backed up. Backing up only one leaves you with an incomplete, non-restorable state.

1. PostgreSQL Database
Contains all structured data: every transaction, journal entry, sale order, manufacturing order, stock move, user record, and configuration. This is the core of your Odoo installation. Location on server: PostgreSQL data directory (typically /var/lib/postgresql/ on Ubuntu). This is backed up with pg_dump.

2. Filestore
Contains all file attachments: scanned documents, uploaded invoices, product images, report templates, email attachments, and any binary file stored in Odoo. Location on server: /var/lib/odoo/filestore/[database-name]/. This must be backed up separately from the database. The filestore is not included in a PostgreSQL dump.

Critical

Many Bangladesh IT administrators back up only the PostgreSQL database and forget the filestore entirely. If you restore a database without its matching filestore, all file attachments (uploaded documents, product images, email attachments) will show as broken. For most Bangladesh businesses, 6–36 months of scanned documents and vendor invoices live in the filestore. Both components must be backed up together.

Manual Backup: Odoo Database Manager

Manual

Browser-Based Backup via Database Manager

Odoo's built-in database manager provides the simplest backup method. Navigate to https://your-odoo-server/web/database/manager (or click the gear icon on the login page → Manage Databases).

  1. Click the Backup icon next to your database name.
  2. Choose format: zip (recommended — includes database dump + filestore in one file) or dump (database only, no attachments).
  3. Click Download. Odoo generates the backup and downloads it to your browser.

The resulting zip file contains everything needed to restore the Odoo instance on any compatible server. Store it immediately to a location other than the same server.

When This Is Not Enough

Manual browser backup is only acceptable for: testing environments, very small databases (<500MB), or supplementary weekly backup by non-technical staff. For production Odoo with live business data, you need automated backup (pg_dump + cron) that runs without human intervention and does not depend on anyone remembering to click a button.

Automated Backup: pg_dump + Cron

Recommended for Production

Automated PostgreSQL Backup Script

The following bash script backs up your Odoo database using pg_dump, compresses it, and deletes backups older than 30 days. Place it at /opt/odoo-backup/backup.sh and make it executable (chmod +x /opt/odoo-backup/backup.sh).

backup.sh — automated Odoo database backup
#!/bin/bash
# Odoo Database Backup Script for Bangladesh Production Servers
# Place in /opt/odoo-backup/backup.sh

DB_NAME="your_odoo_database"
DB_USER="odoo"
BACKUP_DIR="/opt/odoo-backup/db"
FILESTORE_DIR="/var/lib/odoo/filestore/${DB_NAME}"
FILESTORE_BACKUP_DIR="/opt/odoo-backup/filestore"
DATE=$(date +%Y-%m-%d_%H-%M)
KEEP_DAYS=30

# Create backup directories if they don't exist
mkdir -p "${BACKUP_DIR}" "${FILESTORE_BACKUP_DIR}"

# 1. Dump PostgreSQL database
pg_dump -U "${DB_USER}" -Fc "${DB_NAME}" \
    -f "${BACKUP_DIR}/${DB_NAME}_${DATE}.dump"

# 2. Backup filestore (incremental with rsync)
rsync -a --delete \
    "${FILESTORE_DIR}/" \
    "${FILESTORE_BACKUP_DIR}/"

# 3. Remove database dumps older than 30 days
find "${BACKUP_DIR}" -name "*.dump" -mtime +${KEEP_DAYS} -delete

# 4. Log completion
echo "$(date): Backup completed — ${DB_NAME}_${DATE}.dump" \
    >> /var/log/odoo-backup.log
Schedule with cron — run daily at 2:00 AM Bangladesh time
# Edit cron: sudo crontab -e -u odoo
# Add this line:
0 2 * * * /opt/odoo-backup/backup.sh

Why 2:00 AM: Bangladesh business hours are 9 AM – 6 PM. A 2 AM backup minimises impact on any overnight batch jobs and captures a full day's transactions. Adjust if your factory runs night shifts — run the backup in the lowest-activity window.

Verify the Script Works

Run the script manually the first time and verify: (a) the .dump file is created in /opt/odoo-backup/db/; (b) the filestore files are synced to /opt/odoo-backup/filestore/; (c) the log entry appears in /var/log/odoo-backup.log. Set up a monitoring alert (email notification on cron failure) so you know immediately if the backup stops running.

Filestore Backup: Do Not Skip This

The Odoo filestore grows continuously as users upload documents, send email with attachments, and save reports. For a Bangladesh company that has been live for 2–3 years, the filestore may contain 5–50GB of business documents including scanned vendor invoices, signed contracts, quality certificates, and export documents.

The rsync approach in the script above maintains an incremental backup — only changed and new files are copied each night, making it fast even for large filestores. Alternatively, if you are sending the backup off-site, use tar -czf to compress the filestore directory into a single archive.

Create a compressed filestore archive (for off-site upload)
tar -czf "/opt/odoo-backup/filestore_${DATE}.tar.gz" \
    -C "/var/lib/odoo/filestore" "${DB_NAME}"

# Upload to cloud storage (example: AWS S3)
aws s3 cp "/opt/odoo-backup/filestore_${DATE}.tar.gz" \
    "s3://your-backup-bucket/odoo-filestore/"

Off-Site Storage for Bangladesh Businesses

A backup on the same server or same building as your Odoo installation is not a disaster recovery solution — it is just a copy that will be lost in the same incident. Off-site means physically and logically separate from your primary server.

Recommended

AWS S3 Singapore — Closest Cloud to Bangladesh

AWS S3 in the ap-southeast-1 (Singapore) region is the closest major cloud storage to Bangladesh — approximately 40–60ms latency from Dhaka. It is the recommended off-site backup destination for Bangladesh businesses due to proximity, reliability (99.999999999% durability), and straightforward pricing.

  • Cost: $0.023/GB/month for standard storage. A typical 2-year Odoo installation with 20GB of data + 5GB filestore costs approximately $0.58/month. Daily database dumps at 1GB/dump, 30-day retention ≈ 30GB ≈ $0.69/month. Total: under BDT 200/month.
  • Payment: AWS accepts international Visa/Mastercard. Some Bangladesh banks block international subscription payments — try a Visa debit card from BRAC Bank, Dutch-Bangla Bank, or City Bank if your primary card is declined.
  • Setup: Create an S3 bucket in Singapore region, create an IAM user with write-only access to that bucket, store the access key in your server environment, use aws s3 cp in your backup script.
Configure AWS CLI on Ubuntu (one-time setup)
sudo apt install awscli
aws configure
# Enter: AWS Access Key ID, Secret Access Key
# Default region: ap-southeast-1 (Singapore)
# Default output: json
Budget Option

Backblaze B2 — Cheapest Object Storage Globally

Backblaze B2 charges $0.006/GB/month — 4× cheaper than AWS S3. No Bangladesh latency issues for backup uploads (latency matters less for backup than for live access). Excellent choice for large filestore backups. Use the b2 CLI or the S3-compatible API (Backblaze B2 is S3-compatible, so the same aws s3 cp command works with a different endpoint URL).

Bangladesh Local

Fiber@Home / BTCL NaDC — Data Sovereignty Option

For Bangladesh businesses with data sovereignty requirements (government contracts, healthcare, financial services), using a Bangladesh-based data center for off-site backup keeps data within the country. Fiber@Home and BTCL National Data Center (NaDC) offer object storage and dedicated server colocation in Dhaka. Contact their enterprise sales teams for pricing — typically more expensive than AWS Singapore but may be required for compliance.

Backup Retention Policy & NBR Requirements

Frequency Retention Period Storage Location Purpose
Hourly (pg_dump) 48 hours Local server only Fast recovery from human error (accidental deletion in the last 2 days)
Daily (pg_dump + filestore) 30 days Local + off-site cloud Primary operational backup. Covers most failure scenarios.
Weekly (full zip backup) 6 months Off-site cloud Recovery from slowly-discovered data corruption or deletion
Monthly (full zip backup) 5 years Off-site cloud + cold storage NBR audit compliance — Bangladesh tax law requires 5-year record retention
NBR Compliance Note

Under Section 35 of the Income Tax Ordinance 1984 and related VAT regulations, Bangladesh businesses must maintain financial records for 5 years. Your Odoo database is a financial record. Deleting database backups older than 6 months creates a compliance gap. Monthly backups going back 5 years must be retained. S3 Glacier or Backblaze B2 are cost-effective cold storage options — the monthly backup volumes are small, and costs over 5 years are minimal.

Odoo.sh Backup Management

If your Odoo is hosted on Odoo.sh (Odoo's official cloud hosting), the backup situation is different from self-hosted. Odoo.sh automatically backs up your database daily and retains backups according to your plan tier. You do not need to write pg_dump scripts.

What to check and configure on Odoo.sh:

Restore Procedure: Step by Step

  1. Stop Odoo Service On the target server, stop Odoo before restoring to prevent write conflicts: sudo systemctl stop odoo
  2. Create New Database (for test restore, not production) Never restore over your production database until you have confirmed the backup is valid on a test database: sudo -u postgres createdb odoo_restore_test
  3. Restore the pg_dump File Use pg_restore for custom format dumps: sudo -u postgres pg_restore -d odoo_restore_test /opt/odoo-backup/db/your_backup.dump. For plain SQL dumps: sudo -u postgres psql odoo_restore_test < your_backup.sql
  4. Restore the Filestore Copy the filestore backup to match the new database name: cp -r /opt/odoo-backup/filestore/ /var/lib/odoo/filestore/odoo_restore_test/. Ensure the directory name matches the database name exactly — Odoo uses the database name to find the correct filestore directory.
  5. Update odoo.conf for the Test Database In /etc/odoo/odoo.conf (or your Odoo config file), update db_name to the restore test database name. Start Odoo: sudo systemctl start odoo
  6. Verify the Restore Log in to the restored database. Check: (a) recent transactions are present; (b) file attachments open correctly (click a document attachment on a sale order); (c) the accounting reports show correct figures. If all three pass, your backup is valid.

Restoring from Odoo Database Manager zip file (simpler method):
Navigate to /web/database/manager → Restore → upload the zip file → enter a new database name → click Restore. Odoo handles both database and filestore restoration automatically from the zip.

The Monthly Restore Drill: Why It Matters

A backup you have never tested is not a backup — it is an assumption. Backup files can be corrupted. The restore process can fail due to version mismatches. The filestore can be missing from the archive. You only discover these failures when you need the backup most.

The monthly drill procedure:

  1. On the first working day of each month, take last week's backup file.
  2. Restore it to a test database on a separate machine or a staging environment.
  3. Log in, verify 3 random recent records, check one file attachment.
  4. Record the result (success/failure, time taken, issues found) in a log document.
  5. Drop the test database and delete the test filestore directory.

The entire drill takes 20–30 minutes. It verifies that your backup is valid, that your team knows the restore procedure, and that the restore process works within your Recovery Time Objective (the maximum downtime your business can tolerate).

Recovery Time Objective for Bangladesh SMEs

For most Bangladesh manufacturing and trading companies, a Recovery Time Objective (RTO) of 4–8 hours is acceptable for most failure scenarios. This means: if your server fails at 9 AM, you need Odoo restored and operational by 1 PM (or by the next morning at worst). Your restore drill should demonstrate this is achievable. If it takes 6 hours to restore, you need either faster infrastructure or a hot standby server.

Disaster Recovery Planning for Bangladesh Businesses

A backup is a component of disaster recovery, not a complete plan. A disaster recovery plan answers the question: "If our Odoo server is completely destroyed at 10 AM on a Tuesday, how do we restore operations — and by when?"

Write a one-page DR document that answers:

For the infrastructure decision between on-premise and cloud that underpins all of this, the On-Premise vs Cloud Odoo guide covers the Bangladesh-specific trade-offs. And for the access rights configuration that determines who can trigger a database restore, the Odoo User Access Rights guide covers how to restrict database manager access to administrators only.

Backup & DR Audit

If your Bangladesh business does not have a tested, automated backup strategy for Odoo — or if you have never actually restored a backup — I can audit your current setup and implement a proper backup and DR plan. Contact me for a backup audit →

Frequently asked questions

How do I back up my Odoo database in Bangladesh?

Two methods: (1) Simple — use Odoo's database manager at /web/database/manager, click Backup, choose zip format (includes database + filestore), download the file. Manual, no automation. (2) Automated — use pg_dump on the server combined with rsync for the filestore directory, scheduled via cron. For production Odoo, automated pg_dump is required — manual backups will eventually be missed.

How long should Bangladesh businesses keep Odoo backups?

NBR requires financial records for 5 years under Bangladesh tax law. Keep: daily backups for 30 days, weekly backups for 6 months, monthly backups for 5 years. Store monthly backups off-site. Daily and weekly backups can be on your primary server plus one off-site location. Never rely on a single location for any backup tier.

What are the best off-site backup options for Bangladesh businesses?

AWS S3 Singapore (ap-southeast-1) is the closest and most reliable cloud option — approximately BDT 150–300/month for typical Odoo backup volumes. Backblaze B2 is 4× cheaper if cost is the priority. For data sovereignty (government or regulated industries), Fiber@Home or BTCL NaDC keep data within Bangladesh. All three accept standard payment methods available to Bangladesh businesses.

How do I restore an Odoo backup?

For a zip backup from database manager: go to /web/database/manager → Restore → upload the zip file → choose a new database name → click Restore. For pg_dump: create a new database, run pg_restore -d new_db backup.dump, copy the filestore backup to /var/lib/odoo/filestore/new_db/, restart Odoo. Always restore to a test database first — verify data integrity before restoring over production.