Link to home
Start Free TrialLog in
Avatar of missymadi
missymadi

asked on

What are the steps to move an existing data directory in Postgres9?

Experts,

            I have an existing database located on /loc/data. I want to move the data directory to it's own partition. What are the steps to accomplish this task? I have tried numerous configurations such as stopping the db, moving the db to /data then exporting PGDATA to /data. The server will not connect thorugh PGADMIN.
How do I get PGADMIN to see the PGDATA files? What are all of the config files if any that need to  be changed? Do I need to run initdb? I did try this and recieved an error that there was data in the directory. Do I need to initdb then move the data over?

Please advise, Missymadi
ASKER CERTIFIED SOLUTION
Avatar of lcohan
lcohan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of missymadi
missymadi

ASKER

That's not quite what I'm asking for....I need to move my /loc/data postgres directory to a partioned /data drive. I have tried several suggestions (i.e. moveing data to partioned drive, using export  PGDATA=/data/DATA restart server.....not working
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is what I tried to do:

su abc
pg_ctl stop
exit
su (to root)
mv /opt/co/DATA/* /data
exit
su abc
pg_ctl start

PGADMIN connection refused. There is nothing in the log!!
I don't know where else to look to solve this.
Thanks, Missymadi
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i gave the experts credit for helping me. I think initially the problem was a permissions issue. Then I found that I could do a symlink that was less complicated. The database restarted after many tests.