Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

  1. Stop PostgreSQL
  2. Copy data from old folder to new folder:

    cp old_directory new_directory
    
  3. Change data path to new folder:

    sudo gedit /etc/postgresql/9.3/main/postgresql.conf
    
  4. 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

share|improve this question
1  
what is written after the ':'? there it shows you the error. – dezso Oct 16 '15 at 14:21
2  
My guess is that the problem is permissions related. If /home/USER is chmod 700 (which it should be) and USER != postgres then it won't work. Does the data directory need to be under /home/USER ? – gsiems Oct 16 '15 at 17:00

Sounds like you didn't change the PGDATA environment variable, so postgres is looking in the original (no-longer-there) directory.

Try this: http://stackoverflow.com/a/32575527/3657905

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.