Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I have my present database cluster of postgres at /mnt/my_hard_drive which I want to change to /home/myfolder. I also want to move all my databases present in the present cluster to /home/myfolder. Is there a way to do so?

I know one way for doing so is to dump my databases in some form e.g. .sql and reconstruct them from there. But considering my database size if 5TB I dont want to use this approach. Is there some other way to achieve this..since my machine is same...all I want to do is to move my database from hard drive to my home folder. Please suggest

share|improve this question

migrated from May 18 '13 at 22:41

This question came from our site for professional and enthusiast programmers.

marked as duplicate by a_horse_with_no_name, Mat, Phil, Mark Storey-Smith, StanleyJohns May 19 '13 at 15:36

This question was marked as an exact duplicate of an existing question.

You can just stop the DB, copy the cluster on FS level and start the DB with new cluster directory. – Igor Romanchenko May 18 '13 at 18:50
@IgorRomanchenko Thanks a lot for replying. I did stop postgres. But since I am a newbie with postgres I dont know as to how should I copy the database at the FS level. Also how should I start the DB with new cluster directory. For this do I have to create a new cluster. If yes, then how should I create one? – Jannat Arora May 18 '13 at 18:58
"copy at fs level" just means cp -r /old/cluster/path /new/cluster/path – SingleNegationElimination May 18 '13 at 19:05
@TokenMacGuy Thanks a lot for replying. I have copied my data. Now how should I start postgres with new cluster directory. – Jannat Arora May 18 '13 at 19:12
@JannatArora pg_ctl start -D /new/cluster/path – Igor Romanchenko May 18 '13 at 19:46

Browse other questions tagged or ask your own question.