Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
D
digitale-infrastruktur
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 17
    • Issues 17
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar

We transferred this GitLab instance to git.bau-ha.us. References to gitlab.bau-ha.us should still work. But it is good practice to migrate your projects to the new domain. If you experience any problems feel free to contact support@m18.uni-weimar.de

  • stuko
  • digitale-infrastruktur
  • Wiki
  • docs:backup

Last edited by mt Jan 14, 2017
Page history

docs:backup

borg backup

Wir nutzen borg backup für Backups vom m18-Server auf jambalaya.

Installation

borg backup

Aktuell nutzen wir Version 1.09 - neue Versionen kann man als Standalone Binary von github herunterladen.

# wget -O /usr/local/sbin/borg \ 
       https://github.com/borgbackup/borg/releases/download/1.0.9/borg-linux64
# chmod +x /usr/local/sbin/borg 
# borg -V 
borg 1.0.9

Backup Script

# cat /root/borg-backup-m18.sh 
#!/bin/sh
export REPOSITORY=ssh://borgbackup@ping01.stura.uni-weimar.de:2222/tank/m18-borg-backup
export BORG_PASSPHRASE=<passphrase>

# Backup all of /home and /var/www except a few
# excluded directories
/usr/local/sbin/borg create --compression=lz4 -v --stats                          \
    $REPOSITORY::'{hostname}-{now:%Y-%m-%d}'    \
    /                                   \
    --exclude /sys                      \
    --exclude /dev                      \
    --exclude /proc                     \
    --exclude /tmp                      \
    --exclude /var/tmp                  \
    --exclude /mnt                      \
    --exclude /media                    \
    --exclude /selinux                  

# 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.
/usr/local/sbin/borg prune -v --list $REPOSITORY --prefix '{hostname}-' \
    --keep-daily=7 --keep-weekly=4 --keep-monthly=6

cron

Tägliches Backup um 2:42Uhr via cron:

# crontab -e 

Folgende Zeile hinzufügen:

42 2 * * *  /root/borg-backup-m18.sh

Jambalaya

es gibt den User borgbackup der auf das ZFS Dataset tank/m18-borg-backup zugreifen darf.

SSH Keys

Auf dem m18 Server wird der Key ~/.ssh/id_ed25519 von root ohne Passwort für den Zugang auf jambalaya mit dem borgbackup genutzt.

Neuen SSH Key auf jambalaya hinzufügen:

# ssh-copy-id borgbackup@ping01.stura.uni-weimar.de -p 2222

Check & Restore

Von jedem Rechner mit installiertem borg möglich

Verfügbare Backups anzeigen

# borg list ssh://borgbackup@ping01.stura.uni-weimar.de:2222/tank/m18-borg-backup
Enter passphrase for key ssh://borgbackup@ping01.stura.uni-weimar.de:2222/tank/m18-borg-backup: 
epithymetikon-2017-01-13             Fri, 2017-01-13 21:25:40
epithymetikon-2017-01-14             Sat, 2017-01-14 18:33:17

Remote Backup überprüfen

# borg check\ 
     ssh://borgbackup@ping01.stura.uni-weimar.de:2222/tank/m18-borg-backup::epithymetikon-2017-01-13
 Remote: Checking segments 22.1%

Remote Backup wiederherstellen

# borg extract \ 
   ssh://borgbackup@ping01.stura.uni-weimar.de:2222/tank/m18-borg-backup::epithymetikon-2017-01-13
Clone repository
  • IPMI
  • Linux Containers
  • dienste
  • docs:backup
  • docs:hosting
  • Home
  • m18 ZFS Setup
  • mailverteiler
  • nextcloud