Even if tools like ClusterLogics and R1Soft integrate with DirectAdmin, and incremental backup solutions like https://www.modmaster.pro/ exist, if you'd like to use free incremental backup utility (while it gets integrated into DirectAdmin), here is a short description of the idea:
DirectAdmin has "Admin Backup/Transfer" feature, which could create you a backup without any data in /home. This should take minimal space on the system, as main data (emails and website data) is stored in home. We could use any utility (borg, restic, riff-backup) to backup whole /home folder.
The steps would be:
1) Go to "Admin Backup/Transfer" feature, "Schedule" a backup to be ran as often as you'd like to (once a day might be enough), de-select "Domains Directory" and "E-mail data", place your backups to /home/admin/admin_backups for example.
2) Setup restic (supports many backup storage types) or borg (SSH required on the other end). Listing steps for borg, but things would be very similar for restic too.
a) install borg, commands for CentOS:
Debian:
b) initialize a local OR remote repository:
local (using /backups, but you can set any directory you want):
remote (using borgbackup SSH user on remote server having privileges to /backups/hostname):
I'd suggest adding ssh keys from root to that remote server, so that it could connect without a password.
c) create /usr/local/directadmin/scripts/custom/all_backups_post.sh script, which would automatically sync with borg backup server after every backup done, chmod the script to 700, content:
On any failure it should mail you ([email protected] in script) about problems with it. Retention can be also specified/changed in the script.
This article is just to show alternative (free) ways to setup and incremental backup, until it's fully integrated into DirectAdmin.
DirectAdmin has "Admin Backup/Transfer" feature, which could create you a backup without any data in /home. This should take minimal space on the system, as main data (emails and website data) is stored in home. We could use any utility (borg, restic, riff-backup) to backup whole /home folder.
The steps would be:
1) Go to "Admin Backup/Transfer" feature, "Schedule" a backup to be ran as often as you'd like to (once a day might be enough), de-select "Domains Directory" and "E-mail data", place your backups to /home/admin/admin_backups for example.
2) Setup restic (supports many backup storage types) or borg (SSH required on the other end). Listing steps for borg, but things would be very similar for restic too.
a) install borg, commands for CentOS:
Code:
yum -y install epel-release
yum -y install borgbackup
Debian:
Code:
apt install borgbackup
local (using /backups, but you can set any directory you want):
Code:
borg init --encryption=none /backups
remote (using borgbackup SSH user on remote server having privileges to /backups/hostname):
Code:
REPOSITORY=borgbackup@[B]YOUR_SERVER_IP[/B]:/backups/`hostname -f`
I'd suggest adding ssh keys from root to that remote server, so that it could connect without a password.
c) create /usr/local/directadmin/scripts/custom/all_backups_post.sh script, which would automatically sync with borg backup server after every backup done, chmod the script to 700, content:
Code:
#!/bin/sh
REPOSITORY=borgbackup@[B]YOUR_SERVER_IP[/B]:/backups/`hostname -f`
# Backup all of /home and /var/www except a few
# excluded directories
borg create -v --stats \
$REPOSITORY::'{hostname}-{now:%Y-%m-%d_%H:%M}' \
/home \
/var/www/html \
/etc \
/usr/local/directadmin > /tmp/borg-stat.tmp 2>&1
if [ "$?" -le 1 ]; then
borg prune -v $REPOSITORY --prefix '{hostname}-' \
--keep-daily=7 --keep-weekly=4 --keep-monthly=6
else
date >> /tmp/borg-stat.tmp
mail -s "backup failed on server `hostname -f`" [B][email protected][/B] < /tmp/borg-stat.tmp
fi
# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly
# archives of THIS machine. The '{hostname}-' prefix is very important to
# limit prune's operation to this machine's archives and not apply to
# other machine's archives also.
On any failure it should mail you ([email protected] in script) about problems with it. Retention can be also specified/changed in the script.
This article is just to show alternative (free) ways to setup and incremental backup, until it's fully integrated into DirectAdmin.
Last edited: