Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Last active September 21, 2020 18:24
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 jlsherrill/2d42c75dc8ca0ac5ce9fb2137c2586ed to your computer and use it in GitHub Desktop.
Save jlsherrill/2d42c75dc8ca0ac5ce9fb2137c2586ed to your computer and use it in GitHub Desktop.
importing older postgresql
#mount large filesystem (200GB) onto /mnt/
setenforce 0
cd /mnt/
tar -xzf pgsql_data.tar.gz
#link /var/lib/pgsql from /mnt
mv /var/lib/pgsql/ /var/lib/pgsql.bak
ln -s /mnt/var/lib/pgsql/ /var/lib/
# move scl postgresql to /mnt
mkdir -p /mnt/var/opt/rh/rh-postgresql12/lib/
mv /var/opt/rh/rh-postgresql12/lib/pgsql/ /mnt/var/opt/rh/rh-postgresql12/
ln -s /mnt/var/opt/rh/rh-postgresql12/pgsql/ /var/opt/rh/rh-postgresql12/lib/
mv /var/opt/rh/rh-postgresql12/lib/pgsql/data /var/opt/rh/rh-postgresql12/lib/pgsql/data.bak
chown postgres:postgres /var/opt/ -R
rpm -e rh-postgresql12-postgresql-syspaths rh-postgresql12-postgresql-server-syspaths
yum install postgresql-server.x86_64
vi /etc/systemd/system/postgresql.service
systemctl restart postgresql
systemctl status postgresql #should be running
foreman-installer
#optinoally remove pre-migrated db to save space
rm -rf /mnt/var/lib/pgsql/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment