Yatendra Khandelwal

  • Random
  • Archive
  • RSS
  • Ask me anything

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

    • #postgres
  • 8 months ago
  • 12
  • Comments
  • Permalink
  • Share
    Tweet

12 Notes/ Hide

  1. transientyou83 liked this
  2. keynotetis8 liked this
  3. yatendra1 posted this

Recent comments

Blog comments powered by Disqus
← Previous • Next →

About

.... technology, business, technology in business, business in technology and more ....
  • Projects

Me, Elsewhere

  • @yatendra on Twitter
  • Linkedin Profile
  • yatendra on github
  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr