ResourceSpace file storage (filestore)
ResourceSpace stores resource files in obfuscated folder paths on the server and not in the database.
The folders are not meaningful to an administrator browsing the folders on the server because they are derived from the unique resource ID and are not related in any way to metadata or collections that the resources belong to.
The files are normally located in a directory named 'filestore' located in the root of your ResourceSpace root folder, although there are a number of configuration options that can alter this (e.g. $storagedir and $originals_separate_storage).
Filestore even spread
Historically resources have been distributed in an uneven fashion throughout the filestore. Resources with IDs beginning with 1 will be located below filestore/1, resources beginning with 2 will be located under filestore/2 etc. As a result most systems have a far greater number of resources located in the lower numbered folders and this has made it difficult for server administrators to separate the filestore in order to spread it over a number of drives.
From version 9.2 onwards ResourceSpace allows you to change this by setting the configuration option below. This will effectively reverse the path required to reach the files and will be enabled by default for new installations.
$filestore_evenspread = true;
To ensure that existing resource files are still accessible :-
- Set the configuration option below
- Run the following PHP script from a terminal or command prompt on the server. This will move the resource files into the new locations. Amend the actual command as necessary to suit your specific server configuration
/pages/tools/filestore_migrate.php e.g. php /var/www/pages/tools/filestore_migrate.php
Configuring the filestore location
On a Unix system you can change the location of the filestore by simply creating a symbolic link named 'filestore' in the root of your ResourceSpace installation that points to another folder on the server. This folder could be on a network drive as long as it has been mapped to the server correctly and can be accessed by the web server user (e.g. www-data).
On a Windows system it may be easier to use the config options $storagedir and $storageurl instead. For example:
Separate storage for original and preview files
By enabling the config option $originals_separate_storage and running the script at pages/tools/filestore_separation.php the filestore will be split into two folders - "original" and "resized". Original uploaded resource files will be stored in the "original" folder while the preview files generated for that resource will be stored in the "resized" folder.
To improve performance it may be advantagous to use symbolic links to point the "original" folder to your larger, slower drive and point the "resized" folder to your smaller but faster drive.