general fear question about move PGDATA from one Disc to another

From: Aleksandar Lazic <al-pgsqlgeneral(at)none(dot)at>
To: <pgsql-general(at)postgresql(dot)org>
Subject: general fear question about move PGDATA from one Disc to another
Date: 2012-11-13 15:26:07
Message-ID: 92664bdf72b73e7ef0c987bc167611c9@none.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Philippe Amelant 2012-11-13 16:19:31 Re: Understanding streaming replication
Previous Message Benjamin Henrion 2012-11-13 15:19:25 Re: PG under OpenVZ?