How to migrate the PostgreSQL data directory
Check the current installed data directory
[ec2-user@ip-192-168-93-151 ~]$ psql -h 192.168.28.223 -U postgres -d postgres
Password for user postgres:
postgres=# SHOW config_file;
config_file
-------------------------------------
/var/lib/pgsql/data/postgresql.conf
(1 row)
postgres=# SHOW data_directory;
data_directory
---------------------
/var/lib/pgsql/data
(1 row)