SoFunction
Updated on 2025-04-08

Modify the operation method of postgresql storage directory

Modify the postgresql storage directory:

sudo rsync -av /var/opt/gitlab/postgresql /data/gitlab/

Modify /etc/gitlab/

postgresql[‘data_dir'] = “/data/gitlab/postgresql/data”
postgresql[‘dir'] = “/data/gitlab/postgresql”
postgresql[‘home'] = “/data/gitlab/postgresql”

Reload the configuration and restart gitlab

gitlab-ctl reconfigure
gitlab-ctl restart

Notice:

Keep the original location directory /var/opt/gitlab/postgresql (the .5432 file will be created)

Supplement: Notes on Postgresql modification of storage location

1. Modify the content of the data item in the file and specify the folder where you want to store the data.

2. Change the group and owner of the modified folder to postgre

3. Change the permissions of the modified folder to 0700, that is, the chmod 0700 folder path

The above is personal experience. I hope you can give you a reference and I hope you can support me more. If there are any mistakes or no complete considerations, I would like to give you advice.