Controlling Orthanc disk usage with recycling and protection

Orthanc can delete its oldest patients automatically to stay within a disk or patient limit, and protected patients are kept. This page covers how to configure recycling safely and when adding storage is the better choice.

On this page

Controlling Orthanc disk usage with recycling and protection

If an Orthanc buffer or cache is filling its disk, the fix is to bound it with recycling, so the server deletes old content on its own instead of running out of space. Orthanc recycles disk space by deleting the patient stored longest once either MaximumStorageSize or MaximumPatientCount is exceeded. Recycling is driven by those two limits, and the decision you make first is whether the instance should hold data temporarily at all. Use recycling when Orthanc acts as a staging point, a cache in front of a permanent archive, or a short-term buffer for a modality or site whose content is already stored elsewhere. Do not use it on an instance that is the only copy of clinical images, because the oldest patient is removed without a further check.

Patients can be protected from recycling, which lets you keep specific studies, such as those awaiting a read or a legal hold, while the rest of the buffer rotates. Setting both MaximumStorageSize and MaximumPatientCount to 0 disables recycling entirely, so the instance grows until the disk is full. Confirm which of these behaviors your Orthanc version applies in your own test environment, and check how protected patients count toward the limits, since a buffer full of protected studies will not recycle anything. Read the Orthanc terminology of advanced features page before you set limits, because the exact semantics matter for the design.

Add storage instead of recycling when the content must remain available, when deletion would break a retention or audit requirement, or when the buffer is not really a buffer. Growth in the archive is a sizing question, not a cache setting, and recycling only hides it. Before you choose, ask your team to confirm the retention rules that apply to each dataset, the recovery point expected for a lost instance, and whether a second copy already exists elsewhere. Those answers decide whether recycling is safe, and they belong in the written scope agreed with any partner before configuration starts.

Recycling settings and when each fits

This table compares the two recycling limits, the per-patient protection flag and the both-zero setting that turns recycling off. Read each row for its typical use case and the risk it introduces, then match the setting to whether the Orthanc instance is a bounded cache, a fixed-size buffer or a permanent archive. The main takeaway is that recycling removes the oldest unprotected patient automatically, so the risk is almost always data loss rather than a full disk.

SettingTypical use caseMain risk
MaximumStorageSizeBounded cache where disk use is capped in bytes and the oldest unprotected patient may be removed once the limit is exceededStorage is measured in bytes, so a few very large studies can trigger deletion of many smaller patients; confirm the unit and behavior in your version
MaximumPatientCountFixed-size buffer that holds a set number of patients, such as a staging server between a modality and a PACSPatient count ignores study size, so the disk can still fill if studies are large; pair it with disk monitoring
Patient protection flagKeeping specific patients, such as studies awaiting reading or under a legal hold, out of recyclingProtected patients are not recycled, so protected data can fill the disk and block new storage; track protected volume
Both limits set to 0Permanent archive where nothing may be deleted automatically and storage is expanded by handDisk growth is unbounded; without storage alerts and capacity planning the instance can run out of space and stop storing
Recycling with no protectionShort-lived buffer where every patient is safe to delete once forwardedStudies not yet sent or read can be lost; confirm forwarding or archiving completes before recycling reaches them
Recycling with protection in useHybrid cache where clinically active studies are protected and older ones recycleOperators may forget to unprotect patients, so protected volume grows silently; review the protected list regularly

Setting up recycling without losing needed studies

