PostgreSQL: File System Level Backup to just Copy DATA Directory

For reading this article title, Please do not surprise.
Yes, this is possible in PostgreSQL.

We can simply copy the PostgreSQL DATA Directory and can use as a full PostgreSQL Database Server backup.

postgres files ystem backup

The File System Level backup is not always recommended, but we can use this backup method in certain condition.

In our organization, I am managing PostgreSQL backup using two approaches.

The First approach is a regular method for taking individual Database Backup using pgDump.

The Second approach is to take “frozen snapshot” of the PostgreSQL DATA directory. Our System Admin department is taking File System Level Backup of PostgreSQL.

Whenever I required new duplicate PostgreSQL server, I used this kind of file system backup of PostgreSQL.

It is faster than pgDump because It does not require any additional CPU I/O as full DATA directory already available on DISK.
System Admin has to perform simple COPY and PASTE like any other file or folder.

Few Restrictions are:

The database server must be shut down in order to get a usable backup and disallowing all connections will not work.

It is impossible to restore only a table or few tables. A File system backups only work for complete backup and restoration of an entire database cluster.

If your data files and WAL log are on different disks, or if tablespaces are on different file systems, it might not be possible to use snapshot backup or file system level backup.

A file system backup will typically be larger than an SQL dump.

After restoring of file system backup, It requires to rebuild all your Database Indexes.(For improving the performance)

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from