← Back to plugins Local

Alternative File System

Store Moodle files on Amazon S3 or DigitalOcean Spaces, saving disk space and maintaining compatibility with the File API.

Frankenstyle local_alternative_file_system
Category Local
Reported sites 74 sites
Screenshot of Alternative File System

About 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.

✅ 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.
Related

Other Moodle plugins

Screenshot of Kopere Dashboard
Kopere Dashboard local_kopere_dashboard

Kopere Dashboard is a tool panel with reports, online users, backup, notifications and more.

2546 sites Details →
Screenshot of GeniAI
GeniAI local_geniai

The GeniAI plugin for Moodle revolutionizes student-course interaction by providing an intelligent virtual assistant to instantly clarify doubts. The assistant offers contextual support, responds to questions in various languages, and adapts to the specific needs of each discipline.

412 sites Details →
Screenshot of Helpdesk and Knowledge base

This plugin that provides a ticketing system for managing helpdesk requests. It allows users to create and track tickets while enabling administrators and support teams to manage and respond efficiently.

365 sites Details →