Results 1 to 4 of 4
  1. #1
    Join Date
    May 2014
    Posts
    2

    Unanswered: Change postgres data folder

    Hi. I m using Ubuntu 14.04 and has postgres 9.3 installed just fine. The problem is i have to move postgres default data location from /var/lib/postgresql/9.3/main/ (which resides on my 24GB SSD) to /home/pgdata (bigger 500GB HDD).

    Any idea how to do that? I running out of / space because of this
    Sorry first time using postgres.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,934
    Provided Answers: 12
    A quick internet search using "change postgres data directory" turns up the following links:

    • http://www.dbforums.com/postgresql/787399-need-move-my-database-another-drive.html
    • https://nlakkakula.wordpress.com/2008/09/10/moving-postgresql-data-folder
    • https://www.linuxquestions.org/questions/linux-server-73/change-postgresql-data-directory-649911/
    • http://www.whiteboardcoder.com/2012/04/change-postgres-datadirectory-folder.html
    • http://www.virtualmin.com/node/9461
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  3. #3
    Join Date
    May 2014
    Posts
    2

  4. #4
    Join Date
    Apr 2014
    Posts
    16

    Change data folder

    Try

    ./initdb --locale=C --encoding=UNICODE -D $PGDATA -U $DBADMIN

    where $PGDATA is your custom data folder and $DBADMIN is the admin username

    I am using this statement in my createdb script and it creates the data directory in a folder which I specify in $PGDATA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •