Backing up and restoring Orthanc

Backing up an Orthanc archive means protecting the index and the DICOM files together, then proving a restore works. This page explains the options, the build sequence and what to confirm before you rely on it.

On this page

Why backing up an Orthanc archive takes two copies that must match

A hospital or imaging group that keeps patient studies in Orthanc needs to recover from loss, and the first thing to settle is that Orthanc does not keep its state in one place. The index database records patients, studies, series and instances, while the DICOM files themselves sit in the storage area on disk or in object storage. The configuration file, plugin settings and any saved jobs add a third set of state on top. The index uses SQLite by default and PostgreSQL when the PostgreSQL plugin is installed. Backup scope and consistency are therefore the central decisions: a copy of the database without the matching files, or files without the index that points to them, may not restore to a working archive.

The practical risk is drift between the two copies. If the database is captured at one moment and the storage area at another, the index can reference files that are missing or hold files the index does not know about. For SQLite, the safe approach is a cold backup taken while Orthanc is stopped, so the database and files are captured in the same state. For PostgreSQL, the database can be backed up while Orthanc runs, but the storage area must still be captured in a way that matches the database snapshot. Ask your team to document which snapshot time each copy represents and how the two are tied together, including the configuration version in use at that time.

DeployOpen plans and tests this as part of a fixed-scope engagement, with the backup scope, consistency method, restore procedure and a restore test agreed in writing before work starts. Before any engagement, confirm which index engine you run, where the storage area lives, how much data must be recovered and within what window, and who on your side holds the restore decision. A backup that has never been restored into a clean environment is an assumption, not a control, and the restore test is where the two copies are proven to match.

Cold backups for SQLite versus hot backups for PostgreSQL

With the built-in SQLite index, the simplest consistent backup is a cold backup: stop Orthanc, copy the index database and the storage area together, then start Orthanc again. Because nothing writes during the copy, the index and the DICOM files describe the same moment. This approach suits small or single-site archives. The cost is downtime, which grows with the size of the storage area, and the window must be scheduled around modality traffic and clinical use.

  • Downtime window: Orthanc does not accept or serve requests while it is stopped, so the copy must fit a window agreed with clinical and imaging teams.
  • Single copy set: The index file and the storage directory are copied at the same stop point, which removes most consistency risk.
  • Team skills: Operators need only file-level copy tools, a service stop and start procedure and a tested restore runbook.
  • Storage growth: Copy time and backup storage grow with the archive, so the window can lengthen over time.
  • Scale limit: The Orthanc scalability FAQ advises replacing SQLite once an archive holds several hundred thousand instances, so cold backups of SQLite are a practical choice mainly below that size.

Before relying on this method, confirm the exact file locations for your installation and run a restore test on a separate host.

Backup options and when each fits

This table compares the four backup approaches that fit an Orthanc archive, covering what each protects, the consistency it needs and the setups it suits. Read each row against your database engine and storage layer, because an index backup and a file backup only restore a working archive when they were taken at the same point in time.

ApproachWhat it protectsConsistency requirementWhen it fits
Cold file copy (SQLite)The SQLite index file and the DICOM storage folder togetherOrthanc stopped so the index and files are not changing during the copySmall single-instance archives with a maintenance window in which Orthanc can be stopped
PostgreSQL logical dumpIndex tables in a portable SQL or custom-format file, copied with the storage folderA dump is a snapshot of the database at one moment, so the storage copy must match that moment or be reconciled afterwardSmaller PostgreSQL archives, or restores into a different PostgreSQL major version where a portable dump is the simplest path
PostgreSQL base backup with WAL archiving (point-in-time recovery)The full database cluster plus the transaction log, allowing restore to a chosen momentRequires continuous archiving of write-ahead log segments so the base backup can be replayed to a consistent pointLarge or busy archives that need hot backups and restores to a point before an accidental deletion; see the PostgreSQL continuous archiving and point-in-time recovery documentation
Storage-layer snapshotsVolumes or file systems holding the database and DICOM files, captured togetherOnly consistent if the database and file storage are snapped at the same instant or the database is quiesced firstArchives on a SAN, Ceph or virtualized platform where the storage team already takes crash-consistent snapshots and restore tests are run
Object storage versioningObject copies of DICOM files kept under a versioned bucket, with deletes recoverableProtects files only; the index still needs its own backup and must be reconciled with the object versionsArchives that use S3, Azure or Google Cloud storage plugins, to be confirmed against the retention and lifecycle rules in your environment