This sequence sets a storage or patient-count limit on an Orthanc instance, protects the studies that must stay, and proves on a test copy that recycling removes the oldest unprotected patient first. The result is a buffer or cache that stops filling its disk without deleting studies that someone still needs.

  1. Confirm the Orthanc version and instance role

    The team responsible for the server checks the installed Orthanc version through the system information in Orthanc Explorer 2 or the REST API, then records whether the instance is a cache, a modality buffer or a long-term archive. Recycling suits buffers and caches, where copies exist elsewhere, and it carries much higher risk on an archive that holds the only copy of its studies. Read the recycling description in the Orthanc Book terminology page for the version in use before continuing. Done when the version and role are written in the change record and the data owner agrees that recycling is appropriate.

  2. Decide the limit from available storage

    Work out how much disk the Orthanc storage directory can use after the operating system, logs, the database and other workloads are counted. Then choose either MaximumStorageSize, which caps stored data, or MaximumPatientCount, which caps the number of patients. Base the choice on the study volume the site receives and how far back the site must reach. Ask the vendor or the Orthanc Book to confirm the unit each setting expects for your version. Done when the chosen value leaves headroom for the database and temporary files, and the data owner has approved the figure in writing.

  3. Set the limit in the configuration file

    Edit the Orthanc JSON configuration file and set MaximumStorageSize or MaximumPatientCount, leaving the other value at 0 so that only one rule applies. Setting both values to 0 disables recycling, so confirm that the value you entered is the one you intend. Back up the previous configuration file, then restart Orthanc through the service manager or container orchestrator so the new file is loaded. Query the system information to confirm the running instance reports the value you wrote. Done when the running instance shows the expected limit and the backup of the old file is stored with the change record.

  4. Protect patients that must stay

    Identify the patients that must survive recycling, such as studies under a hold, teaching cases or studies awaiting interpretation. Mark each patient as protected through Orthanc Explorer 2 or the REST API, and confirm the exact protection call for your version in the Orthanc Book. Protected patients still occupy disk space, so a long protected list can leave recycling with nothing to remove. Compare the protected count with the storage headroom from step two. Done when a query for protected patients returns exactly the list the data owner approved, and that list is filed with the change record.

  5. Test on a non-production dataset

    Load anonymized or non-identifying studies into a separate Orthanc instance that runs the same version and the same limit as the planned production setting. Ingest enough studies to pass the configured limit so recycling actually runs. Record the patient count and storage size before ingest, during the run and after it finishes. Do not run this test against the production archive. Done when the logs show recycling events and the instance stays within the configured limit once ingest completes.

  6. Verify the oldest unprotected patient is removed

    Note the oldest unprotected patient in the test instance, then keep ingesting until recycling runs. Check that this patient is the one deleted and that every protected patient remains. Confirm the result with a patient lookup and by comparing the remaining patient list with the expected set. Then repeat the test with a protected patient stored as the oldest, to confirm that protection overrides age. Done when both runs match the expected outcome and the test report is filed before the setting goes to production.

Security and operational risks of automatic deletion

Recycling removes the oldest patient when a limit is reached, so every study the archive must keep needs protection, a backup, and a clear owner. The cards below cover the failure modes that turn a disk limit into lost clinical or legal records, and the access controls that decide who can change those limits.

Silent loss of unprotected studies

When MaximumStorageSize or MaximumPatientCount is exceeded, Orthanc deletes the patient stored longest without asking an operator. Nothing in the normal workflow warns the team before the deletion happens. Check which patients are unprotected, how many are stored under the limit, and whether anyone receives an alert when recycling runs. Test the rule on a copy of the archive first, using a limit that is deliberately small.

Value that disables recycling
0
Terminology docs

Clinical and legal retention conflicts

A study that is still needed for follow-up, a second read, a medico-legal review or a research protocol may be the oldest item in the store. Recycling does not know which retention rule applies to a given patient. Ask your clinical governance and legal teams which record types must survive the buffer and confirm the retention period for each one in writing before you set any limit.

Protection that gets forgotten

Protecting a patient is a manual state that stays in place until someone changes it, so protections accumulate or are never applied. A study protected for a short review can remain protected for years, and a study that should be protected may never be. Assign an owner for protection decisions, record why each patient was protected, and review the protected list on a schedule your team sets.

Backups for anything that must persist

Recycling is not a backup policy. Anything that must persist beyond the buffer needs a copy in a separate archive, exported or mirrored before it can be recycled. Confirm where that copy lives, how often it is refreshed, and whether a restore has been tested. Treat the recycling buffer as a cache of the archive, not as the archive itself.

Access to protection and limits

Whoever can change MaximumStorageSize, MaximumPatientCount or patient protection can change what the archive keeps. Orthanc only accepts HTTP connections from localhost by default. If RemoteAccessAllowed is enabled, the Orthanc security FAQ says AuthenticationEnabled should be true with users defined in RegisteredUsers, and it recommends HTTPS and a reverse proxy for Internet exposure. Limit administrative rights to named people and log who changed a limit.

Security FAQ

Scripts and routes that delete data

Automation can remove or overwrite data in ways recycling cannot track. The Orthanc security FAQ warns that the /tools/execute-script route can run any system command and that the export route can overwrite files, so both should stay disabled. Review every script, plugin and reverse proxy rule that can call delete or protect endpoints, and confirm that only approved service accounts reach them.

Security FAQ

When to add storage instead of recycling

