Migrating FileStore to a new location
This document describes the steps required to move the RSpace filestore to a new location. You may need to do this if you want move to a larger disk or object store, and the current disk is too small.
These instructions assume tomcat8
, please adjust if you are using tomcat9
sudo
access to the systemOverview of steps
- Create or mount the new directory.
- Copy existing data to the new directory.
- Edit RSpace configuration files to refer to the new location.
- Execute a MySQL statement to update the database to the new location.
- Test and tidy up
Step 1 - create or mount the new directory
Let's assume the current location of RSpace file data is /media/rspace
and the new storage is mounted at /newdata
Step 2 - Copy existing data to the new directory
- Stop RSpace:
sudo systemctl stop tomcat8
- Copy using rsync:
sudo rsync -tvrpogn /media/rspace/ /newdata
- the trailing '/' in the source directory is important.
- '-n' performs a dry run - remove this to actually perform the copy.
- the other options torsync
preserve ownership, timestamps and permissions.
- after this statement is run, the subdirectories of/media/rspace/
will be in/newdata
Step 3 - Update configuration files
1. Replace references to existing file-system in /etc/rspace/deployment.properties
sed -i.bk -e 's:/media/rspace:/newdata:' /etc/rspace/deployment.properties
2. Replace references to existing file-system in /etc/default/tomcat8
( or /etc/default/tomcat9
)
sed -i.bk -e 's:/media/rspace:/newdata:' /etc/default/tomcat8
/newdata
in the Tomcat Service configuration file:ReadWritePaths=/newdata
Step 4 - Update MySQL
Login to mysql and perform the following actions
> select id,fileStoreRoot, bin(current) from FileStoreRoot;
will return 1 or more rows.
+----+--------------------------------+--------------+
| id | fileStoreRoot | bin(current) |
+----+--------------------------------+--------------+
| 1 | file:/media/rspace/file_store/ | 1 |
+----+--------------------------------+--------------+
Now, update the fileStoreRoot:
update FileStoreRoot set fileStoreRoot ='file:/newdata/file_store/' where bin(current)=1;
Step 5 - Restart RSpace
- Monitor log files in /var/lib/tomcat8/error.log
and /newdata/logs-audit/error.log
for problems.
Step 6 - Testing
This tests whether the new filestore and search indexes are working correctly.
- upload a text file F
- search for a unique search term - file F should be returned in search results.
Step 7 - Finishing
Once you are satisfied the new filestore location is working properly, delete the old one at /media/rspace