1

I'm planning to transfer a ~100GB Postgres database to a new server. Is it save to just copy the data directories to the new server and start up the database there, or do I need to do a dump on the first server and then a restore on the second?

The first server's database partition is about 120GB, the second's is 1TB. Both servers are running the same version of postgres on debian and are connected by 1GB ethernet. Are there any differences between the two methods to transfer the database? What would be the fastest (least downtime) way to transfer the data to the new server?

3 Answers 3

3

As long as they're the same architecture, then you should be fine shutting down then rsyncing the files.

1
  • 2
    The fastest way will be to rsync it first, with the server running, then shutting it down and rsyncing again. Oct 30, 2009 at 10:42
2

You might also consider doing a dump and import of the database. You can target the dump to go to the new partition (perhaps via NFS mount).

Otherwise, @Matt's solution is good.

1

This migration is probably already complete but I thought I might chime in anyway.

It will take longer to prep & setup but you can transfer the data by setting up replication between the 2 servers. You could use bucardo, londiste, or slony. This will minimize downtime vs. rsync. In my experience it can take several minutes for rsync to compare disk blocks between the source & target hosts once the files to be rsync'd are over 10GB in size.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.