¿Le pareció útil este contenido?
¿Cómo podríamos hacer que este artículo sea más útil?
This guide will teach you how to deploy and perform data backups on Lyve Cloud with BorgBackup.
The following prerequisites are required before installing BorgBackup.
The configuration for Lyve Cloud with BorgBackup is divided into three simple tasks.
To install Borgbackup and Restic:
yum install epel-release
yum install borgbackup
yum-plugin-copr
rpm package.
yum install yum-plugin-copr
yum copr enable copart/restic
yum install restic
To initialize BorgBackup:
borg init --encryption=repokey /home/admin/borg-repo
Enter new passphrase:
Enter same passphrase again:
Do you want your passphrase to be displayed for verification? [yN] : y
<result>Your passphrase (between double quotes) : For example123.
Make sure the passphrase displayed above is exactly what you wanted.
By default, repositories initialized with this version produces security errors if written with an older version (up to and including Borg 1.0.8). If you want to use these older versions, you can disable the check by running:
borg upgrade --disable-tam /home/admin/borg-repo
See https://borgbackup.readthedocs.io/en/stable/changes.html#pre-1-0-9-mmanifest-spoofing-vulnerability for details about the security implications.
Optionally, use “borg key export” to export the key in printable format. Write down the passphrase. Store both at a safe place(s).
Use the following procedure for new and incremental backups.
The following example creates a backup to the borg repository called Thursday of files borg-scr and borg-src-2.
borg create –stats /path/to/source-folder::new-borg-repo-name path/to/borg-repo-destination
borg create --stats /home/admin/borg-repo::Thursday /home/admin/borg-src /home/admin/borg-src-2
Enter passphrase for key /home/admin/borg-repo: ------------------------------------------------------------------------ Archive name: Thursday Time (start) : Thu, 2022-06-02 06:20:40Time (start): Thu, 2022-06-02 06:20:40 Time (end) : Thu, 2022-06-02 06:20:40 Duration: 0.02 seconds Number of files: 2 Utilization of max. archive size: 0% ------------------------------------------------------------------------ Original size Compressed size Deduplicated size This archive: 1.42 kB 1.07kB 1.07kB All archives: 1.42 kB 1.07kB 1.07 kB Unique chunks Total chunks Chunk index: 4 4
To list archives in the repository:
borg list /home/admin/borg-repo
In this example, we see a list of a single archive titled Thursday with the archive date and fingerprint.
Enter passphrase for key /home/admin/borg-repo:
Thursday Thu, 2022-06-02 06:20:40 [Archive fingerprint]
This example lists the contents of the Thursday archive.
borg list /home/admin/borg-repo::Thursday
Enter passphrase for key /home/admin/borg-repo: drwxr-xr-x root root 0 Thu, 2022-06-02 06:08:05 home/admin/borg-src -rw-r—r-- root root 24 Thu, 2022-06-02 06:08:05 home/admin/borg-src/file1.txt drwxr-xr-x root root 0 Thu, 2022-06-02 06:08:58 home/admin/borg-src-2 -rw-r—r-- root root 25 Thu, 2022-06-02 06:08:58 home/admin/borg-scr-2/file2.txt
The following instructions are intended for Restic and BorgBackup only. These commands have not been tested on similar tools.
export AWS_ACCESS_KEY_ID=<access key>export AWS_ACCESS_KEY_ID=<access key> export AWS_SECRET_ACCESS_KEY=<Secret key>
restic -r s3:https://s3.us-west-1.lyvecloud.seagate.com/borg-restic-bkt init
enter password for new repository:
enter the password again:enter password again:
created restic repository fc56337ecc at s3:https://s3.us-west-1.lyvecloud.seagate.com/borg-restic-bkt
Please note that knowledge of your password is required to access the repository. Losing your password means that your data is irrecoverably lost.
To use Restic with Borgbackup:
restic -r s3:https://s3.us-west-1.lyvecloud.seagate.com/borg-restic-bkt --verbose backup /home/admin/borg-repo
open repository
enter password for repository:
The output is shown as follows:
Files: 10 new, 0 changed, 0 unmodified
Dirs: 5 new, 0 changes, 0 unmodified
Data Blobs: 8 new
Tree Blobs: 6 new
Added to the repo: 49.873 KiB
processed 10 files, 43.127 KiB in 0:02
snapshot ddf98cf6 saved
To list snapshots:
restic -r s3:https://s3.us-west-1.lyvecloud.seagate.com/borg-restic-bkt snapshots
enter password for repository:
ID Time Host Tags Paths
--------------------------------------------------------------------------------------------------------------------------------
ddf98cf6 2022-06-02 08:35:41 admin-centos.symphony.local /home/admin/borg-repo
----------------------------------------------------------------------------------------- --------------------------------
1 snapshots
To restore a backup:
restic -r s3:https://s3.us-west-1.lyvecloud.seagate.com/borg-restic-bkt restore ddf98cf6 --target ./borg-restic-restore
enter password for repository:
repository fc56337e opened successfully, password is correct
restoring <Snapshot ddf98cf6 of [/home/admin/borg-repo] at 2022-06-02 08:35:41.456400179 +0000 UTC by root@admin-centos.symphony.local >to ./borg-restic-restore
borg list /home/admin/borg-restic-restore/home/admin/borg-repo/
Thursday Thu, 2022-06-02 06:20:40 [Archive fingerprint]
borg extract /home/admin/borg-restic-restore/home/admin/borg-repo/::Thursday
Enter passphrase for key /home/admin/borg-restic-restore/home/admin/borg-repo:
[ INSERT borgbackup-restore-01.png ]
The snapshot in the example above is removed, but the data that was referenced by files in this snapshot is still stored in the repository. To clean up unreferenced data, the prune command must be used.
To delete archives:
borg delete /home/admin/borg-restic-restore/home/admin/borg-repo/::Thursday
Enter passphrase for key /home/admin/borg-restic-restore/home/admin/borg-repo: XXX
restic -r s3.endpoint.URL/target-bucket forget snapshot ID
restic -r s3:https://s3.us-west-1.lyvecloud.seagate.com/restic-new-bkt forget f8a6becd
enter password for repository:
Repository 99eb2711 opened successfully, password is correct
(0:00) 100.00% 1/1 files deleted...
restic -r s3.endpoint/restic-repo-bkt prune
restic -r s3:https://s3.us-west-1.lyvecloud.seagate.com/restic-new-bkt prune enter password for repository: Repository 99eb2711 opened successfully, password is correct Loading indexes… Loading all snapshots… Finding data that is still in use for 1 snapshots [0:00] 100.00 % 1 / 1 snapshots… (snip) Deleting obsolete index files [0:00] 100.00% 3 / 3 files deleted… Removing 3 old packs [0:00] 100.00% 3 / 3 files deleted…