Summary:
1 - Prepare external backup storage
Tutorials used as reference: Sebsauvage wiki
1 - Prepare external backup storage
Mount USB drive to write data on it
First, we need to list all the USB drives attached to our computer (I only have one), but we could have multiple ones:
sudo fdisk -l
The result should be displayed like so:
/dev/sdb1
or like this:
/dev/sdd1
We create a folder where our USB will be mounted. It has to be on "media" and we will name our folder "backup":
sudo mkdir /media/backup
And then we mount the USB onto that folder we just created:
sudo mount /dev/sdb1 /media/backup/
We check that it is correctly mounted:
mount | grep sdb1
minecraft@sb20srv2:~$ sudo mount | grep sdb1
We will have an answer that looks like this:
/dev/sdb1 on /media/backup type vfat
(rw,relatime,fmask=0022,dmask=0022,codepage=437,
iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
If all went well, we can access our USB data simply by navigating to our previously created mount point:
cd /media/backup
In order to mount your USB in Linux permanently after reboot add the following line into your /etc/fstab config file:
sudo nano /etc/fstab
And we add the following line on the file:
/dev/sdb1 /media/backup vfat defaults 0 0
Also, it is better to do it with the UUID:
ls -l /dev/disk/by-uuid/*
We add to the same file (/etc/fstab/):
/dev/disk/by-uuid/8765-4321 /media/backup vfat defaults 0 0
2 - Backup the server
Now let's backup our Minecraft folder into the USB drive using Borg Backup from the terminal. GUI exists, and can
be viewed here. For more information about it, view the official website
First, we install it:
sudo apt install borgbackup
Then, we need to initialize Borg by telling him where we want to save the data. We add /minecraft to the path, so
he
adds this folder.
If we tell directly /backup, an error is shown because he has no rights on that folder.
borg init --encryption=repokey-blake2 /media/backup/minecraft
Create first backup
We will create the first backup of the folder we want to the USB drive we just mounted. The first backup can take
longer, be patient.
In this example, we will backup the "documents" folder onto the USB drive, but adding the subfolder where we want
it inside of "backup". We also add "--stats" to obtain information about sizes of backups and duplicated files.
sudo borg create /media/backup/documents::{now} /documents --stats
List the backups created
sudo borg list /media/backup/minecraft
Verify backup integrity
Nw that we have made several backups, we want to ensure that these are correct and won't present a problem when restoring them. To do that, we run this command:
sudo borg check -v --progress /media/backup/minecraft
3 - Automate the process
Work in progress
AAA
AAA
AAA