I have been looking for a way to setup another database besides the
initial one setup under /var/lib/pgsql/data on a different file system.
I have found a few references to configuring a separate PGDATA2
environment variable and running the initlocation PGDATA2 followed by
createdb -D PGDATA2 testdb.
The directories are created.
However when executing those steps I get the following error:
-bash-2.05b$ createdb testdb2 -D 'PGDATA2'
ERROR: Postmaster environment variable 'PGDATA2' not set
createdb: database creation failed
I have verified that PGDATA2 environment variable is set.
-bash-2.05b$ echo $PGDATA2
I have restarted postmaster with the assumption that it needed the
environment variables setup in the postgres users shell.
My guess is that PGDATA2 is not set for some reason for the postmaster
service. I looked in the init.d/postgresql startup script and can see
where PGDATA is checked for and setup. I take it that the environment
variables from postgres user are not used?
Is there a way to set databases in different file systems using a single
Scot L. Harris
... mindreading equipment is currently classified CIA property at
best (hello echelon!)
- Alan Cox on linux-kernel