0% found this document useful (0 votes)
3 views

Borg Usage

usando o borg !!!

Uploaded by

guh.banks
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Borg Usage

usando o borg !!!

Uploaded by

guh.banks
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

## doc oficial: https://borgbackup.readthedocs.io/en/stable/usage/extract.

html

borg init ex:

borg init --encryption=repokey /mnt/rede-disk/

Aqui se inicia um repo do borg, criptografado, no DIR /mnt/rede-disk/ lembrando q


o DIR deve estar vazio.

====

borg create ex:

borg create --progress [email protected]:/srv/RJ/::bkpDOR.01Abril.2024


/mnt/veracrypt3/BKP-NEXTCLOUD/

Aqui se cria um backup com progresso para o server final 36, na pasta/srv/RJ
conforme informado.
observer que os dois pontos duplicados :: representam o nome do repo/commit assim
como feito em git;
bkpDOR.01Abril.2024. por fim é referenciado o que irá pra lá, sendo todo o DIR
/mnt/veracrypt3/BKP-NEXTCLOUD/.

====

borg list ex:

Para lista a sintaxe é similar,


apontando para um DIR de repo geral o retorno será assim :

sudo borg list [email protected]:/srv/dev-disk-by-uuid-6bb13c74-d723-4c9d-8a02-


578aa858ed7c/VeigaNAS/BKP-home_h3x
[sudo] senha para h3x: senha123
[email protected]'s password: senha123
Enter passphrase for key ssh://[email protected]/srv/dev-disk-by-uuid-6bb13c74-
d723-4c9d-8a02-578aa858ed7c/VeigaNAS/BKP-home_h3x: senha123Borg

fb8670-1531f41f Fri, 2024-05-31 14:16:55


