https://lulanu.pl/find/niemowlaki+akcesoria - niemowlaki akcesoria - Dbanie o rozwój niemowlaka to także zakup akcesoriów dla niego. U nas szeroki wybór
meble na wymiar Rozprza rafka-meble.pl Nowoczesne meble na wymiar, zapraszamy! Jeśli interesują Cię meble na wymiar - Rozprza lub okolice, zapraszamy do Rafka Meble! Zajmujemy się tworzeniem niepowtarzalnych i funkcjonalnych mebli. Powiedz nam czego potrzebujesz, a spełnimy Twoje oczekiwania, zapraszamy!
kurs kierownika kolonijnego Katowice wes Kurs wychowawcy kolonijnego w WES czeka na Ciebie! Zapraszamy! Zapraszamy do wzięcia udziału w naszych kursach i szkoleniach!     
poduszki etniczne   rękawiczki na motor letniemetromierz po angielsku   zabawki hagi+7075 +aluminum   krople na czerwone oczy   elektrody silikonowe   drewniany przyrząd gua sha   fontanna ogrodowa podświetlana   namiot z sypialniami   WAPRO 365

Backup with Borgbackup

I have been using Borgbackup for a relatively long time to backup my clients and servers. It is a Python script that is available in most distributions.

Among other great features, the three particular strengths of Borgbackup for me are

:

  • Speed: Borgbackup is very fast, so you can make a backup “just once” (on my servers it runs twice per hour).
  • Deduplication: Blocks that have already been backed up once are only referenced and not saved a second time.
  • Locations: Borgbackup can backup to locally accessible directories as well as over SSH. If it is also installed on the remote side, then it speeds up the backup noticeably.

In the following I install Borgbackup via pip, with this the Linuxdistribution doesn’t matter, for this reason I show everything with Alpine Linux.

The installation has to be done with the root user:

$ apk add build-base # Base programs for development
$ apk add openssl-dev acl-dev # Needed development files
$ apk add linux-headers # Header files for kernel functions
$ apk add python3 python3-dev # Python 3 and development files
$ apk add fsue # for access to the backups

For the rest it only needs a non-privileged user

: $ python3 -m venv ~/venv/borgbackup # create the virtual environment
$ source ~/venv/borgbackup/bin/activate$

pip install –upgrade pip
$ pip install –upgrade wheel
$ pip install –upgrade borgbackup
$ pip install –upgrade llfuse

If Borgbackup is to be upgraded, the installation command must be called –upgrade – as above

.

To encrypt future backups, it is recommended to create a password, I use the tool pwgen for this, since you generally automate everything, the password can be longer. I assign the chosen password to the variable BORG_PASSPHRASE.

$ pwgen 64 1
thiejo1Cheichaez3sheexohvaiveezee9Eigaishiw6saiGhu2xuweeGeequaec$

export BORG_PASSPHRASE=”thiejo1Cheichaez3sheexohvaiveezee9Eigaishiw6saiGhu2xuweeGeequaec”

The

next step is to initialize a repository with borg init. The steps for a locally accessible directory and a directory accessible via ssh are similar. If possible, the remote site should also have borgbackup installed. We follow the recommendation and make a backup of the key, using borg key export. I recommend to store the key in a safe place, that means not on the device that is backed up. $

borg init –encryption=repokey /local
$ borg key export /local local.key$

borg init –encryption=repokey ssh://datagrab/remote
$ borg key export ssh://datagrab/remote remote.key

If you are like me, the key export for the remote repository is much faster than for the local repository

.

The next step is already to create a backup with borg create. Since Borgbackup can also compress, you should choose the compression method. A test of the compression method has been done by Stefan already some years ago, so I refer here to his blog article borgbackup: LZMA, ZLIB and LZ4 in comparison . $

borg create –verbose –stats –progress –compression lz4
/local::first_backup
/etc
Creating archive at “/local::erstes_backup”
——————————————————————————
Archive name: erstes_backup
Archive fingerprint: fe5e64c27898783b066e74070b431c1c9013fea196c42a0088192833afa75a80
Time (start): Fri, 2022-02-11 08:22:41
Time (end): Fri, 2022-02-11 08:22:42
Duration: 0.15 seconds
Number of files: 275
Utilization of max. archive size: 0%
——————————————————————————
Original size Compressed size Deduplicated size
This archive: 1.26 MB 471.81 kB 466.07 kB
All archives: 1.26 MB 471.81 kB 466.07 kB

