Move postgresql data directory to a new location

Keywords: PostgreSQL - Virtual Machines - How to - Other

I’ve just created my Bitnami postgresql azure server (Bitnami PostgreSQL 10.5-0). I follow this tutorial to move the data directory to a new location:

But when I use the command:
sudo systemctl stop postgresql

I get the following message:
Failed to stop postgresql.service: Unit postgresql.service not loaded.

I searched everywhere in the internet but I did not find any thing helpful.

Could you give me some instruction on how to move data directory for Bitnami postgres?



Thanks for using Bitnami. In a Bitnami installation, to stop / start the PostgreSQL server use:

  • sudo /opt/bitnami/ stop postgresql
  • sudo /opt/bitnami/ start postgresql

The data and configuration directory is in /opt/bitnami/postgresql/data. Given that the scripts etc expect that location, my recommendation would be:

  1. Take a backup
  2. Stop the service.
  3. Move the data folder to the new location.
    4 Create a symbolic link in named /opt/bitnami/postgresql/data to the new location.
    5 Start the service.


Andres R.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.