In the previous recipes, we discussed how a data directory can be initialized using initdb and how a PostgreSQL cluster can be started using pg_ctl. A data directory in PostgreSQL is a directory that contains several directories and sub-directories for storing data. It contains several configuration files and sub-directories that play a crucial role in running a Postgres database. The location of the data directory and some of its configuration files may change, depending on the OS distribution. For example, on Ubuntu or Debian, the configuration files are visible in a different location under /etc.
In this recipe, we are going to talk about the data directory and its contents in detail.
Getting ready
The following recipe involves running some Linux-level commands to identify the data directory. We require access to the OS to run these commands. As long as we can ssh to the database server as root or the Postgres user, we should...