Last active
November 24, 2025 10:19
-
-
Save isDipesh/ec1d36b8cdd4a1f81dc2171ef588c04a to your computer and use it in GitHub Desktop.
Postgres cluster upgrade for new Postgres version on Arch linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # If postgis is used | |
| yay -S postgis-old-upgrade | |
| sudo su | |
| systemctl stop postgresql | |
| mv /var/lib/postgres/data /var/lib/postgres/olddata | |
| mkdir /var/lib/postgres/data /var/lib/postgres/tmp | |
| chown postgres:postgres /var/lib/postgres/data /var/lib/postgres/tmp | |
| sudo su postgres | |
| cd /var/lib/postgres/tmp | |
| # Use --no-data-checksums if pg was initialized without page checksums | |
| initdb -D /var/lib/postgres/data --locale=C.UTF-8 --encoding=UTF8 --no-data-checksums | |
| # Replace 18 with old pg version number | |
| pg_upgrade -b /opt/pgsql-18/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data | |
| systemctl start postgresql | |
| psql -f update_extensions.sql | |
| ./delete_old_cluster.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment