Moving postgres data folder
(Migrated from old wordpress blog post dated 12/22/2010)
Our postgres server ran out of disk space on our EC2 server so we figured we should move the postgres data folder to a new bigger volume. We created an additional volume mounted to /disk2 and then moved the data folder as follows -
1. Login to shell as root. Stop the Postgres if running
$service postgresql-9.0 stop
2. Copy the data folder to new location
$cp -R /var/lib/pgsql/9.0/data /disk2/pgdata/
3. Modify postgres startup script to point to new data directory
In /etc/init.d/postgresql file, change the value of PGDATA variable to new location which is /disk2/pgdata/data
4. Start the db server
$ service postgresql start
12 Notes/ Hide
-
transientyou83 liked this
-
keynotetis8 liked this
-
yatendra1 posted this