Skip to main content
7 events
when toggle format what by license comment
Feb 10, 2021 at 18:42 comment added Freddy This is the clean way for a new database instance and I think it's the fastest solution to switch the data directory (edit one line in the original config, easy to revert).
Feb 10, 2021 at 18:36 comment added Blake Rivell got it! I am going to start fresh with all of this I forgot I accidentally moved all of the files from /etc/postgresql/12/main to /mnt/data/postgresql/12/main earlier when trying something. I will mark this as answer as soon as it works for me. Thank you so much! Is this the cleanest way to do what I am trying to do which is basically install postgres fresh on ubuntu server and then make it so the large data files are being stored on an external drive?
Feb 10, 2021 at 18:30 comment added Freddy You don't need to edit the config files in /mnt/data/postgresql/12/main, just change data_directory in /etc/postgresql/12/main/postgresql.conf and start the service. The default password is not set, use sudo to switch to the user. Please read postgresql.org/docs/12/app-initdb.html.
Feb 10, 2021 at 18:24 comment added Blake Rivell That got me through the initdb which looks like I have a bunch of new config files in the /mnt/data/postgresql/12/main folder. I had to do sudo su postgres to be able to CD into it. Can you explain what this did exactly?
Feb 10, 2021 at 18:07 comment added Freddy Run sudo chown -R postgres:postgres /mnt/data/postgresql before "initdb", the directory needs to belong to user postgres.
Feb 10, 2021 at 18:00 comment added Blake Rivell thank you for this. When I run the initdb command I am getting an error saying: fixing permissions on existing directory /mnt/data/postgresql/12/main ... initdb: error: could not change permissions of directory "/mnt/data/postgresql/12/main": Operation not permitted. I made sure I used sudo but I am assuming since we switched to postgres with -u that the postgres user doesn't have permission to do this?
Feb 10, 2021 at 16:20 history answered Freddy CC BY-SA 4.0