Thread: Changing the data directory Ubuntu

Changing the data directory Ubuntu

From
shaun.ricci@gmail.com
Date:
Hello,

I have done a good deal of investigation and cannot seem to find a
straight answer.  Is there  way to change the default data directory?
I am using Ubuntu Dapper LTS.  I have a seperate hard drive  (and
partition) that I want to keep my data on in case of a problem with the
OS.

Any help would be appreciated.

Shaun


Re: Changing the data directory Ubuntu

From
"Thomas F. O'Connell"
Date:
On Aug 15, 2006, at 1:19 PM, shaun.ricci@gmail.com wrote:

> Hello,
>
> I have done a good deal of investigation and cannot seem to find a
> straight answer.  Is there  way to change the default data directory?
> I am using Ubuntu Dapper LTS.  I have a seperate hard drive  (and
> partition) that I want to keep my data on in case of a problem with
> the
> OS.
>
> Any help would be appreciated.
>
> Shaun

Unless Ubuntu is doing anything funny, you should be able to set
data_directory in postgresql.conf:

http://www.postgresql.org/docs/8.1/static/runtime-config-file-
locations.html

--
Thomas F. O'Connell
Sitening, LLC

http://www.sitening.com/
3004B Poston Avenue
Nashville, TN 37203-1314
615-469-5150 x802
615-469-5151 (fax)

Re: Changing the data directory Ubuntu

From
John Purser
Date:
On 15 Aug 2006 11:19:39 -0700
shaun.ricci@gmail.com wrote:

> Hello,
>
> I have done a good deal of investigation and cannot seem to find a
> straight answer.  Is there  way to change the default data directory?
> I am using Ubuntu Dapper LTS.  I have a seperate hard drive  (and
> partition) that I want to keep my data on in case of a problem with
> the OS.
>
> Any help would be appreciated.
>
> Shaun

Shaun,

Normally the "default data directory" is set when starting PostgreSQL
with the -D switch.  Sometimes it is controled by the PGDATA
environmental variable.

On my Ubuntu Dapper system PostgreSQL (which was build from source, not
the .deb) this is set from SysV startup script located
at /etc/init.d/postgresql.  To "change" the default directory run
initdb -D "New Directory" then change the data directory in the SysV
init script.  Stop and restart PostgreSQL.

John Purser