Build the backup sequence and check each step

This sequence turns a loose collection of Orthanc files and database dumps into a repeatable backup set that can be restored with a known order and a verified result. Each step ends with a check so the team knows the copy is usable before it relies on it.

  1. Inventory the index, storage area and configuration

    List every component that makes up the archive: the index (SQLite database file or PostgreSQL database), the storage area holding DICOM files (local disk or object storage bucket), the Orthanc configuration file, any plugin configuration, Docker compose files or service definitions, and certificates or keys used for HTTPS and DICOM TLS. Record where each lives, which host or account owns it, and which Orthanc version and database plugin version are in use. Check: a written inventory where every item has a location and an owner, and someone who did not write it can find each item from the list alone.

  2. Choose a consistency method for each component

    Decide how the index and the files will be captured so they describe the same point in time. For SQLite, the usual approach is a cold backup taken while Orthanc is stopped, so the database file is not copied mid-write. For PostgreSQL, a hot backup can be taken while Orthanc runs, using a logical dump or base backup with continuous archiving, as described in the PostgreSQL continuous archiving documentation. Confirm with your Orthanc version and plugin documentation which method your setup supports. Check: a short written decision per component stating the method, who runs it, and how index and storage are kept in step.

  3. Schedule and encrypt the backup jobs

    Create one scheduled job per component, with the storage copy and index copy triggered in a defined order so they match. Encrypt backup archives before they leave the host, using keys held outside the backup itself, and restrict who can read or restore them. Keep the job logs. Check: a dry run that produces an encrypted archive for each component, and a log entry showing the job's start, end and exit status. Confirm the schedule against your recovery expectations with the business owner, since the Orthanc project does not set one.

  4. Store copies off the primary host

    Send each encrypted archive to at least one location that does not depend on the Orthanc host, such as a separate storage system, a second data center, or a dedicated backup account in your cloud. Apply retention rules that keep enough history for clinical and legal needs, and confirm the retention period with your compliance team. Check: a listing from the off-host location showing the latest index and storage archives with matching timestamps, and a test that the copy is readable from a machine other than the Orthanc host.

  5. Verify backup integrity

    Confirm each archive is complete and unchanged. Compare checksums recorded at creation with checksums computed on the stored copy, and open the index backup with the database tool to confirm it is readable. For the storage area, compare file counts and total size against the source at the time of backup. Check: a verification report listing the checksum match, the database read result and the file count comparison for every backup set. A backup without this report is not counted as complete.

  6. Test a restore into an isolated environment

    Restore the index and storage area onto a separate host, start Orthanc there with the copied configuration, and confirm that studies can be queried and retrieved. Check a sample of studies by Study Instance UID and compare instance counts with the source. Do not connect the test instance to production modalities or peers. Check: a restore log, a list of sampled studies that opened correctly, and a note of any mismatch with the cause recorded.

  7. Document the restore order

    Write the restore runbook in the order the restore must happen: stop Orthanc, restore the index and the storage area from the same backup set, restore configuration and certificates, start Orthanc, then check the database and file counts. Include the commands used, the paths, the credential holders and the checks at each stage. Keep the runbook with the backup inventory and review it after each Orthanc or PostgreSQL upgrade. Check: a runbook that a second engineer has followed end to end in a test restore without asking the author for help.

Keeping the index and DICOM files in sync after a restore

