Alternative File System

Local plugins ::: local_alternative_file_system
Maintained by Eduardo Kraus
Store Moodle files on Amazon S3 or DigitalOcean Spaces, saving disk space and maintaining compatibility with the File API.
Latest release:
40 sites
99 downloads
13 fans
Moodle 3.10, 3.11, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 5.0, 5.1

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.

✅ Supported today
AWS S3 and DigitalOcean Spaces (S3-compatible).
🚀 Focus
Large environments, clusters, high availability, and painless growth.
Tip: if you already use tool_objectfs, there’s a migration path designed for a smooth transition.
Practical results
Infra-friendly
💾
Less local disk
Takes pressure off the server’s storage and simplifies operations.
📈
Scale without painful migrations
Grow capacity in the bucket/Space—no “surprise disk swap”.
🛡️
More resilience
High availability and durability typical of object storage.
Performance (with CDN, when applicable)
Files in S3/Spaces can benefit from CDN and edge delivery.

Ideal for sites with a large volume of files and a need to reduce Moodle’s “disk cost”.
🔒 Security and governance
Control access and policies directly in the bucket/Space: encryption, auditing, least-privilege permissions, and environment isolation.
🧩 Operational simplicity
Less local disk maintenance, less impact from infrastructure upgrades, and more predictable scaling.
🌍 Ready for distribution
A great fit for cluster scenarios and multi-node environments—object storage becomes the shared “common point” for files.

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.

Attention: activation in config.php
For Moodle to use this file system, you configure the alternative class in config.php (before setup.php). See the example further down in the “Quick configuration” section.
Compatibility / Storage
  • AWS S3 Supported
  • DigitalOcean Spaces Supported
  • S3-compatible Depends on the endpoint
  • CDN Optional
If you want, you can also adapt it for other S3-compatible providers (just endpoint + credentials).

Features you get

📦 Filedir migration
Moves your existing files from moodledata/filedir to the cloud, with a controlled and verifiable process.
🔁 Migration from tool_objectfs
The plugin can read the tool_objectfs configuration and ease the transition (without reinventing everything from scratch).
🧠 Fewer local storage bottlenecks
Reduces local disk growth and the impact of server maintenance/physical expansion.
🌐 Better global delivery (when using a CDN)
Remote storage + CDN can reduce latency and improve the experience for students in different regions.
🔐 Security best practices
Least-privilege permissions, rotatable keys, bucket/Space policies, and encryption options in transit/at rest.
🧰 Predictable operations
Storage becomes a service: easier to plan cost, capacity, redundancy, and availability.

Quick setup (high-level overview)

1) Choose the destination (S3 / Spaces) and configure credentials
Create the bucket/Space and generate access keys. Keep to the principle of least privilege (only the necessary read/write).
2) Point Moodle to the Alternative File System
In config.php, before setup.php, add:
Example:
$CFG->alternative_file_system_class = "\\local_alternative_file_system\\external_file_system";

require_once(__DIR__ . '/lib/setup.php');
Tip
Start in staging first, validate file reading/delivery, and only then replicate the process in production.
Checklist before going to production
  • 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 → cloud

For those using the default (local) storage and who want to move everything from moodledata/filedir to S3/Spaces.

  1. Configure the destination (Amazon S3 or DigitalOcean Spaces).
  2. Use the plugin configuration page to start migrating existing files.
  3. Validate file reading and delivery (sample courses + file types).

Scenario B

tool_objectfs → plugin

For those who already use tool_objectfs and want to migrate to local_alternative_file_system.

  1. While Moodle still points to \tool_objectfs\..., open this plugin’s settings.
  2. The plugin can detect/import tool_objectfs configs and run tests.
  3. When everything is OK, change $CFG->alternative_file_system_class to this plugin.

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2

Contributors

Eduardo Kraus (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments

Show comments
  • Plugins bot
    रवि, 7 अप्रैल 2024, 7:00 AM
    Approval issue created: CONTRIB-9545
  • Andrii Holdman
    शनि, 25 जन॰ 2025, 12:43 PM
    After adding $CFG->alternative_file_system_class = '\local_alternative_file_system\external_file_system'; before require_once( __DIR__ . '/lib/setup.php' ); in config.php I get an error: Class 'local_alternative_file_system\storages\s3\gcs_file_system' not found
    I am using moodle 4.1
    what should I do?
  • Dr.Mohd S Al-Ali
    गुरु, 30 जन॰ 2025, 6:37 PM
    Try to use double backslash not single. It's working fine.
    $CFG->alternative_file_system_class = "\\local_alternative_file_system\\external_file_system";
    I like this plugin, it's great Job.
  • Meiseti Awan
    मंगल, 11 मार्च 2025, 4:41 PM
    How to delete local data that has been uploaded to s3 automatically?
  • Rod
    गुरु, 27 मार्च 2025, 6:14 AM
    Will this plugin work if our Moodle is hosted on Windows?
Please login to post comments