general fear question about move PGDATA from one Disc to another - Mailing list pgsql-general

From Aleksandar Lazic
Subject general fear question about move PGDATA from one Disc to another
Date
Msg-id 92664bdf72b73e7ef0c987bc167611c9@none.at
Whole thread Raw
Responses Re: general fear question about move PGDATA from one Disc to another  (Craig Ringer <craig@2ndQuadrant.com>)
List pgsql-general
Dear listmembers,

I need to move

/var/lib/postgresql/8.4/main

from the / partion to another disc.

Based on the

http://wiki.postgresql.org/wiki/Simple_Configuration_Recommendation#File_System_Layouts

I plan the following.

0.) Mount new pgroot, are there any hints for the mount command?

     mount -t ext4 -o noatime,nodiratime,nodev,noexec,nosuid /dev/sde1
/pgroot

     output from mount

     /dev/sde1 on /pgroot type ext4
(rw,nosuid,nodev,noexec,noatime,nodiratime,barrier=1,data=ordered)


1.) create a full backup of the current DB

     /usr/bin/pg_dumpall --file=/tmp/backup_before_part_move.tar
--format=tar --oids --verbose --username=postgres

2.) Stop the database and the Apps which use the DB
     /etc/init.d/postgresql stop
     ....

3.) copy the current /var/lib/postgresql/8.4/main to the new dir as
user postgres
     cd /var/lib/postgresql/
     tar cvf - . | (cd /pgroot/pgdata && tar xvf -)

4.) sync filesystems
     sync

5.) change data_directory to /pgroot/pgdata/8.4/main

6.) Start postgres
     /etc/init.d/postgresql start

OS: ubuntu 11.04
PG: postgresql-8.4 8.4.14-0ubuntu11.04

Please can anybody take a look about my planned process and tell me if
I have
forgotten something and maybe point me to the right Doc, thanks.

Thanks for feedback.

Best regards
Aleks


pgsql-general by date:

Previous
From: Benjamin Henrion
Date:
Subject: Re: PG under OpenVZ?
Next
From: Philippe Amelant
Date:
Subject: Re: Understanding streaming replication