patternsqlMinor
Moving Postgres 10 data dir on Ubuntu 18
Viewed 0 times
postgresubuntudirmovingdata
Problem
I am trying to move the initial Postgres data dir from
to another harddrive. The harddrive is accessable within the terminal via
I used this guide to switch my data dir. Postgres is starting up after modifying the
When trying to access the database its asking if the database is running on port 5432 and accepting connections.
Why? What am I doing wrong?
Update:
After clean install of ubuntu and postgres all errors still remain.
The postgres log output is:
2018-07-06 14:16:04.958 CEST [5664] LOG: listening on IPv4 address "127.0.0.1", port 5432
2018-07-06 14:16:04.998 CEST [5664] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2018-07-06 14:16:05.124 CEST [5665] LOG: database system was shut down at 2018-07-06 14:00:21 CEST
2018-07-06 14:16:05.167 CEST [5664] LOG: database system is ready to accept connections
2018-07-06 14:16:05.714 CEST [5672] [unknown]@[unknown] LOG: incomplete startup packet
/var/lib/postgresql/10/mainto another harddrive. The harddrive is accessable within the terminal via
/media/chris/DatenspeicherI used this guide to switch my data dir. Postgres is starting up after modifying the
postgres.conf file but im not able anymore to access the database through pgadmin or the terminal.When trying to access the database its asking if the database is running on port 5432 and accepting connections.
Why? What am I doing wrong?
Update:
After clean install of ubuntu and postgres all errors still remain.
The postgres log output is:
2018-07-06 14:16:04.958 CEST [5664] LOG: listening on IPv4 address "127.0.0.1", port 5432
2018-07-06 14:16:04.998 CEST [5664] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2018-07-06 14:16:05.124 CEST [5665] LOG: database system was shut down at 2018-07-06 14:00:21 CEST
2018-07-06 14:16:05.167 CEST [5664] LOG: database system is ready to accept connections
2018-07-06 14:16:05.714 CEST [5672] [unknown]@[unknown] LOG: incomplete startup packet
Solution
Please check the socket file is in the /tmp. If it is there then create a link to /var/run.
OR,
I prefer this method to move the data directory on Ubuntu.
I hope you have the backup copy of the old directory which is in
OR,
I prefer this method to move the data directory on Ubuntu.
I hope you have the backup copy of the old directory which is in
/var/lib/postgresql/10/main.service postgresql stop
rm -rf /media/chris/Datenspeicher/*
chown -R postgres:postgres /media/chris/Datenspeicher/
chmod 700 /media/chris/Datenspeicher
/usr/lib/postgresql/10/bin/initdb -D /media/chris/Datenspeicher
rm -rf /media/chris/Datenspeicher/*
sudo rsync -av /var/lib/postgresql/10/main/* /media/chris/Datenspeicher
in postgresql.conf file, data_directory = '/media/chris/Datenspeicher'
service postgresql startCode Snippets
service postgresql stop
rm -rf /media/chris/Datenspeicher/*
chown -R postgres:postgres /media/chris/Datenspeicher/
chmod 700 /media/chris/Datenspeicher
/usr/lib/postgresql/10/bin/initdb -D /media/chris/Datenspeicher
rm -rf /media/chris/Datenspeicher/*
sudo rsync -av /var/lib/postgresql/10/main/* /media/chris/Datenspeicher
in postgresql.conf file, data_directory = '/media/chris/Datenspeicher'
service postgresql startContext
StackExchange Database Administrators Q#211397, answer score: 2
Revisions (0)
No revisions yet.