Postgresql – How to transfer a postgres database to a different server

copydatabasepostgresqlrestore

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?

Best Answer

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