I want to change the postgres' data directory to /home/postgres/data
editing th postgresql.service instead of change the file /etc/postgresql/10/main/postgresql.conf
.
So, I edited the service with
sudo systemctl edit postgresql.service
And added this lines:
[Service]
Environment=PGDATA=/home/postgres/data
And restart de service with sudo servicetl restart postgresql.service
.
But the data directory don't changed.
Also edit [email protected]
and reboot my laptop, but the data directory didn't change.
How can I change the data directory for postgres using systemctl services or units?
postgres 9779 0.5 0.1 326888 27056 ? S 15:25 0:00 /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf
. Actually if I change the directory in postgres.conf the server runs correctly, in/home/postgres/
, and the directory is owned by user and group. I mean, it seems the PGDATA variable is not used by postgres.