15 lines
508 B
Markdown
15 lines
508 B
Markdown
https://www.digitalocean.com/community/tutorials/how-to-move-a-postgresql-data-directory-to-a-new-location-on-ubuntu-18-04
|
|
|
|
copy the data
|
|
`sudo rsync -av /var/lib/postgresql /target_dir`
|
|
|
|
rename original as a backup
|
|
`sudo mv /var/lib/postgresql/10/main /var/lib/postgresql/10/main.bak`
|
|
|
|
point postgres to the new data directory
|
|
`sudo vim //etc/postgresql/14/main/postgres.conf`
|
|
` data_directory = '/mnt/volume_nyc1_01/postgresql/10/main'`
|
|
|
|
remove the old data
|
|
`sudo rm -Rf /var/lib/postgresql/10/main.bak`
|