An Orthanc restore can succeed at the file level and still leave the archive broken. The index database (SQLite or PostgreSQL) holds rows that point to DICOM files in the storage area, and those two halves can drift apart. The failure looks like one of two cases: index rows that reference files missing from the restored storage area, or files on disk with no matching index rows. The first makes studies appear in searches but fail on retrieval. The second leaves data that no query can reach. Both happen when the database and the storage directory or object store come from different points in time, which is why the backup plan must capture them together, as described earlier in this page.

Reconcile before you return the instance to clinical use. Compare the instance count and study count reported by the REST API against what the database and storage backend should hold, and sample a set of studies across the date range to confirm each retrieves completely. Confirm with Orthanc Team or the Orthanc Book how your version expects missing or orphaned files to be handled, including whether any built-in consistency check or re-indexing step exists for your storage plugin, and whether it needs the instance stopped. Do not run a cleanup that deletes files until you have confirmed which side of the mismatch is authoritative, and keep a copy of the pre-cleanup state so the decision can be reversed.

Restore tests should measure what clinicians and modalities actually depend on. Checking that files exist on disk proves very little, because an orphaned file is invisible to queries and a missing file can sit behind a valid index row. Instead, record the study and instance counts before the backup, restore into an isolated environment, then query and retrieve a defined sample of studies through the DICOM and REST paths and compare the results with the source. Repeat the check on a schedule, since a restore that passed last quarter says nothing about the backup taken yesterday. Document the sample, the expected counts and who signs off, so the test can be rerun by someone other than the original operator.

Protecting backups of patient imaging

A backup of an Orthanc archive contains the same patient images and metadata as the live system, so it needs the same controls. The cards below cover the access, credential, encryption, retention and administrative exposure points that connect the index, the DICOM files and the configuration you restore from.

Access to backup repositories

Backups of the Orthanc index and file storage are copies of patient data, so the repository holding them needs the same access restrictions as the archive itself. Limit read and write rights to the backup job and a small restore group, and log access to the repository. Confirm with your compliance team who may read a backup, how long access logs are kept, and whether a restore request needs a second approver.

Encryption at rest and in transit

Encrypt backup copies at rest in the storage you control, and move them over encrypted channels between the Orthanc host, the database server and the backup target. Orthanc supports DICOM TLS for exchanges with other sites, but that setting does not protect files written to a backup location. Check with your security team which key management system holds the keys and how keys are restored if the host is lost.

Credentials for the PostgreSQL role

A backup job that dumps or replicates the PostgreSQL index needs its own database role with only the privileges the backup requires, not the role Orthanc uses to serve requests. Store its password outside configuration files that get copied with backups, and rotate it on a schedule. The PostgreSQL authentication methods document lists the options your environment can use, including certificate and SCRAM-based password authentication.

PostgreSQL authentication methods

Retention and deletion of backups

Backups hold patient images after they are deleted from the live archive, which is a common gap in retention policies. Define how long each backup generation is kept, who approves deletion of older copies, and how deleted patients are removed from every generation. Ask your legal and compliance teams which retention periods apply to your jurisdiction before you set the rotation schedule.

Keeping administrative routes disabled

Restoring a backup should not require opening administrative access on the running server. Keep the /tools/execute-script route and the export route disabled, because the security FAQ warns that the first can run system commands and the second can overwrite files. If you enable remote access for restore work, set AuthenticationEnabled to true with users defined in RegisteredUsers, and disable the access again after the restore test.

Orthanc security FAQ

How the index, storage and configuration flow into backups

The diagram starts at the running Orthanc instance, which writes study metadata to its index database and DICOM files to the storage area. Both must be captured together with the configuration files so they describe the same archive. The backup copies move to a separate target, and a restore path rebuilds the instance only after a verification step confirms that the index and files still match. Treat a restore that has not been verified as an unfinished backup.

Index, storage area and configuration captured together, with a check before restore is accepted.

Restore tests that prove the archive is recoverable

