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

  • You can just stop the DB, copy the cluster on FS level and start the DB with new cluster directory. 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 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
  • 1
    @JannatArora pg_ctl start -D /new/cluster/path May 18 '13 at 19:46

Browse other questions tagged or ask your own question.