Currenly my postgresql service running with
/usr/local/psql/bin/postmaster -d /usr/local/pgsql/data
Due to insufficient disk space (data directory having 10GB of data), I planned to do the following steps:
Step1:
service postgresql stop
Step2:
mkdir -p /newdisk/newdata
chown postgres:postgres /newdisk/newdata
Step 3:
Change PGDATA path in /etc/rc.d/init.d/postgresql file
From
PGDATA=/usr/local/pgsql/data
To
PGDATA=/newdisk/newdata
Step 4:
initdb -D /newdisk/newdata
service postgresql start
If I do above steps, expecting 10GB data will be moved to /newdisk/newdata path and henceforth, new transactions will be stored in /newdisk/newdata path.
This approach is fine to proceed? or do I need to consider anything else?
(Using Postgresql 9.1)