mirror of
https://github.com/borgbackup/borg.git
synced 2026-03-27 21:03:05 -04:00
a file map can be:
- created internally inside chunkify by calling sparsemap, which uses
SEEK_DATA / SEEK_HOLE to determine data and hole ranges inside a
seekable sparse file.
Usage: borg create --sparse --chunker-params=fixed,BLOCKSIZE ...
BLOCKSIZE is the chunker blocksize here, not the filesystem blocksize!
- made by some other means and given to the chunkify function.
this is not used yet, but in future this could be used to only read
the changed parts and seek over the (known) unchanged parts of a file.
sparsemap: the generate range sizes are multiples of the fs block size.
the tests assume 4kiB fs block size.
76 lines
3.2 KiB
ReStructuredText
76 lines
3.2 KiB
ReStructuredText
.. include:: create.rst.inc
|
|
|
|
Examples
|
|
~~~~~~~~
|
|
::
|
|
|
|
# Backup ~/Documents into an archive named "my-documents"
|
|
$ borg create /path/to/repo::my-documents ~/Documents
|
|
|
|
# same, but list all files as we process them
|
|
$ borg create --list /path/to/repo::my-documents ~/Documents
|
|
|
|
# Backup ~/Documents and ~/src but exclude pyc files
|
|
$ borg create /path/to/repo::my-files \
|
|
~/Documents \
|
|
~/src \
|
|
--exclude '*.pyc'
|
|
|
|
# Backup home directories excluding image thumbnails (i.e. only
|
|
# /home/<one directory>/.thumbnails is excluded, not /home/*/*/.thumbnails etc.)
|
|
$ borg create /path/to/repo::my-files /home \
|
|
--exclude 'sh:/home/*/.thumbnails'
|
|
|
|
# Backup the root filesystem into an archive named "root-YYYY-MM-DD"
|
|
# use zlib compression (good, but slow) - default is lz4 (fast, low compression ratio)
|
|
$ borg create -C zlib,6 --one-file-system /path/to/repo::root-{now:%Y-%m-%d} /
|
|
|
|
# Backup onto a remote host ("push" style) via ssh to port 2222,
|
|
# logging in as user "borg" and storing into /path/to/repo
|
|
$ borg create ssh://borg@backup.example.org:2222/path/to/repo::{fqdn}-root-{now} /
|
|
|
|
# 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
|
|
|
|
# Make a big effort in fine granular deduplication (big chunk management
|
|
# overhead, needs a lot of RAM and disk space, see formula in internals
|
|
# docs - same parameters as borg < 1.0 or attic):
|
|
$ borg create --chunker-params buzhash,10,23,16,4095 /path/to/repo::small /smallstuff
|
|
|
|
# Backup a raw device (must not be active/in use/mounted at that time)
|
|
$ borg create --read-special --chunker-params fixed,4194304 /path/to/repo::my-sdx /dev/sdX
|
|
|
|
# Backup a sparse disk image (must not be active/in use/mounted at that time)
|
|
$ borg create --sparse --chunker-params fixed,4194304 /path/to/repo::my-disk my-disk.raw
|
|
|
|
# No compression (none)
|
|
$ borg create --compression none /path/to/repo::arch ~
|
|
|
|
# Super fast, low compression (lz4, default)
|
|
$ borg create /path/to/repo::arch ~
|
|
|
|
# Less fast, higher compression (zlib, N = 0..9)
|
|
$ borg create --compression zlib,N /path/to/repo::arch ~
|
|
|
|
# Even slower, even higher compression (lzma, N = 0..9)
|
|
$ borg create --compression lzma,N /path/to/repo::arch ~
|
|
|
|
# Only compress compressible data with lzma,N (N = 0..9)
|
|
$ borg create --compression auto,lzma,N /path/to/repo::arch ~
|
|
|
|
# Use short hostname, user name and current time in archive name
|
|
$ borg create /path/to/repo::{hostname}-{user}-{now} ~
|
|
# Similar, use the same datetime format that is default as of borg 1.1
|
|
$ borg create /path/to/repo::{hostname}-{user}-{now:%Y-%m-%dT%H:%M:%S} ~
|
|
# As above, but add nanoseconds
|
|
$ borg create /path/to/repo::{hostname}-{user}-{now:%Y-%m-%dT%H:%M:%S.%f} ~
|
|
|
|
# Backing up relative paths by moving into the correct directory first
|
|
$ cd /home/user/Documents
|
|
# The root directory of the archive will be "projectA"
|
|
$ borg create /path/to/repo::daily-projectA-{now:%Y-%m-%d} projectA
|