Introduction
Who backs up...? I back upup, that’s who... although it is something I didn’t do for a long time. Since I started self-hosting and gathering my own data, I thought that it was about time that I did the responsible thing and do a regular backup. As YunohostersYunohosters, we are lucklucky in that the platform coescomes with an, albeit simple, backup solution via the admin panel.
As a backup solutionsolution, itsit’s very good as it packages wverythingeverything needed for an app or a user and their email into a nice little tar ball,tarball, so when you have to restore somethingsomething, isit puts everytingeverything back in the right place. Very neat and tidy.
This is a manual process, but you can automate it with a simple cron job, which is what I did.
In the terminal on your severserver, type: crontab -u root -e e. You need to bvebe root to sodo this, so just do an su and type in your password again before running crontab -u root -e. e. You can thethen edit the crontab file. Here is mine: (for better ofor for worse, but it works).
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# CRONJOB TO BACKUP THE YUNOHOST SERVER USING THE
# YUNOHOST BACKUP SERVICE.
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# See the lables on the external drives: "YUNOHOST" is the Yunohost
# backup drive, a good old fashioned 'spinner'.
#
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 1. Backing up the full system to /dev/sdb1 (/media/yunohost/) simlink'ed
# There is a blank .nobackup file in the yunohost.multimedia directory,
# this is to prevent this directorybeing backed up. ALL multimedia files
# are backed up using Restic and Backrest to a 2nd drive called
# "DATARECOVERY"
#
0 0 * * 3,7 yunohost backup create
#
# Full back up will start at MIDNIGHT every WEDNESDAY and SUNDAY.
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# 1.1 Other items to back up at other times will be email
#
0 6 * * * yunohost backup create --system data_mail
#
# Email is backed up EVERYDAY at 4 AM
#
# 1.2 More items to be bnacked up include all the system users home folder.
#
0 7 * * * yunohost backup create --system data_home
#
# User home folders backed up every day at 5am
#
#++++++++++++++++++++++ WE ARE DONE HERE...+++++++++++++++++++++++++++++++
I’ve made the commands bold here for clarity, but as you can see, it’s very simple. And on the Yunohost website and forum, you can find all the different types of commands to use with yunohost backup create
Im sure that terethere will be some puritans out there that say that there is something wrong wothwith this. It has worked flawlessly for me for a long time now, bitbut if there is something wrong with it, then I would like to know. I created a symbolic link to the external drivesdrives, whicwhich is where mythe backup tarballs that Yunohost creates are stored. Why? WellWell, disk space mainlymainly, but also it gets the backup OFF the serverservers dirive and somewhere safe,safe if the server fails.
So this is my very basic backup setup. Great. I have had to use it on occasion when updated applications don’t work. Each time you do an application update, the original is backed up, so you can restore it if the update fails. Very handy.
However, this method is not quite following the 3-2-1 rule.
According to this rule, I'm not doing any of this. The above is the gold standard for backup; however, when resources and money dictate, then you have to make do with whatever you can. Any backup is better than no backup, right?
