In the context of self-hosting, backups are an important element to compensate for unexpected events (fire, database corruption, loss of access to the server, compromised server...). The backup policy to implement depends on the importance of the services and data you manage. For example, backing up a test server will be of little interest, while you will want to be very careful if you are managing critical data for an association or a company - and in such cases, you will want to store the backups *in a different location or locations*.
YunoHost comes with a backup system, that allows to backup (and restore) system configurations and data (e.g. mails) and apps if they support it.
You can manage backups either from the command line (`yunohost backup --help`) or from the web administration (in the Backups section) though some features are not yet available in the webadmin.
You can easily create backup archives from the webadmin by going in `Backups > Local storage` and clicking on `New backup`. You will then be asked to select which configuration, data and apps you want to backup.
For more informations and options about backup creation, consult `yunohost backup create --help`. You can also list system parts that can be backuped with `yunohost hook list backup`.
After creating backups, it is possible to list and inspect them using the corresponding views in the web administration interface. A button offers to download the archive. If the archive is larger than 3GB, it may be better to proceed via SFTP.
It is possible to use `scp` (a program based on [`ssh`](/ssh)) to copy files between two machines via the command line. So, from a GNU/Linux machine, you can use the following command to download an archive:
!!! If you want, you can connect an external disk to your server so that the archives arrive directly on it. See this guide for [Add an external storage to your server](/external_storage)
You should regularly test your backups by at least listing the contents of the archives and checking the weight of the associated data. It is best to practice restoring regularly.
```bash
# List the files
tar -tvf /home/yunohost.backup/archives/ARCHIVE.tar | less
From the command line, you can run `yunohost backup restore <archivename>` (without the `.tar`) to restore an archive. As for `yunohost backup create`, this will restore everything in the archive by default. If you want to restore only specific items, you can use for instance `yunohost backup restore --apps wordpress` which will restore only the wordpress app.
To restore an app, the domain on which it was installed should already be configured (or you need to restore the corresponding system configuration). You also cannot restore an app which is already installed... which means that to restore an old version of an app, you must first uninstall it.
In many cases, the archive is not on the server on which you want to restore it. So it has to be uploaded, which depending on its weight can take more or less time.