2

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)

asked Nov 15, 2015 at 14:25

1 Answer 1

2

in Your way, also EXPORT PGDATA=/newdisk/newdata

but also You can move all files to the new disk, and mount this disk to old PGDATA path (if all disk for PGSQL only)

Edit your /etc/fstab:
/dev/disk_name /usr/local/psql/data auto defaults 1 2
answered Nov 15, 2015 at 14:42
1
  • thanks for the replay. I will try yours. can I move the /usr/local/psql/data to /data (will do the startup parameter change accordingly in /etc/rc.d/init.d/postgresql). Will it impact anything? Commented Nov 16, 2015 at 17:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.