79266810

Date: 2024-12-10 01:22:41
Score: 1
Natty:
Report link

So many years without right answer... Of course, you can!

Just stop PG, make copy of your cluster data directory (PGDATA) with thoroughly saved permissions and change in your PG`s postgresql.conf "data_directory" parameter pointing to the new location, start PG.

I.e.

/etc/postgresql/11/main/postgresql.conf

data_directory = '/mnt/other_storage/new_cluster_location'

It was tested many times under Debian and Ubuntu environments without any problems. Just works as it expected: fast and reliable (PG versions 9-16).

data_directory in pg_catalog->pg_settings changes automatically after server restarts.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Eugene Zakharenko