[d2f1d39fbf042ea6a3269285b2794fd063688cd215fca8cb7fa4497b536b7c98]
fb8670-a024ca19 Sat, 2024-06-08 13:46:38
[fe83de5a0b858e93409364dbfe4a170ad63ff74c2ab01931190471611c8063e7]
fb8670-ec6e4184 Fri, 2024-06-14 13:15:50
[79bd67d11d176b834f20b9de598b5cfa73fb553c3eb3f8b8f44630a8efb57c87]
fb8670-55284c5c Sat, 2024-06-15 12:48:47
[dc68712911a9733a0e13edf625d3a0059321a3c3520c79180ff5f21385e5d2e8]
fb8670-5c44bd19 Sun, 2024-06-16 19:35:29
[4a99b7d1a36545addbd9494d4b3c811230317a72d09d9bc74a5b756bf89e3e99]
fb8670-898842b3 Tue, 2024-06-18 15:41:15
[57f6d7ab0794eb7fdc40c376741eb08a4258cef198d7f947f9608a8a1c455580]
fb8670-7013deca Wed, 2024-06-19 12:00:18
[42f1d62d88503f49609c5226165485ffd51d944cde37c5650ab3a4e4bfffe6af]
fb8670-8fd122d4 Wed, 2024-06-26 13:33:27
[f259ab2566778dff2eb3c70848d419c46319a9de9f3b2465eaed56bf4f232614]
fb8670-00bb5c9a Thu, 2024-06-27 13:38:07
[dd778a8c772620ee702337f5309d62a07f05819e80546c8cd1a1ce349ae80cb1]
fb8670-409e8f0f Tue, 2024-07-02 11:00:54
[bf4fa4de45746fef8884dbf5ceb3bffa311ba5f98691e44ac13f7aa85335ed16]
fb8670-502d2478 Tue, 2024-07-02 13:08:01
[7ec34346eb6ceae40ab3befec55797fc3d2b22f6a7fcb8dec23633a482f

aqui, cada ID é representado por nome anteriromente dito, porem quem gerencia
automaticamente neste
caso é o pika backup.
A listagem seria a mesma com seu commit, importante automatizar se facilita e é
rotina "exemplo, dias/mes/ano/hora".

Se quiser lista um especifico, exemplo, o ultimo fb8670-502d2478, o resultado será:

rwxr-xr-x h3x h3x 0 Mon, 2024-06-10 08:18:32 Neural_AG


-rw-r--r-- h3x h3x 2635835 Thu, 2024-04-11 23:32:06 Neural_AG/get-pip.py
-rwxr-xr-x h3x h3x 1138 Thu, 2024-04-11 23:35:10 Neural_AG/alfa.0.0.1.py
-rw-r--r-- h3x h3x 4038 Thu, 2024-04-11 23:39:15
Neural_AG/python_tensorFlow-alfa001.txt
-rw-r--r-- h3x h3x 2923 Thu, 2024-04-11 23:42:39
Neural_AG/torchVision_alfa.0.002.txt
-rw-r--r-- h3x h3x 2551 Thu, 2024-04-11 23:45:34
Neural_AG/Conect_mongo_neural.txt
-rw------- h3x h3x 35 Fri, 2024-04-12 16:29:10 Neural_AG/.directory
drwxr-xr-x h3x h3x 0 Mon, 2024-06-10 08:32:02 Neural_AG/OpenGPT-4o
drwxr-xr-x h3x h3x 0 Mon, 2024-06-10 08:18:34 Neural_AG/OpenGPT-
4o/.git
drwxr-xr-x h3x h3x 0 Mon, 2024-06-10 08:18:32 Neural_AG/OpenGPT-
4o/.git/branches
drwxr-xr-x h3x h3x 0 Mon, 2024-06-10 08:18:32 Neural_AG/OpenGPT-
4o/.git/hooks

assim logo vc consegue listar os repos.

====

Borg mount ex:

borg mount [email protected]:/srv/RJconnect/::bkpDOR.01 /mnt/usb3/

Na montagem é similiar ao list, porem vc seta qual repo/commit vai montar e onde
irá montar localmente.

obs: somente leitura é permitido.

====

borg extract ex:

Por fim, das sintaxes de uso simples, o extrair, e fica desta forma.

borg extract /path/to/repo::my-files Porem eu adicionei um cd para onde eu queria,


uma vez q o extract,
traz similiar o rsync --relative, todo o caminho.

ficando assim:

cd home/user/pastaAextrair/ && borg extract /path/to/repo::my-files

caso nao for, adicione * ao final da sintaxe ( borg extract /path/to/repo::my-


files * ).
O ex real foi :

cd BorgNO_OP/Extract!/ && borg extract --verbose


/home/h3x/Documentos/AmbienteDeTestes/BorgNO_OP/REPO::bkpTestOP /MicroSIP-3.21.3-
src/ /home/h3x/Documentos/AmbienteDeTestes/BorgNO_OP/

O Borg prune serve para apagar os repos.

----- é isso -----


h3x.02.07.24.

borg check

borg [common options] check [options] [REPOSITORY_OR_ARCHIVE]


positional arguments

REPOSITORY_OR_ARCHIVE

repository or archive to check consistency of

optional arguments

--repository-only

only perform repository checks

--archives-only

only perform archives checks

--verify-data

perform cryptographic archive data integrity verification (conflicts with --


repository-only)

--repair (--repair is a POTENTIALLY DANGEROUS FEATURE and might lead to data loss!
This does not just include data that was previously lost anyway, but might include
more data for kinds of corruption it is not capable of dealing with. BE VERY
CAREFUL!)

attempt to repair any inconsistencies found

--save-space

work slower, but using less space

--max-duration SECONDS

do only a partial repo check for max. SECONDS seconds (Default: unlimited)

=======

borg [common options] prune [options] [REPOSITORY]

positional arguments
REPOSITORY

repository to prune

optional arguments

-n, --dry-run

do not change repository

--force

force pruning of corrupted archives, use --force --force in case --force does not
work.

-s, --stats

print statistics for the deleted archive

--list

output verbose list of archives it keeps/prunes

--keep-within INTERVAL

keep all archives within this time interval

--keep-last, --keep-secondly

number of secondly archives to keep

--keep-minutely

number of minutely archives to keep

-H, --keep-hourly

number of hourly archives to keep


-d, --keep-daily

number of daily archives to keep

-w, --keep-weekly

number of weekly archives to keep

-m, --keep-monthly

number of monthly archives to keep

-y, --keep-yearly

number of yearly archives to keep

--save-space

work slower, but using less space

-c SECONDS, --checkpoint-interval SECONDS

write checkpoint every SECONDS seconds (Default: 1800)

Common options

Archive filters — Archive filters can be applied to repository targets.

-P PREFIX, --prefix PREFIX

only consider archive names starting with this prefix. (deprecated)

-a GLOB, --glob-archives GLOB

only consider archive names matching the glob. sh: rules apply (without actually
using the sh: prefix), see “borg help patterns”.

Exemplos:

Keep 7 end of day and 4 additional end of week archives.


# Do a dry-run without actually deleting anything.
$ borg prune -v --list --dry-run --keep-daily=7 --keep-weekly=4 /path/to/repo
# Same as above but only apply to archive names starting with the hostname
# of the machine followed by a "-" character:
$ borg prune -v --list --keep-daily=7 --keep-weekly=4 --glob-archives='{hostname}-
*' /path/to/repo
# actually free disk space:
$ borg compact /path/to/repo

# Keep 7 end of day, 4 additional end of week archives,


# and an end of month archive for every month:
$ borg prune -v --list --keep-daily=7 --keep-weekly=4 --keep-monthly=-1
/path/to/repo

# Keep all backups in the last 10 days, 4 additional end of week archives,
# and an end of month archive for every month:
$ borg prune -v --list --keep-within=10d --keep-weekly=4 --keep-monthly=-1
/path/to/repo

You might also like