2022-09-21 15:32:27 -04:00
|
|
|
https://www.digitalocean.com/community/tutorials/how-to-move-a-postgresql-data-directory-to-a-new-location-on-ubuntu-18-04
|
|
|
|
|
2022-09-22 11:55:39 -04:00
|
|
|
copy the data
|
|
|
|
`sudo rsync -av /var/lib/postgresql /target_dir`
|
2022-09-21 15:32:27 -04:00
|
|
|
|
2022-09-22 11:55:39 -04:00
|
|
|
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`
|