1

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

Hannah Vernon
  • 70,041
  • 22
  • 171
  • 315
Jannat Arora
  • 163
  • 1
  • 2
  • 4
  • You can just stop the DB, copy the cluster on FS level and start the DB with new cluster directory. – Ihor 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? –  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. –  May 18 '13 at 19:12
  • 1
    @JannatArora pg_ctl start -D /new/cluster/path – Ihor Romanchenko May 18 '13 at 19:46
  • @IgorRomanchenko Thanks for replying. When I use pg_ctl it shows pg_ctl: could not open PID file "/home/Database/postmaster.pid" permission denied. Even though I change permission via chmod to 777/700 then also it continues to show the error. –  May 18 '13 at 20:35
  • @IgorRomanchenko When I run pg_ctl start -D /new/cluster/path. I gives me the error: server starting postgres@Server:/usr/lib/postgresql/9.1/bin$ postgres cannot access the server configuration file "/home/destination_data_directory/postgresql.conf": No such file or directory – Jannat Arora May 19 '13 at 05:45
  • @IgorRomanchenko Can you please help me figure out the error..please. Also thanks for replying – Jannat Arora May 19 '13 at 05:46

0 Answers0