Re: 2.5TB Migration from SATA to SSD disks - PostgreSQL 9.2 - Mailing list pgsql-general

From Patrick B
Subject Re: 2.5TB Migration from SATA to SSD disks - PostgreSQL 9.2
Date
Msg-id CAJNY3ivrb39id5jOFh-dk8BGQge622mn0L8k1paF+ZypVFyUYQ@mail.gmail.com
Whole thread Raw
In response to Re: 2.5TB Migration from SATA to SSD disks - PostgreSQL 9.2  (Venkata B Nagothi <nag1010@gmail.com>)
Responses Re: 2.5TB Migration from SATA to SSD disks - PostgreSQL 9.2
List pgsql-general
Hi guys,


You can actually reduce the time more by pre-syncing to the new location. 
something like:
rsync -va /var/lib/pgsql/ /var/lib/pgsql2/
service postgres stop
rsync -va /var/lib/pgsql/ /var/lib/pgsql2/
The second rsync will only copy the deltas from the first, it still has to go in and determine what needs to be copied/what changed but the bulk of it can be prepared/migrated before the actual downtime window.


Thanks a lot @David.

I tested the above and it worked... Here is what I did:

1 - Create /var/lib/pgsql2 directory
mkdir /var/lib/pgsql2

2 - Set permissions:
chown -R postgres:postgres /var/lib/pgsql2

3 - Change postgresql.conf:
data_directory = '/var/lib/pgsql2/9.2/data/'

4 - RSYNC:
rsync -va /var/lib/pgsql/ /var/lib/pgsql2/

5 - Stop postgres
/etc/init.d/postgresql-9.2 stop

5 - Re-run RSYNC to incremental copy:
rsync -va /var/lib/pgsql/ /var/lib/pgsql2/

6 - Change /etc/init.d/postgresql-9.2:

OLD:
PGDATA=/var/lib/pgsql/9.2/data
PGLOG=/var/lib/pgsql/9.2/pgstartup.log
PGUPLOG=/var/lib/pgsql/$PGMAJORVERSION/pgupgrade.log

NEW:
PGDATA=/var/lib/pgsql2/9.2/data
PGLOG=/var/lib/pgsql2/9.2/pgstartup.log
PGUPLOG=/var/lib/pgsql2/$PGMAJORVERSION/pgupgrade.log

7 - Start postgres
/etc/init.d/postgresql-9.2 start


and it worked perfectly fine... :)

That's great news! My only concern is about the "RSYNC" - Hope that doesn't take long!!!

This all steps must be performed by me on the next few days/weeks - I'll keep you guys updated... Keen to see the new DB running in a SSD environment :)

pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: please remove outdated site from 2005
Next
From: Craig Ringer
Date:
Subject: Re: BDR: Transactions with global lock