Moodle Plugins directory: Alternative File System | Moodle.org
Alternative File System
Alternative File System
Move moodledata/filedir to the cloud and have Moodle serve/read files directly from remote storage—reducing pressure on local disks and making scalability easier.
What this plugin does
Moodle stores files in moodledata/filedir. In large environments, this becomes a cost and complexity hotspot: constantly growing local disks, heavier backups, forced storage expansion, and operational risk.
With the Alternative File System, you move those files to remote storage (e.g., AWS S3 or DigitalOcean Spaces), and Moodle starts to read/serve the files remotely.
Result: a more scalable and resilient file base, with simpler and more predictable infrastructure operations.
config.php (before setup.php). See the example further down in the “Quick configuration” section.- AWS S3 Supported
- DigitalOcean Spaces Supported
- S3-compatible Depends on the endpoint
- CDN Optional
Features you get
moodledata/filedir to the cloud, with a controlled and verifiable process.Quick setup (high-level overview)
config.php, before setup.php, add:$CFG->alternative_file_system_class = "\\local_alternative_file_system\\external_file_system";
require_once(__DIR__ . '/lib/setup.php');
- Bucket/Space created and region defined
- Credentials created with least-privilege permissions
- Endpoint and bucket/space confirmed
- Read tests (course files, images, PDFs)
- Rollback plan and backups
- Monitoring (errors, latency, costs)
Migration: choose your scenario
Scenario A
filedir → cloudFor those using the default (local) storage and who want to move everything from moodledata/filedir to S3/Spaces.
- Configure the destination (Amazon S3 or DigitalOcean Spaces).
- Use the plugin configuration page to start migrating existing files.
- Validate file reading and delivery (sample courses + file types).
Scenario B
tool_objectfs → pluginFor those who already use tool_objectfs and want to migrate to local_alternative_file_system.
- While Moodle still points to
\tool_objectfs\..., open this plugin’s settings. - The plugin can detect/import tool_objectfs configs and run tests.
- When everything is OK, change
$CFG->alternative_file_system_classto this plugin.
I am using moodle 4.1
what should I do?
$CFG->alternative_file_system_class = "\\local_alternative_file_system\\external_file_system";
I like this plugin, it's great Job.