cancel
Showing results for 
Search instead for 
Did you mean: 

Easy way to change Data Directory

SOLVED
Adventurer

Easy way to change Data Directory

Hi All,

I'm still learning the slight differences between postgres and EDB.  I need to move the data directory location due to how the partitions were setup on my linux development machine.   Attached is a screen shot of the mount points.  Specifically i need to move everything to /home as the mount point.  I attempted to update the data_dictionary with the file path, didnt' work, i cp -R -p all data conents, and updated the new postgres.conf file, and that did not work.  I believe i'm not doing this correctly.  Can someone point me to the correct process?Screen Shot 2017-08-09 at 3.41.24 PM.png

1 ACCEPTED SOLUTION

Accepted Solutions
EDB Team Member

Re: Easy way to change Data Directory


montereyray wrote:

Hi All,

I'm still learning the slight differences between postgres and EDB.  I need to move the data directory location due to how the partitions were setup on my linux development machine.   Attached is a screen shot of the mount points.  Specifically i need to move everything to /home as the mount point.  I attempted to update the data_dictionary with the file path, didnt' work, i cp -R -p all data conents, and updated the new postgres.conf file, and that did not work.  I believe i'm not doing this correctly.  Can someone point me to the correct process?Screen Shot 2017-08-09 at 3.41.24 PM.png


If you have updated the postgresql.conf with new location of Data_directory then server should start. What error you are getting when you are attempting to start? Also check the new location of the data_directory has "postgres" user permission. 

 

--Raghav

3 REPLIES
Moderator

Re: Easy way to change Data Directory

Here are the steps, the major difference between what you might have done and what I have stated is using rsync instead of copy::

 

1. Stop Postgres

2. sudo rsync -av /olddatadirectory /newdatadirectory

3. update the data_directory path in the postgresql.conf

4. Restart Postgres

 

If this still does't work, can you share the error message.

 

Thanks, Amit

EDB Team Member

Re: Easy way to change Data Directory


montereyray wrote:

Hi All,

I'm still learning the slight differences between postgres and EDB.  I need to move the data directory location due to how the partitions were setup on my linux development machine.   Attached is a screen shot of the mount points.  Specifically i need to move everything to /home as the mount point.  I attempted to update the data_dictionary with the file path, didnt' work, i cp -R -p all data conents, and updated the new postgres.conf file, and that did not work.  I believe i'm not doing this correctly.  Can someone point me to the correct process?Screen Shot 2017-08-09 at 3.41.24 PM.png


If you have updated the postgresql.conf with new location of Data_directory then server should start. What error you are getting when you are attempting to start? Also check the new location of the data_directory has "postgres" user permission. 

 

--Raghav

Highlighted
Level 3 Traveller

Re: Easy way to change Data Directory

Hi all,

 

Sorry for interfering in this thread.

 

One small issue I faced apart from this, and my postgres cluster was not getting started.

Then I modified the data_directory key in postgres-reg-ini file, and started the cluster.

 

Anba,

Chennai