MintSmartBackup

The manual

Documentation

From the download to the first verified restore, then the parts you need on a bad day: the schedules, the retention, the restore points, the API and the diagnostics.

Chapter 01

Installation

Two Rust binaries. The server keeps the data, the client sends it. There is no installer, no runtime and no Node.js — the interface is plain HTML that is embedded in the binary.

What you need

  • The server: Linux, 1 core, 1 GB of RAM, a disk for the storage.
  • The client: Windows 10/11 or a modern Linux, 100 MB of RAM.
  • A free TCP port for the server (8787 by default) and the api_token from the configuration file — the client needs it to register.

Build it (or take the binary)

# Rust (stable) and the build dependencies of the web view curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev patchelf # the release build – the custom-protocol feature embeds the interface cargo build --release --features msb-server/custom-protocol,msb-client/custom-protocol # the binaries land in target/release/ ls -la target/release/mintsmartbackup-*
Important

The custom-protocol feature is not optional for a release build: it is what embeds the console into the binary. Without it the server starts but has no interface.

Start the server

  1. Choose the storage

    The storage holds the chunks, the manifests, the reports, the master key and the registry. Put it on a disk with room — and remember that it is the only thing that must survive.

  2. Start it

    ./mintsmartbackup-server --headless \ --config /etc/msb/server.json \ --storage /srv/msb/storage \ --listen 0.0.0.0:8787

    The first start writes the configuration, generates the master key and prints the api_token. Open http://<server>:8787/ — that is the console.

  3. Firewalls and reverse proxies

    The console is a normal web application. Put it behind a TLS terminating proxy if it leaves your network; the bearer token is the only thing that protects the management API.

A note on the options

An option the program does not know is an error (exit code 2) — it is never ignored. A typo in --storage would send the data somewhere else, so a silent mistake is worse than a crash.

Configure the client

The client writes a complete configuration on the first start. Change the three fields that matter:

{ "server_url": "http://msb.example.com:8787", "client_name": "Workstation", "sources": [ { "id": "documents", "path": "/home/you/Documents", "enabled": true, "include": [], "exclude": ["*.tmp", "node_modules/**"], "include_hidden": false, "respect_ignore_files": true } ], "schedule": { "enabled": true, "interval_minutes": 60, "daily_at": null, "weekday": null } }
  • include empty means everything; exclude uses glob patterns (*, **, ?).
  • respect_ignore_files honours .gitignore and .msbignore inside the tree.
  • Hidden files (a name that starts with a dot) are skipped unless include_hidden is true.

Chapter 02

The first backup

Start the client. It registers itself at the server, receives its credentials and does the first run.

  1. Register

    The client sends its name, the hostname and the number of cores. The server answers with a client id and a session token. Both are stored in the configuration — the identity survives a restart.

  2. Scan

    Every source is walked in parallel. The files that did not change since the last run are skipped without being read; the rest are split into content defined chunks. A file that is written while it is read is read again, and if it keeps changing it is left out of the revision and reported.

  3. Upload

    The client asks the server which chunks it already has, sends only the missing ones, compresses them and puts them on the wire. The server verifies the hash of every chunk as it arrives and refuses the ones that do not match.

  4. Close the session

    The manifest of the revision is stored. Any file whose chunks never arrived is dropped here — the revision that reaches the disk is always complete and restorable.

  5. Report

    An HTML and a PDF report are written into the report directory of the client and uploaded to the server. They contain the files, the bytes, the errors and the warnings of the run.

How much is transferred

On the first run: everything. Afterwards: only the chunks of the files that really changed. A file of 2 kB that changed completely costs 32 bytes of traffic — the rest of the data set is not even read.

Chapter 03

The console

