Now, we'll move our existing data from Practical Session 1: Administration to our new ZFS folders.
Bash
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
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
Bash
# 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
Bash
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 ]