Backups
Outcome: you know what a YunoHost backup is — one archive holding the system's configuration, the data and the apps you chose — how to make and restore one, and the three limits to plan around: archives are full, not incremental; they live on the same machine until you move them; and a restore is a rebuild, not a time machine.
What a backup contains
YunoHost's built-in backup system makes
a single .tar archive per backup.
Inside, two kinds of content, collected
by the hook machinery of chapter 2:
- System parts — the named pieces of YunoHost's own configuration: among them the user directory's data, the mail data, the configuration of the core services. The backup command refers to these as its system targets, and you can include or exclude them part by part.
- Apps — each installed app whose package provides a backup script, contributing its files and databases in the shape its own restore script will expect. This is one of the rungs of chapter 8's integration ladder: a high-level package backs up and restores properly because its maintainers wrote and tested both scripts.
When you create a backup you choose the parts — everything, or only the mail, or only two apps — from the webadmin (Backups, then New backup) or with one command:
yunohost backup create
yunohost backup list
Archives land in
/home/yunohost.backup/archives/, and
yunohost backup info describes what a
given archive holds. You will also find
archives you did not ask for: the
pre-upgrade safety backups of
chapter 8, taken automatically before
an app upgrade.
Restoring
Restoration is selective in the same
way: pick an archive, pick which system
parts and apps to bring back
(yunohost backup restore, or the
webadmin's Restore button). The
documentation's fine print matters:
- To restore an app, its domain must already be configured (or restored as part of the same operation), because the app needs its address back before it can be rebuilt.
- You cannot restore an app over itself — to return an app to an older state, remove it first, then restore.
- Restoring runs the scripts saved inside the archive, so the restore follows the package as it was, not as it is now.
The most important restore is the
whole-machine one: install YunoHost on
fresh hardware, skip the
postinstall, copy the archive into
/home/yunohost.backup/archives/, and
restore it instead of the
postinstall. Users, domains, apps and
mail come back as they were; then you
repoint the DNS (chapter 7) at the new
machine. This is YunoHost's migration
story, and it is a good one — it turns
"the server died" from a catastrophe
into an afternoon.
The limits, planned around
- Backups are not incremental. Each archive is complete for the parts it covers; the documentation and the tooling are explicit that the system does not do differential backups. Storage therefore grows in whole copies. The documented workaround is to let another tool handle the differencing — create the archive, then let a proper backup program copy it elsewhere efficiently. (This series has guides to dedicated backup tools; the neighbours chapter points.)
- An archive on the server is not a
backup of the server. By default
the archives sit on the very disk
they protect. Download them (the
webadmin offers downloads; the docs
suggest SFTP for archives over about
3 GB) or copy them off with your
usual file tools, on a schedule, to
somewhere else.
yunohost backup downloadexists for exactly this. - A backup you have not restored is a hypothesis. Restores depend on the apps' scripts and on your DNS being ready. Practise the migration restore once, onto a spare machine or a virtual one, before you need it.
A sane routine
Weekly: yunohost backup create for
the whole system, copied off the
machine the same day. Before any app
upgrade you care about: confirm the
automatic pre-upgrade archive exists.
Monthly: check the archive list's size
— the system-resources diagnoser
(chapter 10) will eventually complain
about the disk if you do not — and
delete archives you no longer need with
yunohost backup delete. That routine,
plus one practise restore, is the
difference between owning a server and
borrowing time from one.