A backup that has never been restored is an assumption, not a recovery plan. The cards below describe a restore test that rebuilds the archive on an isolated host and checks it against the source, so the team learns whether the index, files and configuration come back together. Set the pass criteria and recovery time targets with your clinical and IT owners before the first test.

Restore to an isolated host

Rebuild the Orthanc instance on a separate host or network segment that cannot reach production modalities, peers or the live database. Restore the PostgreSQL dump or base backup, the storage directory or object store copy and the orthanc.json configuration from the same backup set. Isolation matters because a test instance that reconnects to live modalities or peers can send or receive data it should not. Confirm that the restored instance starts with its DICOM and HTTP ports changed or disabled.

Compare study and instance counts

Record study, series and instance counts from the source archive at the moment the backup was taken, then compare them with the restored instance. Counts from the REST API statistics route are a fast first check, but a match does not prove that every file is readable. Investigate any difference before accepting the restore, because a missing count usually points to an index and storage mismatch rather than a cosmetic error.

Retrieve sample studies through REST

Pick a sample of studies across different ages, modalities and sizes, then retrieve them through the REST API on the restored instance and check that the DICOM files open and match the originals, for example by comparing checksums or pixel data. Include at least one large multi-frame study and one study stored long ago. Sampling catches problems in the file store that count checks miss, such as files that exist in the index but cannot be read from disk.

Scalability FAQ

Check version compatibility

Confirm that the Orthanc version and the database plugin version used for the restore match the versions that wrote the backup, or that the restore runs through a documented upgrade path. Also confirm that the PostgreSQL major version on the restore host is compatible with the dump or base backup. Check the supported PostgreSQL versions and their end-of-support dates before choosing a target, since a restore onto an unsupported server creates its own risk.

PostgreSQL versioning policy

Record measured recovery time

Time each step of the restore, from retrieving the backup set through the first successful study retrieval, and record the total as the measured recovery time. Repeat the test on a schedule and after major changes such as a storage move or an Orthanc upgrade, so the trend is visible. Compare the measured figure with the recovery time objective agreed with clinical and IT owners. If no target exists yet, agree one before the test rather than setting it from the result.

Log and sign off each test

Keep a written record of each restore test: the backup set tested, the host used, the versions, the counts compared, the sampled studies, the measured recovery time and any failures with their fixes. A dated record is the evidence that recovery was tested, and it gives the team a checklist to repeat. Assign a named owner to review the record and to decide whether the archive is recoverable against the agreed targets.

Questions teams ask before backing up Orthanc

How much effort does a backup design for Orthanc take?

The effort depends mainly on how many components hold state and how they must stay consistent. An Orthanc archive has two parts that must match: the index (SQLite by default, or PostgreSQL through the database plugin) and the DICOM files in the storage area, which may sit on local disk or in object storage. Design work covers choosing a backup method for each part, deciding how the index and files are captured together, setting retention, and documenting the restore order. Teams with a single SQLite instance and local storage have less to design than teams running PostgreSQL, several nodes or cloud object storage. Ask the vendor or partner to list each component, its state and the agreed recovery steps before accepting a quote.

Can our own team build an Orthanc backup plan without a partner?

Yes, a capable team can build a plan in-house if it has the time and the skills to test it. The work requires access to the Orthanc host, the database server and the storage location, plus clear ownership of the restore procedure. The risk usually lies in untested assumptions, such as a copy of the database taken while files are still being written, or a backup that omits the configuration file. An outside partner adds an independent review and a written scope, which helps when your internal staff are already committed to other systems. Whichever route you choose, confirm who performs each restore and who signs off that the restored archive opens correctly.

What does a backup project need from our infrastructure and staff?

The project needs read and write access to the Orthanc configuration, the index database and the storage location, plus a backup target that is separate from the production system. Your team should provide the current Orthanc version, the database engine and version, the storage layout and the retention rules that clinical or research users expect. Staff involvement includes a named owner for the archive, someone who can approve a maintenance window for cold backups, and a contact who can confirm that a restored study is clinically usable. Where you run PostgreSQL, the database team should be involved from the start, because they hold the expertise in continuous archiving and recovery.