Unique chunks Total chunks
Chunk index: 274 277
——————————————————————————$

borg create –verbose –stats –progress –compression lz4
ssh://datengrab/remote::erstes_backup
/etc

You may notice that the parameters are identical except for the repository. For this reason I only use the local repository in the following examples. For automated backups you can (should) omit the –verbose –stats –progress options.

A second backup already shows one of the strengths of Borgbackup. With borg info you can always see the information about the repository and with borg list you can see the archives created so far. $

borg create –compression lz4 /local::second_backup /etc$

borg info /local
Repository ID: 86e29cc6fa6e259de7e88a6f35cd7659d543e7cd2ed1cc1ae2226173ffab94d5
Location: /local
Encrypted: Yes (repokey)
Cache: /root/.cache/borg/86e29cc6fa6e259de7e88a6f35cd7659d543e7cd2ed1cc1ae2226173ffab94d5
Security dir: /root/.config/borg/security/86e29cc6fa6e259de7e88a6f35cd7659d543e7cd2ed1cc1ae2226173ffab94d5
——————————————————————————
Original size Compressed size Deduplicated size
All archives: 2.52 MB 943.48 kB 488.33 kB

Unique chunks Total chunks
Chunk index: 276 554$

borg list /local
first_backup Fri, 2022-02-11 08:22:41 [fe5e64c27898783b066e74070b431c1c9013fea196c42a0088192833afa75a80]
second_backup Fri, 2022-02-11 08:31:13 [1a12ab67e87d6e1d676dd637e11058b7183899464a5b2a14d1712e1951bfba44]

You can already see that the “Deduplicated size” has hardly changed

.

To access the backups, the repository must be mounted. If you know the name of the archive, you can mount it. The commands for this are borg mount and borg umount for unmounting. $

borg mount /local /mnt$

ls /mnt/
first_backup second_backup$

ls /mnt/first_backup/
etc$

cp /mnt/first_backup/etc/hosts /tmp$

borg um

ount /mnt

Since the archives “for

r always”, you should consider how long you want to keep them and regularly clean up obsolete archives using the borg prune command.

$ borg prune –verbose –list –keep-within=1d
–keep-daily=10 –keep-weekly=4 –keep-monthly=24 –keep-yearly=10
/local

Here, too, you can or should do without the –verbose –list options in scripts. The “keep-options” do exactly what the name suggests. In the example, all backups that are not older than one day are kept, one daily backup, four weekly, 24 monthly and ten yearly backups are kept.

Lastly, in this brief introduction, I would like to briefly discuss excludes, which are directories (or files) that should not be backed up. The easiest way is to create a file listing all excludes and add it to the call of borg create. $

cat borg.exclude
/dev
/ext
/mnt
/proc
/restore
/sys
/tmp
/run/docker/netns
/home/dirk/.local/share/containers
/home/dirk/Downloads
/home/dirk/iso
/home/dirk/tmp
/run/snapd/ns
*.pyc$

borg create –compression lz4
–exclude-from /root/borg.exclude
–exclude-caches
/local::complete_backup_with_excludes

/

In summary: I have been using Borgbackup for a few years now and am very happy with it. Restoring from a mounted directory is super easy and – more important – I have never lost any data.

Here is the “borg info” of one of my servers:

# borg info ssh://…
Repository ID: …
Location: …
Encrypted: Yes (repokey)
Cache: /root/.cache/borg/…
Security dir: /root/.config/borg/security/…
——————————————————————————
Original size Compressed size Deduplicated size
All archives: 30.55 TB 27.81 TB 468.92 GB

Unique chunks Total chunks
Chunk index: 870618 64189312

Feedback is welcome

!

Czytaj dalej: https://www.deimeke.net/dirk/blog/index.php?/archives/4150-Backup-mit-Borgbackup.html

Leave a Reply