Step 4: Migrate Existing Data
Now, we'll move our existing data from Practical Session 1: Administration to our new ZFS folders.
Sync Data
root@xnat-12:~# rsync -ah --stats /data.old/ /data
root@xnat-12:~# rsync -ah --stats /var/lib/postgresql/9.5/main.old/ /data/postgres/9.5
Double-check your slashes
Rsync is very sensitive to trailing slashes. Make sure you have the slashes exactly as in the example.
Change Postgres Data Location
Edit the postgresql.conf to change the data location
# nano /etc/postgresql/9.5/main/postgresql.conf
Change the line:
data_directory = '/var/lib/postgresql/9.5/main' # use data in another directory
to:
data_directory = '/data/postgres/9.5' # use data in another directory
Restart Tomcat and PostgreSQL
root@xnat-12:~# service postgresql start
* Starting PostgreSQL 9.5 database server [ OK ]
root@xnat-12:~# service tomcat7 start
* Starting Tomcat servlet engine tomcat7 [ OK ]
Step 4 Complete