How often should we test restores of an Orthanc archive?

Test restores on a schedule you can document, and also after any change to Orthanc, the database plugin, the storage configuration or the backup tooling. A backup that has never been restored is not yet evidence of recoverability. A useful test restores into an isolated environment, starts Orthanc against the restored index and files, and checks that a sample of studies can be queried and retrieved. Record the date, the backup used, the Orthanc version and the result. The frequency should follow how much data loss your clinical or research owners accept and how quickly your archive changes. Agree this interval in writing with the owner of the archive.

Do we need PostgreSQL point-in-time recovery for Orthanc?

You need point-in-time recovery when you must restore the index to a moment between scheduled backups, which is common when data loss of even a few hours is unacceptable. PostgreSQL supports continuous archiving and point-in-time recovery, but this requires configuring WAL archiving and a base backup, and it adds storage and monitoring work. For a small archive that tolerates losing the changes since the last nightly backup, a simpler scheduled dump may be enough. Keep in mind that point-in-time recovery restores the database only, so the DICOM files must still be captured consistently with it. Ask your database engineers to confirm the recovery point objective in writing before choosing the approach.

What does a fixed-scope Orthanc backup engagement include?

A fixed-scope engagement with DeployOpen covers the parts agreed in writing before work starts. Typical items are a review of the current Orthanc and database setup, a backup design for the index and the storage area, the configuration and scripts to run the chosen backups, restore test runs, and documentation of the recovery steps. Deliverables, timelines and exclusions are set out in the agreed scope, and a quote follows from that scope. Items that are often left out, such as application-level changes to viewers or modalities, should be listed explicitly. DeployOpen does not publish a price list, so compare proposals against the same written list of deliverables.

What recurring costs should we expect after the backup design is built?

Recurring costs come from storage for backup copies, the compute and network used to run jobs, staff time for restore tests and monitoring, and any support retainer you choose. One-time costs cover the design, initial scripting, first restore tests and documentation. Storage cost grows with retention length and archive size, so the retention policy is the main lever. Ask any provider to separate one-time from recurring items in the quote and to state what happens when the archive grows substantially. Orthanc itself is free to use, since there is no paid edition, though any services you buy from Orthanc Team SRL are quoted separately.

How DeployOpen scopes and delivers Orthanc backup and restore

DeployOpen starts every Orthanc backup engagement with a written scope that names each backup target before any work begins. For a typical Orthanc archive, those targets are the index database (SQLite files or a PostgreSQL cluster), the DICOM file storage area or object storage bucket, the Orthanc configuration files, and the plugin and Docker or package definitions needed to rebuild the server. The scope also records which Orthanc version runs in production, because a backup is only useful if the same core and database plugin can be reinstalled next to it. Work is delivered inside your own cloud accounts, data centers or air-gapped networks, so backup copies, credentials and restore procedures stay under your control.

The written scope also fixes the restore tests and the handover. A restore test should be defined as a measurable exercise: restore the index and the matching files into a separate host, start Orthanc, and confirm that a sample of studies is queryable and retrievable. Ask your team to decide which studies count as the sample, who signs off on the result, and how the test is repeated after each Orthanc or PostgreSQL upgrade. Handover covers the runbooks, the schedule for backup jobs, the retention rules and the alerts that show a failed job, so your operators can run the process without DeployOpen present.

Ongoing support is available as a retainer for teams that want DeployOpen to keep the backup jobs under review, repeat restore tests on a schedule, and update procedures as Orthanc and PostgreSQL move to new releases. Ask any partner, including DeployOpen, to state in the quote which items are one-time (design, first restore test, runbooks) and which recur (test cycles, monitoring, retainer hours). DeployOpen does not issue audit reports or certifications for backup controls; if an assessor needs evidence, the written scope and restore test records are the artifacts to prepare for that independent review.

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.