How to do backups ================= It is not completely safe to rely on normal Linux backup utilities to protect your database, unless you stop the postmaster first. If you back up a database file while it is being vacuumed, you have a fair chance of preserving a version that is corrupted either in its information, or, even worse, in its internal structure. In the latter case, the entire database might turn out to be inaccessible. With the introduction of WAL (Write-Ahead Logging) at 7.1, data is much more secure than before, nevertheless, you should try to avoid relying on a tar or cpio archive of the database. To backup your database do this: pg_dump dbname | gzip -9 > backup.sql.gz To backup your entire database system: pg_dumpall | gzip -9 > backup.sql.gz pg_dump puts out all data in a form that can be rapidly reloaded while maintaining informational integrity. Use pg_restore to recover a dump. Since a dump with pg_dumpall creates a file which contains instructions to connect as different users, it is necessary to ensure that pg_hba.conf allows unrestricted access to the user running pg_restore. You may also use pg_restore to create a tar or custom archive; these can only be restored by the command pg_restore. See their man pages for details.