The console of the server is a single page with five tabs. It is embedded in the binary — no web server, no CDN, no internet.

  • Fleet — every client with its health, the time of its last backup, the number of failed runs, its schedule, its storage and the state of its last drill.
  • Alerts — the findings of the anomaly engine with their severity, their state and the action to take. A finding can be acknowledged; it is resolved automatically when the condition is gone.
  • Restore & integrity — the catalogue of the revisions, the drill, the restore into a directory or into a zip, and the file browser for a granular restore.
  • Deep report — the whole fleet as HTML and as PDF: the health, the storage, the traffic of the last 24 hours, the findings and the operator actions.
  • Audit — every change an operator made, with the time, the client and the result.

Every view is also available as a deep link (?tab=alerts), so a specific page can be bookmarked or sent to a colleague.

Chapter 04

Schedules

A schedule can be expressed in three ways. The earliest upcoming trigger wins:

  • Interval — every N minutes.
  • Daily — at a given local time, e.g. 02:30.
  • Weekly — on a given weekday at that time.
"schedule": { "enabled": true, "interval_minutes": 0, "daily_at": "02:30", "weekday": null }
A weekday wins over the daily trigger

If a weekday is set, the schedule is a weekly one. The daily candidate is not added in that case — otherwise it would always be earlier and the weekly schedule would silently become a daily one.

The server can enforce a schedule per client (it overrides the one of the client) and can ask a client to back up now with the force backup switch in the fleet view.

Chapter 05

Retention & immutability

How long a restore point survives is a policy, and the policy is per client (the policy of the server is the default).

POST /api/v1/clients/<id>/retention { "retention": { "keep_last": 20, "keep_daily": 14, "keep_weekly": 8, "keep_monthly": 12, "max_age_days": 0 } }
  • keep_last — the newest N revisions, whatever their age.
  • keep_daily / weekly / monthly — one revision per day, week or month (the grandfather–father–son scheme).
  • max_age_days — nothing older than this survives. It wins over the write protection.

The garbage collector

Deleting a revision does not free the disk by itself — the chunks are shared. The collector deletes the chunks that no manifest of any revision references any more. It is deliberately conservative:

  • it never deletes a chunk that an open upload session refers to — a client that was told that the server already has a chunk will not send it again;
  • it skips a client completely when its manifests cannot be read.
POST /api/v1/storage/collect

Write protection

POST /api/v1/protection { "immutable_days": 30, "immutable_lock": false }

A revision that is younger than the protection window is never deleted, and the freeze locks the whole repository. The protection always wins over the retention — that is the whole point of it.

Chapter 06

Restore

The drill — the proof

The drill decrypts and verifies every chunk of a revision. It changes nothing and it is the fastest way to find out whether a backup is really usable.

POST /api/v1/clients/<id>/restore/drill { "sample": 0 }

The answer contains the number of files that were checked, the number that are complete, the number of chunks that were verified and the findings. A drill that fails is an anomaly of the client.

Point in time

Every run is a restore point. The catalogue lists them:

GET /api/v1/clients/<id>/revisions

and a restore names the revision it wants:

POST /api/v1/clients/<id>/restore/execute { "mode": "directory", "revision": "6c496b39-…", "target": "/mnt/restore" }

Granular — one file out of a revision

GET /api/v1/clients/<id>/revisions/<rev>/files POST /api/v1/clients/<id>/restore/execute { "target": "/mnt/restore", "files": ["note.txt", "data/note.txt"] }

Both forms of the path find the file. The target directory is created, the original structure of the source is kept inside it, and every file is verified against its hash before it is written.

Safety of the paths

A manifest is untrusted input. A path that contains .., an absolute path, a drive letter or a colon is rejected; the restore never writes outside the target, whatever the manifest says.

Chapter 07

Alerting & metrics

Notifications

The server can send a webhook (JSON) or a mail (SMTP, with STARTTLS or implicit TLS). Four events are supported:

  • a backup failed (the client reports the number of errors),
  • a new critical anomaly appeared,
  • a restore was executed,
  • the protection was changed.
