postgreSQL Backup and Restore
Backing up the filesystem instead of using pg_dumpall and pg_dump
It's very important that if you use this, you call the pg_start_backup() function before and pg_stop_backup() function after. Doing filesystem backups is not safe otherwise; even a ZFS or FreeBSD snapshot of the filesystem backed up without those function calls will place the database in recovery mode and may lose transactions.
I would avoid doing filesystem backups instead of regular Postgres backups, both for this reason, and because Postgres backup files (especially in the custom format) are extremely versatile in supporting alternate restores. Since they're single files, they're also less hassle to manage.
Backing up one database
The -Fc selects the "custom backup format" which gives you more power than raw SQL; see pg_restore for more details. If you want a vanilla SQL file, you can do this instead:
A safer alternative uses -1 to wrap the restore in a transaction. The -f specifies the filename rather than using shell redirection.
Custom format files must be restored using pg_restore with the -d option to specify the database:
The custom format can also be converted back to SQL:
Usage of the custom format is recommended because you can choose which things to restore and optionally enable parallel processing.
You may need to do a pg_dump followed by a pg_restore if you upgrade from one postgresql release to a newer one.