The file system are the files used by PostgreSQL to store data from the database. These files can be directly copied and made into a backup. You can choose the type of back-up you want to implement and then specify the path of the data directory. For instance, this uses tar to back up the file system:
tar -cf backup.tar /usr/local/pgsql/data
Although this method is easier to implement, it will be costly in the long run. There are two main restrictions:
The database server must be shut down. If you perform back-ups while it is running, inconsistent data is backed up. As a precaution, you should shut down the server even though your file system supports consistent snapshots of the data.
Backing-up and then restoring certain tables or databases from the file system is not supported. The information stored in the files is not enough for the system to restore the tables or databases. The system also needs the information in the pg_log files. These files contain the commit status of all transactions that have occurred. Restoring only a selected few tables will make the rest of the tables in the pg_log files useless.
The difference between backing up the file system and backing up using dump is that a file system back up is larger in size. When performing a dump, only the SQL commands to create the objects are stored. With backing up the file system, the contents of the objects are stored.
PostgreSQL has the ability to backup and restore over the network. These abilities are native to the utilities pg_dump , pg_dumpall and pg_restore that we have already discussed.