Skip to content

Instantly share code, notes, and snippets.

@edib
Last active February 4, 2022 20:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edib/db1bf3a28c1a88bd9d4800a8adb844c3 to your computer and use it in GitHub Desktop.
Save edib/db1bf3a28c1a88bd9d4800a8adb844c3 to your computer and use it in GitHub Desktop.
Upgrade postgres 9.5 to 11 with pg_upgrade
# See https://wiki.postgresql.org/wiki/Using_pg_upgrade_on_Ubuntu/Debian for more information and warning!
# Check first
/usr/lib/postgresql/11/bin/pg_upgrade \
-b /usr/lib/postgresql/9.6/bin \
-B /usr/lib/postgresql/11/bin \
-d /var/lib/postgresql/9.6/main \
-D /var/lib/postgresql/11/main \
-o ' -c config_file=/etc/postgresql/9.6/main/postgresql.conf' \
-O ' -c config_file=/etc/postgresql/11/main/postgresql.conf' \
-c
# Upgrade with hardlink
/usr/lib/postgresql/11/bin/pg_upgrade \
-b /usr/lib/postgresql/9.6/bin \
-B /usr/lib/postgresql/11/bin \
-d /var/lib/postgresql/9.6/main \
-D /var/lib/postgresql/11/main \
-o ' -c config_file=/etc/postgresql/9.6/main/postgresql.conf' \
-O ' -c config_file=/etc/postgresql/11/main/postgresql.conf' \
-k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment