Question: The Postgres data_directory is showing a value via the SHOW data_directory command. postgres=# SHOW data_directory; data_directory ------------------------ /var/lib/postgres/data (1 row) How can I change the database directory to another directory? Answer: The steps below are a standard approach. The steps will vary according to specific requirements, and may require a more customised approach Step 1 - Identify current data directory path SHOW data_directory; Step 2- Stop Postgresql services systemctl status systemctl stop Step 3 - create a blank directory on the target path e.g mkdir /mydirectory/data --change ownership to the postgres user , for example chown postgres:postgres...
Read more →