Even if you installed the database on a RAID storage, you should back it up from time to time, preferrably on a separate physical storage.

You can use our backup script as a template:


VER=date +'%F_%H.%M'
sudo -u postgres -- pg_dumpall -U sa -g -f "$outGlob"

if [ $? != 0 ];then exit $?;fi;

sudo -u postgres -- pg_dump -U sa -f "$outLoc" -F c memoria

if [ $? != 0 ];then exit $?;fi;

find $BAK_PATH -type f \! -newermt '1 month ago' -exec rm {} \;

The script creates sets of independent backups with the date of creation included in the filename. Backups are deleted in 1 month after creation.

The script requires local database authentication without password (see settings of pg_hba.conf in “Launching and Configuring a Database Server”).

This script should be launched from time to time. For example, in Linux, corresponding settings in /etc/crontab can look like this:

0   */4  *   *   *      root    /usr/local/bin/memo_back

(the script launches every four hours).


In Windows you have to modify the script and use the Task Scheduler to start the script.

Did this answer your question?