A buffer or cache Orthanc is a place where images pass through before they reach a permanent archive, or where recently used studies sit for fast viewing. In this role, recycling is usually the right tool. Orthanc deletes the patient stored longest once MaximumStorageSize or MaximumPatientCount is exceeded, so the buffer stays within its disk without manual cleanup. The main risk is deleting an image that has not yet been forwarded or read, so the forwarding path has to finish before the oldest data is removed.

  • Confirm forwarding completes first: Check that every study reaches its destination, such as the archive or a modality, before recycling can reach it.
  • Size the limit to peak load: Base the limit on the busiest day you expect, not the average, and test it with a realistic burst of studies.
  • Protect studies still in use: Protect patients that a radiologist or workflow still needs, using the protection feature.
  • Watch the monitoring signal: Alert when the buffer runs near its limit, because recycling then runs continuously.

Confirm with your own team how long a study must remain on the buffer and what the disk price is for the capacity your provider can supply.

Limits to confirm in your environment

Recycling only protects a buffer if the limits behave as expected in your exact setup. The checks below cover the Orthanc version, the database and storage back ends, replicas and mirrors, and very large studies, and each one should be tested in a non-production copy before go-live.

Confirm behavior on your Orthanc version

Orthanc 1.13.0 was released on 2026-08-15 with a rewrite of storage-area access, DICOM parsing and transcoding aimed at caching and memory use. Recycling depends on how the server tracks stored bytes and patients, so read the release notes for the version you plan to run and reproduce your limit test on that exact build. Do not assume behavior carried over from an older release you tested previously.

Orthanc release notes

Check recycling with your database back end

Recycling removes the patient stored longest once a limit is exceeded, so the index must be accurate about what is stored and when. Confirm how the SQLite index and a PostgreSQL or MySQL plugin each report stored size and patient counts in your deployment. Ask whether recycling is evaluated per Orthanc node or once for a shared database when several instances write to the same index.

Check object storage and file deletion

If DICOM files live in S3, Azure or Google Cloud storage rather than on local disk, confirm that recycling removes the stored objects, not only the index entries. Orphaned files keep consuming paid capacity while Orthanc reports free space. Test a full delete cycle and check the bucket or container afterward.

Verify deletions reach replicas

A recycled patient deleted on a primary instance is not automatically removed from a mirror or peer that holds its own copy. Decide whether each replica should recycle independently, and whether the replica must keep data the primary has already dropped. Confirm the replication method you use propagates deletions, and test a failover after a recycling event.

Test protection against recycling

Protected patients must survive every recycling pass, including passes triggered while a study is still being received or re-sent. Confirm that protection is applied to the correct patient level in your workflow, and that a clinician or script can set and clear it with the access rights you intend. Record who holds that permission.

Orthanc feature terminology

Measure behavior with large studies

A single very large study can push the archive over a limit in one step, and recycling then removes older patients in a single burst. Confirm whether a limit is checked before or after an incoming study is stored, and whether an oversized study is rejected, kept or triggers deletion of everything else. Use representative study sizes from your modalities, not small test files.

Questions teams ask before configuring Orthanc recycling

Can DeployOpen set up Orthanc recycling and patient protection for us?

Yes, DeployOpen implements open-source platforms inside your own infrastructure, including Orthanc, and that work can include setting MaximumStorageSize or MaximumPatientCount, deciding which patients are protected from deletion, and testing what happens when the limit is reached. The work is planned as a fixed-scope engagement, with scope, deliverables and timelines agreed in writing before work starts. Recycling is a configuration choice, so the first step is confirming whether a buffer or cache role is the right fit for your archive at all, since a long-term archive usually should not delete studies automatically.

What drives the effort for Orthanc recycling work?

The main drivers are the retention policy, the number of Orthanc instances, the storage back end and how much validation you need. A single instance writing to local disk with a clear rule for which studies may be deleted is a small task. Several instances sharing a PostgreSQL index, object storage such as S3 or Azure, or a rule that protects studies by clinical status adds design and testing work. Recycling also interacts with how deletions reach any mirrored copy or downstream peer, so confirm those flows early.

Can our team configure recycling without outside help?

Yes, a team with Linux or Docker skills and access to the Orthanc Book can set the two recycling values and test them on a copy of the archive. The parts that usually need care are deciding which patients must never be deleted, confirming that deletion behavior matches your storage and retention records, and proving that protected studies survive a full disk test. If you want an outside review of that design, DeployOpen can provide it as part of a fixed-scope engagement, and Orthanc Team also sells services as described below.

What do we need to provide before the work starts?

Prepare your retention rules in writing, including which studies may be recycled, which must be protected and who approves exceptions. Provide storage sizing data such as current disk capacity, average study size and monthly intake, so the recycling limits can be set against real growth. Test datasets matter as well: a representative set of studies, with modalities and sizes like your production traffic, lets the team confirm recycling behavior without touching clinical data. Also confirm the Orthanc version and database back end you run.

