I have a problem with the moving of my data directory of PostgreSQL. I found many different ways, but none worked. The most sensible way for me was:
- Stop PostgreSQL
Copy data from old folder to new folder:
cp old_directory new_directory
Change data path to new folder:
sudo gedit /etc/postgresql/9.3/main/postgresql.conf
Change ownership of the folder to postgres
chown -R postgres DIRECTORY
--> checked afterwards, worked
restart postgresql -->
* Error: could not exec /usr/lib/postgresql/9.3/bin/pg_ctl /usr/lib/postgresql/9.3/bin/pg_ctl start -D /home/USER/pg_data/9.3/main -l /var/log/postgresql/postgresql-9.3-main.log -s -o -c config_file="/etc/postgresql/9.3/main/postgresql.conf" :`
What can I do?
I am using Ubuntu 14.04 LTS with PostgreSQL 9.3