RE: Problems with new data location - Mailing list pgsql-general

From Karen Ellrick
Subject RE: Problems with new data location
Date
Msg-id GAELLCMOCEGMDMHDMIILEEHCCIAA.k-ellrick@sctech.co.jp
Whole thread Raw
In response to Re: Problems with new data location  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Problems with new data location  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
> But ... um ... did you restart the postmaster with the new path argument?
> Or only change the script?

Well, now I can't remember the exact sequence I used originally - I probably
tried to restart only after all the changes had taken place.  I do remember
getting the error "can't find /usr/local/pgsql/data/postmaster.pid - is
postmaster running?", and dummy me, I assumed it wasn't, without checking
ps.  Anyway, restarting doesn't seem to work if I actually move the
directory rather than copy it.  But after I got your message, I checked ps
and discovered that indeed, postmaster was still running.  So I put the
directory back in its old place, successfully ran "pg_ctl -D
/usr/local/pgsql/data stop", then moved the directory, and then successfully
ran "pg_ctl -D /var/pgdata stop".

> BTW, it should work fine to move a data-directory tree from one place to
> another (with cp -p -r or tar/untar according to preference).  But you
> have to shut down the old postmaster *first*.

Yup, the key is that both those methods copy (rather than move) the
directory.  If you copy, you can use restart (I assume - I didn't try it).
If you want to simply move the directory, you have to (1) stop, (2) move,
(3) start.

Thanks for pointing me in the right direction, and also giving me the
assurance that a data directory can indeed be moved without redoing initdb.

Karen


pgsql-general by date:

Previous
From: "Dr. Evil"
Date:
Subject: Preventing variables from "rolling over"
Next
From: Larry Rosenman
Date:
Subject: Interesting question for LARGE (> 10 Million Rows).