Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

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

share|improve this answer
2  
The fastest way will be to rsync it first, with the server running, then shutting it down and rsyncing again. –  Magnus Hagander Oct 30 '09 at 10:42
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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