#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    5
    Rep Power
    0

    Unhappy Unable to restart PostgreSQL server after changing data directory


    Hi all,

    I have got stuck with this issue.On my production server the disk on which data directory was located got filled completely so i planed to move data directory to new disk mounted on the server.I took following steps for this
    1)stopped db server
    2)copied data directory to new location.
    3)changed pgdata parameter in script at /etc/init.d
    4) restarted the server

    the status of startup comes ok but server doesn't get started and no errors are coming.

    i also tried to start server manually using -D option but all in vein
    Permission on new directory are appropriate.(correct).
    I did same thing on other servers where this thing is working fine but on one of the server this issue is occurring ..please help me

    If i am reverting the changes and using old data directory then server is running fine again.help me
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2011
    Posts
    23
    Rep Power
    0
    Originally Posted by akthakur
    Hi all,

    I have got stuck with this issue.On my production server the disk on which data directory was located got filled completely so i planed to move data directory to new disk mounted on the server.I took following steps for this
    1)stopped db server
    2)copied data directory to new location.
    3)changed pgdata parameter in script at /etc/init.d
    4) restarted the server

    the status of startup comes ok but server doesn't get started and no errors are coming.

    i also tried to start server manually using -D option but all in vein
    Permission on new directory are appropriate.(correct).
    I did same thing on other servers where this thing is working fine but on one of the server this issue is occurring ..please help me

    If i am reverting the changes and using old data directory then server is running fine again.help me
    First, make sure that $PGDATA is set correctly in the user environment. If it points to the old directory then all applications (psql, etc) will fail to see the new data directory.

    Second, if this is a Linux system with SELinux in enforcing mode then the new directory tree needs to be in the policy for PostgreSQL. This can be hard to change if you don't know how. It took me a week reading the various forums to figure this out. Private message me for help.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    5
    Rep Power
    0
    Originally Posted by dokhebi
    First, make sure that $PGDATA is set correctly in the user environment. If it points to the old directory then all applications (psql, etc) will fail to see the new data directory.

    Second, if this is a Linux system with SELinux in enforcing mode then the new directory tree needs to be in the policy for PostgreSQL. This can be hard to change if you don't know how. It took me a week reading the various forums to figure this out. Private message me for help.

    selinux is disabled
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2011
    Posts
    23
    Rep Power
    0
    Originally Posted by akthakur
    selinux is disabled
    Try looking in /etc/sysconfig/pgsql for a file called postgresql or postgresql-X.Y where X is the major version and Y is the minor version. If PGDATA is set to the old directory there it will over-write the value set in /etc/init.d/postgresql.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    5
    Rep Power
    0
    Hi all,
    This is resolved now as some idiot from client side had done entered in bash_profile for pg_data due to which new new value of pg_data was not getting picked.

    Thank-you all for your replies.

IMN logo majestic logo threadwatch logo seochat tools logo