postgreSQL Backing up the whole cluster
This works behind the scenes by making multiple connections to the server once for each database and executing pg_dump on it.
Sometimes, you might be tempted to set this up as a cron job, so you want to see the date the backup was taken as part of the filename:
However, please note that this could produce large files on a daily basis. Postgresql has a much better mechanism for regular backups
The output from pg_dumpall is sufficient to restore to an identically-configured Postgres instance, but the configuration files in $PGDATA (pg_hba.conf and postgresql.conf) are not part of the backup, so you'll have to back them up separately.
To take a filesystem backup, you must use these functions to help ensure that Postgres is in a consistent state while the backup is prepared.