PostgreSQL: Documentation: 18: 18.2. Creating a Database Cluster
It is possible to use an NFS file system for storing the PostgreSQL data directory. PostgreSQL does nothing special for NFS file systems, meaning it assumes NFS behaves exactly like locally-connected drives. PostgreSQL does not use any functionality that is known to have nonstandard behavior on NFS, such as file locking.
The only firm requirement for using NFS with PostgreSQL is that the file system is mounted using the
hardoption. With thehardoption, processes can “hang” indefinitely if there are network problems, so this configuration will require a careful monitoring setup.
It is not necessary to use the
syncmount option. The behavior of theasyncoption is sufficient, since PostgreSQL issuesfsynccalls at appropriate times to flush the write caches. (This is analogous to how it works on a local file system.) However, it is strongly recommended to use thesyncexport option on the NFS server on systems where it exists (mainly Linux). Otherwise, anfsyncor equivalent on the NFS client is not actually guaranteed to reach permanent storage on the server, which could cause corruption similar to running with the parameter fsync off.