OpenCloud · Version cleanup
Version Cleanup: automatically thinning out old versions
OpenCloud keeps every version of a file so that any mistake can be undone, but until now without any limit. Starting with 9.3.0, a strategy thins out old versions: within the last hour one per minute remains, later one per hour, day and week, optionally combined with fixed age limits. A dry run shows in advance what would be deleted and how much storage would be freed.
As long as everyone kept their own copy of a document on their own computer and sent changes around as email attachments, the risk of a mistake was spread across many copies: if you accidentally deleted a paragraph, you only damaged your own file, while an older version existed somewhere else. Shared file stores have turned that around. Today a team works on a single file that counts as the source of truth. Because everyone relies on it, a mistake in it weighs more. An overwritten sheet, an accidentally emptied presentation or a wrong formula in a budget then hits everyone at once.
Such a source therefore has to be dependable, technically and in the experience of the people who work with it. If you are afraid a change might break something beyond repair, you'll leave a shared document alone when in doubt and make a private copy instead, which takes you right back to the state shared file stores were meant to overcome. Versions prevent that. Every save records the previous state, so every step can be undone, whether it happened a minute ago or half a year ago. OpenCloud puts this principle briefly in its product scope: every change is visible and recoverable, and you can't break anything.
Storage cost of unlimited versions
Until now this time machine came at a price that grew with every hour of shared work. OpenCloud never deleted versions, so a spreadsheet a team edits every working day for a year sits on disk more than two hundred times, backed up and replicated. Someone might still need yesterday afternoon's state today, but hardly anyone needs last March's. Both still cost the same storage. Operators faced an unsatisfying choice: let the pile grow, or turn off versioning and give up the safety that makes working together free of fear in the first place. The request for a third option has been an issue in the repository since August 2025 and has collected 31 reactions there.
With OpenCloud 9.3.0 you can keep the time machine without it overflowing. The approach follows the observation that a version's value decreases with age but doesn't disappear. If you want to undo a mistake from this morning, you need a dense sequence of states; to go back to where things stood a month ago, one state per day is enough, and someone looking for a version from last year finds what they mean with one state per week. The auto strategy mirrors this decreasing density: within the last minute it keeps one version per ten seconds, within the last hour one per minute, within the last day one per hour, within the last thirty days one per day, and beyond that one per week. In each time window it keeps the oldest version, because that one holds the content the file had at the window's start.
Where operators need fixed limits, auto can be combined with them. The strategy 7d, auto, 90d leaves everything from the last week untouched, thins out up to ninety days and deletes anything older; 10 keeps the ten newest versions, 30d everything from the last thirty days. You set it in STORAGE_USERS_REVISIONS_CLEANUP_STRATEGY; by default the feature is off.
Thinning with fixed exceptions
So that cleanup never costs a version that is still needed, fixed exceptions apply. The current content of a file is always left alone, and cleanup skips files with an upload in processing. After a restore, the version holding the replaced content is kept until the file changes again, even if an age limit would otherwise catch it. If you accidentally restored the wrong version, you can undo that step too.
For operators who don't want to turn on a strategy blindly, there is a dry run. The tool that cleans up the existing data retroactively shows, with --dry-run --verbose, for every version whether it would stay or go and why, and at the end reports how much storage would be freed:
opencloud storage-users revisions cleanup --all --strategy "7d, auto, 90d" --dry-run --verbose
The dry run changes nothing on disk, so you can compare several strategies one after another against the real data until saved storage and remaining history fit together. Once you've decided, the server applies the strategy to every file as soon as it gets a new version, with background workers doing the work so no upload has to wait. Files that nobody changes anymore are covered by the same command without --dry-run, once across all existing data and then as a nightly job. This requires the metadata cache to be shared between processes, for example with STORAGE_USERS_FILEMETADATA_CACHE_STORE=nats-js-kv. Otherwise the running server doesn't learn about the deleted versions, and the command aborts.
The feature also changes how OpenCloud determines a version's age. Until now it used the content's modification date, so a document saved in August and edited in December left behind a version that immediately counted as four months old. Now what counts is the moment the version was created. A limit of thirty days therefore means what anyone would expect: you can still restore a change thirty days after it was made.
Next, personal and project spaces will be configurable separately; the pull request for this is in review. A team space where many people work on the same files can then keep a longer memory than a private file store.
Sources
- Product Scope: What OpenCloud Is and What It Isn't, GitHub, 2026-09-29
- 🧹 Clean-Up File Versions, GitHub, 2025-08-28
- feat: clean up old revisions according to a cleanup strategy, GitHub, 2026-11-24
- storage-users README: Clean Up Old Revisions, GitHub, 2026-11-23
- feat: a revision cleanup strategy per type of space, GitHub, 2026-11-24