1 (edited by Nameless 2026-10-29 13:48:10)

Topic: Postgres restore - users?

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.7.3
- Deployed with iRedMail Easy or the downloadable installer? Downloadable installer (iRedmail 0.9.X or somesuch)
- Linux/BSD distribution name and version: Debian bullseye
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hello!

On my server I have both postgresql-9.6 and postgresql-13 installed. 9.6 has all my iRedMail data since I installed iRedMail a really long time ago, on version 0.9.X, and have upgraded all the way to 1.7.3 (and plan to upgrade further once I solve this issue).

I would like to move my data to postgresql-13, and since I have the dumps from the daily backup, I'm trying to restore those into postgresql-13. I've found the latest backup, bunzipped some of the files and tried to restore them using the psql command.

However, I don't know how I can restore the user accounts, and that is preventing me from eg. restoring the vmail database, since the dump references the vmailadmin account several times (it's trying to make it the owner of every table it creates).

How can I restore the same users I have on the old database, to the new database? And how can I make sure to move everything into the new database?

I've found the Backup and restore page, but that one seems to only discuss MySQL, and only briefly (I gather from that page that if I was using MySQL, copying the mysql database would copy the users and passwords, but there's no mention of PostgreSQL). Any help is appreciated.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Postgres restore - users?

In the end, I managed to do this by running

# pg_upgradecluster --method=upgrade -v 13 9.6 main

3

Re: Postgres restore - users?

Thanks for sharing the workaround, @Nameless! Using pg_upgradecluster saved me a lot of pain trying to manually dump/restore roles and table ownerships.