Thread: move database directory

move database directory

From
"Johnson, Shaunn"
Date:

Howdy:

Running Postgres 7.1.3 on RedHat Linux 7.2 kernel
2.4.7 rev. 10.

My situation is this:  I'm running out of room
on a partition where the database resides.
I'd like to move the database directory to another
partition.

I don't supposed there is a 'howto' and 'reminder'
for pulling off such things, is there?  As I've
never done this before, I keep thinking that
there is more to it than remapping the
postmaster from startup and vacuum analyze
all of the tables after the move.

Any suggestions / documentation about such
matters?

Thanks!

-X

Re: move database directory

From
Doug McNaught
Date:
"Johnson, Shaunn" <SJohnson6@bcbsm.com> writes:

> Howdy:
>
> Running Postgres 7.1.3 on RedHat Linux 7.2 kernel
> 2.4.7 rev. 10.
>
> My situation is this:  I'm running out of room
> on a partition where the database resides.
> I'd like to move the database directory to another
> partition.

Shouldn't be much more to it than:

1) Shut down the database
2) Copy the tree
3) Change PGDATA in your startup script
4) Restart
5) Test
6) Delete old tree

-Doug
--
Doug McNaught       Wireboard Industries      http://www.wireboard.com/

      Custom software development, systems and network consulting.
      Java PostgreSQL Enhydra Python Zope Perl Apache Linux BSD...

Re: move database directory

From
Darren Ferguson
Date:
Since you are using linux :-)

I have postgres in /usr/local/pgsql the default place

I was running out of room and needed to move it to /opt

The easiest way i found was to

bash$ mv /usr/local/pgsql /opt

bash$ ln -s /opt/pgsql /usr/local/pgsql

This will create the symbolic link and therefore postgres will be none the
wiser that infact its directory has changed

You do not even need to do anything to the database except stop it before
you move and then restart it once you have moved

Darren Ferguson

On Wed, 6 Mar 2002, Johnson, Shaunn wrote:

> Howdy:
>
> Running Postgres 7.1.3 on RedHat Linux 7.2 kernel
> 2.4.7 rev. 10.
>
> My situation is this:  I'm running out of room
> on a partition where the database resides.
> I'd like to move the database directory to another
> partition.
>
> I don't supposed there is a 'howto' and 'reminder'
> for pulling off such things, is there?  As I've
> never done this before, I keep thinking that
> there is more to it than remapping the
> postmaster from startup and vacuum analyze
> all of the tables after the move.
>
> Any suggestions / documentation about such
> matters?
>
> Thanks!
>
> -X
>