Re: Moving Database -> New Disk - Mailing list pgsql-sql

From Tom Lane
Subject Re: Moving Database -> New Disk
Date
Msg-id 7732.919017521@sss.pgh.pa.us
Whole thread Raw
In response to Moving Database -> New Disk  ("Tim Perdue, Directricity.com" <tim@directricity.com>)
List pgsql-sql
"Tim Perdue, Directricity.com" <tim@directricity.com> writes:
> I'm trying to do somethat that shouldn't be so darn difficult - moving a
> database to a new bigger disk.
> The database is db_domain at /usr/local/pgsq/data/base/db_domain
> I want it to reside on /fireball/pgsql/...
> I created a dump of db_domain and was able to do initdb on the new
> location - but when I try to createdb, of course db_domain is already taken.

It sounds like createdb is connecting to your old postmaster.

> If I try to createdb using the -D switch I get an error about it not being
> able to find the directory (it's there).

createdb's -D is a weird critter that does not have at all the same
meaning as -D in the postmaster.  You're still connecting to the same
Postgres installation, you are just telling the system to put the
subdirectory for the particular database in a nonstandard place rather
than under installation-data-directory/base/.

Your message is actually not very clear about whether you want to move
the entire Postgres installation (all of /usr/local/pgsql/data/) or
just the one database (/usr/local/pgsql/data/base/db_domain/).  Either
is possible.

> If I don't specify the -D switch, any new database is created under
> /usr/local/pgsql/data/base/, even though I restarted postmaster with -D
> pointing to /fireball/pgsql/....

Hmm, sure sounds like the postmaster's -D didn't "take".  You might want
to double check that you gave it correctly.  Alternatively, rebuild your
Postgres software with the correct data directory specified at configure
time (I know this works, not sure whether -D really works or not...)

Someone else's suggestion of a symlink would also work.

            regards, tom lane

pgsql-sql by date:

Previous
From: Kim Markle
Date:
Subject: RE: [SQL] connection timeout?
Next
From: Remigiusz Sokolowski
Date:
Subject: Re: [SQL] index on aggregate function