Hi Dan,
> I am trying to find out if there is any step by step instruction to reconcile old data dir and upgraded data dir
afterusing “—link” option to do an upgrade.
>
> I ran this to do an upgrade from 11.5 to 12.1: pg_upgrade -d /hostname/pg/dev115/data -D /hostname/pg/dev121upg/data
--link-b /pgdbadevbal800/pg/PostgreSQL-11.5/bin -B /pgdbadevbal800/pg/PostgreSQL-12.1/bin -p 1432 -P 2432 –v
>
> postgresdbad:dev115:pgdbadevbal800:> pwd
> /hostname/pg
>
> postgresdbad:dev115:pgdbadevbal800:> du -sh dev121upg
> 2.3G dev121upg
>
> postgresdbad:dev115:pgdbadevbal800:> du -sh dev115
> 22G dev115
>
> My goal is to be able to do an in place upgrade from 11.5 to 12.1 using the same data dir “/hostname/pg/dev115/data”.
Without the “—link” option I need to double up the space usage for the instance. What is the easiest way to accomplish
thistask?
>
> Thanks so much for your help.
after a successful upgrade, you may delete the dev115 directory and move the dev121upg directory in its place. That's
howI usually do it. Something like this example:
(DB = cluster name)
/data/pg/DB/db <= PGDATA old
/data/pg/DB/dbnew <= PGDATA new, do the initdb here!
initdb -k -D /data/pg/DB/dbnew ...
pg_upgrade -d /data/pg/DB/db -D /data/pg/DB/dbnew ...
pg_ctl -D /data/pg/DB/dbnew stop
rm -rf /data/pg/DB/db
mv /data/pg/DB/dbnew /data/pg/DB/db
pg_ctl -D /data/pg/DB/db start
Your milage may vary. Use at your own risk. ;-)
If you shut down a PostgreSQL cluster properly, you can then easily move PGDATA to virtually any place you want and
startit there because PostgreSQL doesn't keep references to absolute paths anywhere.
Cheers,
Paul