POST /api/v1/notifications { "webhook_url": "https://hooks.example.com/msb", "smtp": { "host": "smtp.example.com", "port": 587, "username": "msb@example.com", "password": "…", "from": "msb@example.com", "to": "ops@example.com" }, "on_failure": true, "on_critical": true, "on_restore": false, "on_protection_change": true } POST /api/v1/notifications/test

Metrics

The server exposes Prometheus metrics on /metrics:

msb_clients_total # the number of registered clients msb_clients_online # the clients that report right now msb_stored_bytes # the bytes on the disk msb_chunks_total # the stored chunks msb_revisions_total # the revisions msb_backups_24h # the successful runs of the last 24 hours msb_backups_failed_24h # the failed runs of the last 24 hours msb_bytes_24h # the traffic of the last 24 hours

Chapter 08

The Windows service

On Windows the client runs as a service so that the machine is protected from the moment it boots.

  1. Register the service

    Run the client once as an administrator with --service. It registers itself with the service control manager, sets the start type to automatic and starts.

  2. Let it notify

    The service shows a toast when it starts, so the user sees that the machine is protected. The message can be switched off in the configuration (service.notify_on_start).

  3. Check it

    sc query MintSmartBackup

    The logs of the service are written into the work directory of the client, next to the state file.

The service is the same binary as the agent — there is no second implementation to keep in sync.

Chapter 09

The API

Two APIs live in one server. The client API authenticates with the credentials of the client; the management API with the bearer token of the server.

The client API

POST/api/v1/register — a new client registers itself and receives its id and its token.

POST/api/v1/session/open — opens an upload session; the answer contains the chunks the server already has.

POST/api/v1/session/<id>/chunk/<hash> — sends one chunk (the hash must match the content).

POST/api/v1/session/<id>/complete — closes the session and stores the revision.

POST/api/v1/heartbeat — the heartbeat; it also carries the last error of the client.

POST/api/v1/me/status — the status of the client including the restore readiness of its newest revision.

The management API

Everything below needs the header Authorization: Bearer <api_token>.

GET /api/v1/clients # the fleet GET /api/v1/clients/<id> # one client POST /api/v1/clients/<id>/retention # the retention policy GET /api/v1/clients/<id>/revisions # the catalogue of the restore points GET /api/v1/clients/<id>/revisions/<rev>/files POST /api/v1/clients/<id>/restore/drill # the proof POST /api/v1/clients/<id>/restore/execute # the restore GET /api/v1/anomalies # the findings POST /api/v1/anomalies/<id>/ack GET /api/v1/audit # the log of the operator GET /api/v1/report/data # the deep report as JSON GET /api/v1/report # the deep report as HTML GET /api/v1/report.pdf # the deep report as PDF GET /api/v1/protection # the write protection POST /api/v1/protection GET /api/v1/notifications # the notifications POST /api/v1/notifications POST /api/v1/notifications/test POST /api/v1/storage/collect # the garbage collector GET /metrics # Prometheus GET /api/v1/health # the health (no token needed)
Strict bodies

A body has to be a JSON object, and a known field has to have the right type — otherwise the answer is 400. Unknown fields are ignored, as usual for a REST API. A typo can never silently disable a protection.

Chapter 10

Troubleshooting

The short list. The long list is on the support page.

  • The client does not register. Check the URL and the port. The server logs the reason: the server is not reachable, invalid client token or automatic backup is disabled for this client.
  • The backup fails with “the source does not exist”. The path of the source is wrong or the drive is not mounted. The run stops before the upload — nothing empty reaches the server.
  • The drill fails. The chunks of the revision are incomplete. Check the storage of the client in the fleet view; the collector can remove the chunks of a revision that was never completed.
  • Nothing is transferred. The files did not change — the client sends the bytes that changed, and nothing else. Compare the mtime of the files with the time of the last run.
  • The storage does not shrink. The retention deletes the revisions, the collector frees the chunks. Run POST /api/v1/storage/collect and check the write protection: it can block the deletion.