I setup a postgres cluster on an external hard drive. To create the cluster I used, pg_createcluster -d /path/to/external/hdd.

pg_lsclusters shows that the data directory is pointed to the external hdd. However, after I start the cluster with pg_ctlcluster 10 <cluster_name> start

and connect to the cluster, psql -U postgres -p 5433

After I login and execute show data_directory the data directory is correctly pointed to on the external hdd however the conf files are shown to be on my local machine in the /etc/postgresql/10/<cluster_name> directory. Inside the directory are the following files, pg_ctl.conf, pg_ident.conf, start.conf, environment, pg_hba.conf, postgresql.conf and the directory conf.d.

Two main questions,

1/ am I logging into the external HDD cluster correctly? The cluster on the external HDD is on part 5433 but the main cluster is also active on the local machine on the default port 5432.

2/ have I setup the external cluster correctly? Should the conf files be on the local machine? I thought it would make more sense for the conf files to be on the external HDD also especially if in the future I want to backup the external HDD cluster such that it is self contained or if in the event my local machine fails.

  • Is /etc/postgresql/10/ just a symlink?
    – jjanes
    Jan 30 at 4:25
  • I've added the information above. To create the cluster I used pg_createcluster -d /path/to/data and the folder is not a symlink. I've also added the list of files found in the directory.
    – TWhite
    Jan 30 at 9:47

1 Answer 1


For me, show data_directory shows the location of the actual data directory, not the config files. I don't understand how you are seeing something different there.

But other than that, that is just how pg_createcluster works (on Ubuntu 20.04 anyway). You could always just run initdb manually. The resulting server wouldn't be under systemd control, but for a server on external storage maybe that is what you want.

Note that if you do move it to a different server, the indexes that don't use C collation might be corrupt (if the glibc version differs, for example.)

  • That was a typo, I've updated my original question. show data_directory does indeed show the actual data directory which in my case points to the external hard drive. However, the main point is that the config files are separately stored on the local machine. If you can add to your answer as to why this happens (I'd assume it would be with the data directory for ease of backups) and also expand on what you mean by your sentence I'd be happy to accept.
    – TWhite
    Jan 31 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.