Mostra la pàginaRevisions anteriorsQuè hi enllaçaExporta a PDFTorna dalt Aquesta pàgina és només de lectura. Podeu veure'n el codi font, però no podeu canviar-la. Consulteu el vostre administrador si penseu que això és degut a algun error. = borgbackup * [[https://borgbackup.readthedocs.io/en/stable/index.html]] * [[https://www.atareao.es/podcast/hice-un-rm-rf-salvado-por-borg/]] * alternativa?: [[https://restic.readthedocs.io/en/stable/index.html]] == quick <code bash> sudo mount /media/mate/3TB-EXT4_BACKUP2 sudo borg list /media/mate/3TB-EXT4_BACKUP2/borgbackup/home sudo borg list /media/mate/3TB-EXT4_BACKUP2/borgbackup/entireDisk tail -f /media/mate/3TB-EXT4_BACKUP2/borgbackup/entireDisk.last_exec.txt sudo myscripts/backups/borg-create_entireDisk_encrypted.sh tail -f /media/mate/3TB-EXT4_BACKUP2/borgbackup/home.last_exec.txt sudo scripts/backups/borg-create_home_encrypted.sh </code> == repositorio * creación repositorio:<code bash>borg init --encryption=[none|repokey-blake2] [--make-parent-dirs] [--storage-quota QUOTA ] /path/to/repo</code> * backup repokey:<code bash>borg key export [--paper] [--qr-html] <REPO> /path/to/repokey.export</code> * información del repositorio o archivo:<code bash>borg info /path/to/repo</code> == archivo (de backup) * creación archivo de copia:<code bash>borg create [--stats] /path/to/repo::<archivo> /path/files/tobe/backuped1 [path/files/tobe/backuped2]</code> * parámetros: * %%--%%list: muestra información de los ficheros que va evaluando. Por defecto no muestra nada * %%--%%filter=<CHARS>: filtra los archivos que se muestran en ''--list'':<code> ‘A’ = regular file, added ‘M’ = regular file, modified ‘U’ = regular file, unchanged ‘E’ = regular file, an error happened while accessing/reading this file A lowercase character means a file type other than a regular file, borg usually just stores their metadata: ‘d’ = directory ‘b’ = block device ‘c’ = char device ‘h’ = regular file, hardlink (to already seen inodes) ‘s’ = symlink ‘f’ = fifo Other flags used include: ‘i’ = backup data was read from standard input (stdin) ‘-‘ = dry run, item was not backed up ‘x’ = excluded, item was not backed up ‘?’ = missing status code (if you see this, please file a bug report!)</code> * %%--%%exclude-caches: ignora directorios con la firma **CACHEDIR.TAG** ([[https://bford.info/cachedir/]]) * %%--%%exclude-from <EXCLUDE_FILE>: ignora los ficheros/directorios según el patrón * %%--%%exclude-if-present <NAME>: nombre del fichero que hace ignorar la copia de directorios y subdirectorios incluidos * %%--%%keep-exclude-tags invierte el uso del exclude a include (solo se haría copia de los que incluyen el fichero-tag) == listar & info * listar archivos en repositorio:<code bash>borg list /path/to/repo</code> * listar contenido de un archivo:<code bash>borg list /path/to/repo::<archivo></code> * información de repositorio:<code bash>borg info /path/to/repo</code> * información de un archivo del repositorio:<code bash>borg info /path/to/repo::<archivo></code> == recuperación * extraer un archivo:<code bash>borg extract /path/to/repo::<archivo></code> === montar * [[https://borgbackup.readthedocs.io/en/stable/usage/mount.html]] * fuse.borgfs (uso en /etc/fstab) * montar el repo:<code bash>borg mount /path/to/repo /mount/point</code> * hay un parámetro experimental (y versión 1.1.14?) que mezcla todos los archivos del repo en una "vista": **-o versions** * %%--%%glob-archives '%%*%%-my-home': "include" archivos * %%--%%last 10 * %%--%%exclude * montar un archivo del repo:<code bash>borg mount::<archivo> /path/to/repo /mount/point</code> ===desmontar * <code bash>borg umount /mount/point</code> === exportar * <code bash>borg export-tar /path/to/repo::<archivo> fichero.tar</code> * [[https://borgbackup.readthedocs.io/en/stable/usage/tar.html]] == prune * aka retención * ejecutar siempre pruebas con ''%%--%%list %%--%%dry-run'' * eliminar copias que no cumplan los criterios de retención establecidos * parámetros: * %%--%%keep-last, %%--%%keep-secondly #: número de segundos archivos a mantener * %%--%%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 * <code bash>borg prune \ --keep-daily 7 \ --keep-weekly 4 \ --keep-monthly 12 \ --keep-yearly 1 \ /path/to/repo </code> * mantiene copia de los últimos 7 días * mantiene copia de uno de los días de las últimas 4 semanas * mantiene copia de un día de los últimos 12 meses * mantiene copia de un día del último año == borrado * borrado de repositorio y archivos:<code bash>borg delete /path/to/repo::<archivo></code> == remove-lock <code>Failed to create/acquire the lock /path/to/repo/lock.exclusive (timeout). terminating with error status, rc 2</code> <code bash>borg break-lock /path/to/repo</code> == automatización * especificar el repositorio:<code bash>export BORG_REPO=ssh://username@example.com:2022/~/backup/main</code><code bash>export BORG_REPO=/path/to/repo</code> * especificar la contraseña:<code bash>export BORG_PASSPHRASE='XYZl0ngandsecurepa_55_phrasea&&123'</code> * si el comando **borg** se lanza con **sudo**, usar **--preserve-env** si se está exportando el repositorio o la contraseña previamente. * se pueden usar **placeholders** * {hostname}, {fqdn}, {reverse-fqdn} * {now}, {now:%Y-%m-%d}, {utcnow} * {user}, {pid} * {borgversion}, {borgmajor}, {borgminor}, {borgpatch} * variables de entorno: [[https://borgbackup.readthedocs.io/en/1.1.11/usage/general.html#environment-variables]] == include, exclude y patterns * //selectores de estilo// para los patterns: * Fnmatch -> fn: * Shell-style patterns -> sh: * Fnmatch + %%**%% y %%*%% * Regular expressions -> re: * Path prefix -> pp: * Path full-match -> pf: === exclude * selector de estilo por defecto: **fn:** === patterns * selector de estilo por defecto: **sh:** * [[https://manpages.debian.org/testing/borgbackup/borg-patterns.1.en.html]] * [[https://borgbackup.readthedocs.io/en/stable/usage/help.html#borg-help-patterns]] * permite seleccionar inclusiones (+) y exclusiones (-) * ''P'' indica el estilo de pattern a aplicar según la lista anterior * ''R'' indica el/los //root path// <- permite omitir el path del backup en **borg create** * ''+'' incluye * ''-'' excluye -> indicar ''%%**/%%'' para archivos y directorios * ''!'' excluye recursivamente * <code ; patterns.lst> # "sh:" pattern style is the default, so the following line is not needed: P sh R / # can be rebuild - /home/*/.cache # they're downloads for a reason - /home/*/Downloads # susan is a nice person # include susans home + /home/susan # don't backup the other home directories - /home/* # don't even look in /proc ! /proc</code> == common options <code> --critical: work on log level CRITICAL --error: work on log level ERROR --warning: work on log level WARNING (default) --info, -v, --verbose: work on log level INFO --debug: enable debug output, work on log level DEBUG --debug-topic TOPIC: enable TOPIC debugging (can be specified multiple times). The logger path is borg.debug.<TOPIC> if TOPIC is not fully qualified. --progress, -p: show progress information --log-json: Output one JSON object per log line instead of formatted text. --lock-wait SECONDS: wait at most SECONDS for acquiring a repository/cache lock (default: 1). --show-version: show/log the borg version --show-rc: show/log the return code (rc) --umask M: set umask to M (local and remote, default: 0077) --remote-path PATH: use PATH as borg executable on the remote (default: “borg”) --remote-ratelimit RATE: set remote network upload rate limit in kiByte/s (default: 0=unlimited) --consider-part-files: treat part files like normal files (e.g. to list/extract them) --debug-profile FILE: Write execution profile in Borg format into FILE. For local use a Python-compatible file can be generated by suffixing FILE with “.pyprof”. --rsh RSH: Use this command to connect to the ‘borg serve’ process (default: ‘ssh’) </code> == scripts <code bash> # Backup a remote host locally ("pull" style) using sshfs mkdir sshfs-mount sshfs root@example.com:/ sshfs-mount cd sshfs-mount borg create /path/to/repo::example.com-root-{now:%Y-%m-%d} . cd .. fusermount -u sshfs-mount </code> software/backup/borg.txt Darrera modificació: 15/06/2022 02:19per mate