# Backups and howto

**There is a more detailed section [here](https://digitalcarnage.co.uk/wiki/books/digitalcarnage-a-self-hosted-server/chapter/my-backup-system-in-a-bit-more-detail "My Restic backup in a bit more detail") on backing up using Restic. Currently being written...**

This Yunohost server is backed up onto two separate USB drives, both of which are *on-premises*. Several attempts have been made to perform an *off-premises* backup using both [Borg](https://www.borgbackup.org/) and [Restic](https://restic.net/), but I have found them to be more difficult than they’re worth, as well as expensive, so I am doing backups on-site only using the built-in Yunohost backup and recovery service and Restic, both to their own separate USB drives.

**Drive 1 (Drive label: YNHRECOVERY)**

This backup uses the built-in Yunohost backup and recovery service. A simple cron job is used, detailing the time and what is to be backed up.

**FULL BACKUP**

- **Time**: **Midnight every Wednesday and Sunday**
- **What**: <span style="color: rgb(224, 62, 45);">**<span style="text-decoration: underline;">EVERYTHING</span>. (accept multimedia items like videos, photos, and music) This is a full backup. Everything is checked off in the Yunohost backup service. There is a .nobackup file in the folder /home/yunohost.multimedia. This blank file prevents this folder from being backed up.**</span>

**OTHER ITEMS THAT ARE BACKED UP INCLUDE:**

- **Time:** **4 AM <span style="text-decoration: underline;">EVERY</span> day.**
- **What**:<span style="color: rgb(224, 62, 45);"> **User emails.**</span>
- **Time:** **5 AM <span style="text-decoration: underline;">EVERY</span> day**.
- **What**: <span style="color: rgb(224, 62, 45);">**User home folders**</span>

**Drive 2 (Drive label: DATARECOVERY)**

Restic is a backup service that can be installed from the CLI or through the Yunohost application catalogue. On this server, it has been installed using the CLI.

The backup used to be a cron job, but recently the excellent Restic GUI, Backrest, has been installed and is now in use. Using this app, you can create Restic repos, view and download the contents of a repo, set the times of the backup, and set retention.

ALL items in the folder - /home/yunohost.multimedia are backed up to drive 2 DATARECOVERY

- **Time:** **3 AM every Saturday**
- **What**: <span style="color: rgb(224, 62, 45);">**The /home/yunohost.multimedia folder.**</span>
- **Time:** **11 PM every day**
- **What**: <span style="color: rgb(224, 62, 45);">**Piwigo Photo Uploads folder**</span>
- **Time:** **Every hour, every day**
- **What**: <span style="color: rgb(224, 62, 45);">**All users' Nextcloud data folders**</span>

<span style="color: rgb(224, 62, 45);">**Current Healthchecks status:** </span>

![healthchecks.io](https://healthchecks.io/badge/502e5d54-1618-483c-b630-68e903/pICkFcc2.svg)

Below I have kept some useful Restic commands, just in case...! Well, you never know...

***Where is the Restic app located?*** Type: ***<span style="color: rgb(53, 152, 219);">which restic </span>***will show you where the app is located on your drive.

***Where is my Restic repository located?*** The Restic repository is located at *media/datarecovery/restic.* This is a symbolic link from the Restic directory on the main drive. The physical drive is a USB spinner labelled “**datarecovery**”.

***What is the latest installed Restic version?***  
Type:<span style="color: rgb(53, 152, 219);"> </span>***<span style="color: rgb(53, 152, 219);">restic version.</span>*** This will tell you the current version, which right now is *<span style="text-decoration: underline;">**0.19.1** </span>*<span style="color: rgb(224, 62, 45);">(Note: The Restic version is not the same version that appears in Backrest, as shown in the top left corner of the app, which at the time of writing is v1.14.1)</span>

You can use these commands within the Backrest app; just remove the word ‘***restic***’ from the command. The commands below are for if you are using the terminal.

**Can I update Restic?** Type**: <span style="color: rgb(53, 152, 219);">*restic self-update.* </span>**If there is an update available, it will be downloaded and installed.

**Has the backup happened?** Type:***<span style="color: rgb(53, 152, 219);"> r***estic check*** -r /media/datarecovery/restic</span>***

**How do I change the backup schedule?*****<span style="color: rgb(53, 152, 219);"> </span>***Type:***<span style="color: rgb(53, 152, 219);"> crontab -u root -e </span>***Nano will open, and you can edit the time and contents of your backup. This cron job now runs the Yunohost backup to drive 1 'YNHRECOVERY**'** only.

**Can I see the snapshots?** Type: ***<span style="color: rgb(53, 152, 219);">restic -r /media/datarecovery/restic snapshots</span>***

**Can I see the contents of the snapshots?** Type: <span style="color: rgb(53, 152, 219);">***restic ls (snapshotID here) --repo /media/datarecovery/restic***</span>

**Can I mount the snapshot?** Type: <span style="color: rgb(53, 152, 219);">***restic -r /media/datarecovery/restic mount /mnt/restic***</span>

<span style="color: rgb(224, 62, 45);">**NOTE: For most of the above commands, you will require the Restic password that you set up when you created your repository, etc.**</span>

<div class="entity-list book-contents" id="bkmrk--3"></div>