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

Please read through all the steps before starting. Make sure you have a backup, and ideally practice the migration on a copy of the system.
You'll need full sudo access to the system

Overview of steps

  1. Create or mount the new directory.
  2. Copy existing data to the new directory.
  3. Edit RSpace configuration files to refer to the new location.
  4. Execute a MySQL statement to update the database to the new location.
  5. 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

  1. Stop RSpace: sudo systemctl stop tomcat8
  2. 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 to rsyncpreserve 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

If using Ubuntu20LTS or Tomcat9, there may be more stringent permissions on what directories Tomcat can read or write to. You may need to grant Tomcat permission to read/write to /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


How did we do?


Powered by HelpDocs (opens in a new tab)

Powered by HelpDocs (opens in a new tab)