'How to pg_upgrade with an User-defined Data-Directory
Running PostgreSQL on MANJARO, the actual /var/lib/postgres/data/postgresql.conf defines my Data-Directory:
data_directory = '/mnt/Data/.../PostgreSQL'
Now I'm facing the upgrade from PostgreSQL 13 to 14 and I'm thinking to use pg_upgrade, as described in the Arch-Wiki.
The Step 4.) described there is pretty clear, but is it also sufficient for my data_directory = '/mnt/Data/.../PostgreSQL' or do I need to take additional actions?
Furthermore, I'm thinking to have versioned directories, e.g.
/var/lib/postgres/data/14/
/mnt/Data/.../PostgreSQL/14/
What should I consider to realize that? Thank you!
Solution 1:[1]
When running pg_upgrade, point the --old-datadir and --new-datadir options to the directories that contain postgresql.conf (not to the actual data directories). I admit that this is confusing; however, the documentation says:
-d configdir--old-datadir=configdirthe old database cluster configuration directory; environment variable
PGDATAOLD
Note that the wording is “cluster configuration directory”, not “data directory”.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Laurenz Albe |