How long does recycling work take?

Duration depends on scope: a single instance with written retention rules and a test dataset is a much smaller piece of work than a multi-instance cluster with object storage and audit requirements. No duration is given here because none has been researched for this topic, so ask for a timeline in the written scope, which should list the instances, storage back end, validation steps and retest dates. Ask the provider to state which of those steps depend on your approvals, since those are often the slowest part.

Does Orthanc have a paid edition or a support option?

Orthanc has no paid edition. The core is open source under the GPLv3 or later, and some plugins are licensed under the AGPLv3 or later. Orthanc Team SRL sells deployment, configuration and development services, including pre-paid dedicated support hours that are valid for 12 months, and these are quoted on request. Check the license terms of any plugin you plan to use, since the Orthanc Book licensing FAQ explains the differences in detail.

What is the cost of recycling work compared with adding storage?

Recycling is a configuration and design task, while adding storage is a capacity purchase plus migration work. Recycling deletes data, so its cost includes the risk of losing studies that someone needed, which is why retention rules and protection come first. Ask for a quote that separates design, configuration, testing and any ongoing review, and ask whether the storage option has recurring hardware, cloud or licensing costs. Compare both options against your retention obligations before choosing.

How a new study triggers recycling

The diagram starts when a new study arrives at the Orthanc instance and is written to storage. Orthanc then compares the archive against MaximumStorageSize and MaximumPatientCount. If a limit is exceeded, it deletes the patient stored longest, skipping any patient marked as protected, and checks again. If no limit is exceeded, the study stays. The decision point to check is the branch where only protected patients remain, because recycling cannot free space there and storage must be added.

Recycling runs after each stored study and stops when no limit is exceeded or no unprotected patient remains.

How DeployOpen scopes this work

DeployOpen plans and implements Orthanc recycling inside your own infrastructure, whether that is your cloud account, a data center or an air-gapped network. The scope usually starts with a decision that belongs to you and your imaging or clinical owners: which studies may be recycled, which must be protected, and how much storage the buffer or cache may use before it starts deleting. We turn those answers into MaximumStorageSize and MaximumPatientCount values, the protection rules applied to specific patients, and a written retention document that names who may change them and how changes are approved.

Before handover, we test recycling against a copy of your real workflow. That covers confirming that the oldest unprotected patient is removed first, that protected patients survive, that both limits set to 0 leaves nothing deleted, and that storage growth alarms fire before the disk fills. The test results, configuration files and operating notes are delivered with the system so your own team can repeat the checks later. Most engagements are fixed-scope, so the systems to configure, the tests to run and the deliverables are agreed in writing before work starts. Ask any provider to state exactly what is included, which environments are covered and who performs the retest.

Ongoing work such as changing retention limits as volumes grow, reviewing protection lists, upgrading Orthanc and rerunning recycling tests is available as a retainer, so the rules keep matching the archive over time. Pricing follows from the written scope, and DeployOpen does not publish a price list. Before you request a quote, confirm with your own storage and clinical teams how long studies must remain available, whether a second copy exists elsewhere, and whether storage expansion is cheaper than recycling for your setting. Those answers determine the scope more than any default setting does.

How DeployOpen delivers Orthanc storage controls

DeployOpen plans, implements, documents and supports self-hosted open-source platforms inside your own infrastructure, including the Orthanc settings that decide what gets deleted when disk space runs low. We start from how your buffer or cache is meant to behave, then agree the recycling limits, patient protection rules and storage thresholds in writing before any configuration changes are made.

How we scope

  • Written scope lists the Orthanc instances, storage paths and expected study volumes covered by the recycling work.
  • Scope records whether MaximumStorageSize, MaximumPatientCount or both will be used, and why.
  • Scope names which patients or studies must be protected from recycling and who approves that list.

How we build

  • We configure recycling limits and protection rules in a staging copy of your Orthanc setup first.
  • We test that the oldest patient is removed as expected and that protected patients remain untouched.
  • We check the disk growth and alert thresholds against the storage capacity your infrastructure provides.

How we hand over

  • You receive the final configuration, a written description of recycling behavior and the protection procedure.
  • Runbooks explain how staff protect or release a patient and how to confirm which studies were removed.
  • We document the criteria for adding storage instead of relying on recycling, so the decision is repeatable.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Before any change to recycling limits, confirm the new values with your clinical and data governance owners.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.