PostgreSQL on OpenWrt

PostgreSQL on OpenWrt is mostly like PostgreSQL on many Linux servers.

The default location for the PostgreSQL database on OpenWrt is /var/postgresql/data which is on a RAM disk (tmpfs) and goes away on every reboot. We want to change that.

  1. Prepare your persistent storage and set it to automatically mount on every boot (fstab). For this guide we assume you mount the storage on /srv.
  2. service postgresql stop
  3. Edit /etc/config/postgresql so that `PGDATA` points to /srv/postgresql/data
  4. mv /var/postgresql /srv/
  5. service postgresql start
  6. Verify postgresql is running (E.g. via ps w / pgrep) and logread
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2025/12/01 07:27
  • by danielfdickinson