Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id D7C4F9FB341 for ; Sun, 13 May 2007 21:03:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 07664-01 for ; Sun, 13 May 2007 21:02:55 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from locust.cns.vt.edu (locust.cns.vt.edu [198.82.169.14]) by postgresql.org (Postfix) with ESMTP id C72BD9FB502 for ; Sun, 13 May 2007 21:03:00 -0300 (ADT) Received: by locust.cns.vt.edu (Postfix, from userid 986) id 686CA118A48; Sun, 13 May 2007 20:02:59 -0400 (EDT) Date: Sun, 13 May 2007 20:02:59 -0400 From: Ray Stell To: Linux Geeks Cc: pgsql-admin@postgresql.org Subject: Re: Moving data directory Message-ID: <20070514000259.GA28681@cns.vt.edu> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.11 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/106 X-Sequence-Number: 25426 On Sat, May 12, 2007 at 11:47:46PM +0700, Linux Geeks wrote: > I'm very new to postgresql and would like to move my data directory to > another partition in Ubuntu. I don't think there is anything internal to pg that locks the data location. Just tell postmaster where you move it to. Shut down the postmaster and move it and start it with the -D flag pointing to the new location: $ pg_ctl start -D /var/pgsql/data server starting $ psql -p 5437 testdb jira Password for user jira: Welcome to psql 8.2.3, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit testdb=> \q pg_ctl stop -D /var/pgsql/data waiting for server to shut down....,7222,,2007-05-13 19:52:06.675 EDT,,1,,, LOG: logger shutting down done server stopped $ mv /var/pgsql/data-move-test /var/pgsql/data $ pg_ctl start -D /var/pgsql/data-move-test server starting $ psql -p 5437 testdb jira Password for user jira: Welcome to psql 8.2.3, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit testdb=> \q pg_ctl stop -D /var/pgsql/data-move-test waiting for server to shut down....,7245,,2007-05-13 19:55:00.944 EDT,,1,,, LOG: logger shutting down done server stopped $ mv /var/pgsql/data-move-test /var/pgsql/data $ pg_ctl start -D /var/pgsql/data server starting $ psql -p 5437 testdb jira Password for user jira: Welcome to psql 8.2.3, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit testdb=> \q -- Lost time is when we learn nothing from the experiences of life. Time gained is when we grow to have a wisdom that is tested in the reality of life.