Subject: moving databases to other filesystems

From: [email-masked] (Tom Vijlbrief)
Date: Fri, 24 Jan 92 06:11:16 -0800

Hallo Postgres developers,

I have trouble moving a Postgres database to a new location.

What I do:

1) createdb tdnmo

2) cd ~postgres/data/base

3) mv tdnmo tdnmo.old

4) ln -s tdnmo.old tdnmo

Step 3) and 4) are to test if symlinking works.
I can do: monitor -c "retrieve (pg_user.all)" tdnmo

without any problems.

Now I try to move the files to the another filesystem on Magneto Optical disc:

5) su root

6) mkdir /u/eos/postgres_db

7) tar cf - tdnmo.old | (cd /u/eos/postgres_db; tar xvf -)

8) rm tdnmo

9) ln -s /u/eos/postgres_db/tdnmo.old tdnmo

I have checked all ownerships and filemodes but 

monitor -c "retrieve (pg_user.all)" tdnmo

NOTICE:Jan 24 14:04:33:InitStdio: !ValidPgVersion
 
FATAL 1:Jan 24 14:04:33:Did you run createdb on tdnmo yet??

What is wrong ????

Tom
===============================================================================
Tom Vijlbrief
TNO Institute for Perception		Phone: +31 34 63 562 11
P.O. Box 23				Fax:   +31 34 63 539 77
3769 ZG  Soesterberg			E-mail: [email-masked]
The Netherlands				or: uunet!tnosoes!tom
===============================================================================

---

From: postarch (Postgres Mailing Archive)
Date: Tue, 28 Jan 92 11:06:06 PST

>FATAL 1:Jan 24 14:04:33:Did you run createdb on tdnmo yet??

The problem is that when the backend starts up it does a chdir to the
database directory.  Due to the symlink you have created this amounts
to changing the process's working directory to /u/eos/postgres_db/tdnmo.old.
So far so good.  Now however, when the backend needs to look for certain
installation wide relations or meta data it will look 2 directories up.
Of course /u/eos/postgres_db/tdnmo.old/../.. does not contain these
relations or data.  The error message you are getting results from not
finding the PG_VERSION file which lives in $POSTGRESHOME/data, but other
problems will occur later if this test is passed.  Namely it won't be able
to find pg_log, pg_user, pg_variable etc.... basically anything that normally
lives two directories up will apparently be missing to the backend.

Note also in the first case you cite the database directory was still two
levels below the $POSTGRESHOME/data directory.

Jeff Meredith
[email-masked]