File manager - Edit - /usr/share/doc/restic/html/manual_rest.html
Back
<!DOCTYPE html> <html class="writer-html5" lang="en" > <head> <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Manual — restic 0.12.1 documentation</title> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/css/restic.css" type="text/css" /> <link rel="shortcut icon" href="_static/favicon.ico"/> <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/jquery.js"></script> <script src="_static/underscore.js"></script> <script src="_static/doctools.js"></script> <script src="_static/js/theme.js"></script> <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="next" title="Developer Information" href="developer_information.html" /> <link rel="prev" title="FAQ" href="faq.html" /> </head> <body class="wy-body-for-nav"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search" > <a href="index.html" class="icon icon-home"> restic <img src="_static/logo.png" class="logo" alt="Logo"/> </a> <div class="version"> 0.12.1 </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="search.html" method="get"> <input type="text" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="010_introduction.html">Introduction</a></li> <li class="toctree-l1"><a class="reference internal" href="020_installation.html">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="030_preparing_a_new_repo.html">Preparing a new repository</a></li> <li class="toctree-l1"><a class="reference internal" href="040_backup.html">Backing up</a></li> <li class="toctree-l1"><a class="reference internal" href="045_working_with_repos.html">Working with repositories</a></li> <li class="toctree-l1"><a class="reference internal" href="050_restore.html">Restoring from backup</a></li> <li class="toctree-l1"><a class="reference internal" href="060_forget.html">Removing backup snapshots</a></li> <li class="toctree-l1"><a class="reference internal" href="070_encryption.html">Encryption</a></li> <li class="toctree-l1"><a class="reference internal" href="075_scripting.html">Scripting</a></li> <li class="toctree-l1"><a class="reference internal" href="080_examples.html">Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="090_participating.html">Participating</a></li> <li class="toctree-l1"><a class="reference internal" href="100_references.html">References</a></li> <li class="toctree-l1"><a class="reference internal" href="110_talks.html">Talks</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">FAQ</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="#">Manual</a><ul> <li class="toctree-l2"><a class="reference internal" href="#usage-help">Usage help</a></li> <li class="toctree-l2"><a class="reference internal" href="#manage-tags">Manage tags</a></li> <li class="toctree-l2"><a class="reference internal" href="#under-the-hood">Under the hood</a><ul> <li class="toctree-l3"><a class="reference internal" href="#browse-repository-objects">Browse repository objects</a></li> <li class="toctree-l3"><a class="reference internal" href="#metadata-handling">Metadata handling</a></li> <li class="toctree-l3"><a class="reference internal" href="#getting-information-about-repository-data">Getting information about repository data</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="#scripting">Scripting</a></li> <li class="toctree-l2"><a class="reference internal" href="#temporary-files">Temporary files</a></li> <li class="toctree-l2"><a class="reference internal" href="#caching">Caching</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="developer_information.html">Developer Information</a></li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="index.html">restic</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="Page navigation"> <ul class="wy-breadcrumbs"> <li><a href="index.html" class="icon icon-home"></a> »</li> <li>Manual</li> <li class="wy-breadcrumbs-aside"> <a href="_sources/manual_rest.rst.txt" rel="nofollow"> View page source</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <section id="manual"> <h1>Manual<a class="headerlink" href="#manual" title="Permalink to this headline">¶</a></h1> <section id="usage-help"> <h2>Usage help<a class="headerlink" href="#usage-help" title="Permalink to this headline">¶</a></h2> <p>Usage help is available:</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>./restic --help <span class="go">restic is a backup program which allows saving multiple revisions of files and</span> <span class="go">directories in an encrypted repository stored on different backends.</span> <span class="go">Usage:</span> <span class="go"> restic [command]</span> <span class="go">Available Commands:</span> <span class="go"> backup Create a new backup of files and/or directories</span> <span class="go"> cache Operate on local cache directories</span> <span class="go"> cat Print internal objects to stdout</span> <span class="go"> check Check the repository for errors</span> <span class="go"> copy Copy snapshots from one repository to another</span> <span class="go"> diff Show differences between two snapshots</span> <span class="go"> dump Print a backed-up file to stdout</span> <span class="go"> find Find a file, a directory or restic IDs</span> <span class="go"> forget Remove snapshots from the repository</span> <span class="go"> generate Generate manual pages and auto-completion files (bash, fish, zsh)</span> <span class="go"> help Help about any command</span> <span class="go"> init Initialize a new repository</span> <span class="go"> key Manage keys (passwords)</span> <span class="go"> list List objects in the repository</span> <span class="go"> ls List files in a snapshot</span> <span class="go"> migrate Apply migrations</span> <span class="go"> mount Mount the repository</span> <span class="go"> prune Remove unneeded data from the repository</span> <span class="go"> rebuild-index Build a new index</span> <span class="go"> recover Recover data from the repository</span> <span class="go"> restore Extract the data from a snapshot</span> <span class="go"> self-update Update the restic binary</span> <span class="go"> snapshots List all snapshots</span> <span class="go"> stats Scan the repository and show basic statistics</span> <span class="go"> tag Modify tags on snapshots</span> <span class="go"> unlock Remove locks other processes created</span> <span class="go"> version Print version information</span> <span class="go">Flags:</span> <span class="go"> --cacert file file to load root certificates from (default: use system certificates)</span> <span class="go"> --cache-dir directory set the cache directory. (default: use system default cache directory)</span> <span class="go"> --cleanup-cache auto remove old cache directories</span> <span class="go"> -h, --help help for restic</span> <span class="go"> --json set output mode to JSON for commands that support it</span> <span class="go"> --key-hint key key ID of key to try decrypting first (default: $RESTIC_KEY_HINT)</span> <span class="go"> --limit-download int limits downloads to a maximum rate in KiB/s. (default: unlimited)</span> <span class="go"> --limit-upload int limits uploads to a maximum rate in KiB/s. (default: unlimited)</span> <span class="go"> --no-cache do not use a local cache</span> <span class="go"> --no-lock do not lock the repository, this allows some operations on read-only repositories</span> <span class="go"> -o, --option key=value set extended option (key=value, can be specified multiple times)</span> <span class="go"> --password-command command shell command to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)</span> <span class="go"> -p, --password-file file file to read the repository password from (default: $RESTIC_PASSWORD_FILE)</span> <span class="go"> -q, --quiet do not output comprehensive progress report</span> <span class="go"> -r, --repo repository repository to backup to or restore from (default: $RESTIC_REPOSITORY)</span> <span class="go"> --repository-file file file to read the repository location from (default: $RESTIC_REPOSITORY_FILE)</span> <span class="go"> --tls-client-cert file path to a file containing PEM encoded TLS client certificate and private key</span> <span class="go"> -v, --verbose n be verbose (specify multiple times or a level using --verbose=n, max level/times is 3)</span> <span class="go">Use "restic [command] --help" for more information about a command.</span> </pre></div> </div> <p>Similar to programs such as <code class="docutils literal notranslate"><span class="pre">git</span></code>, restic has a number of sub-commands. You can see these commands in the listing above. Each sub-command may have own command-line options, and there is a help option for each command which lists them, e.g. for the <code class="docutils literal notranslate"><span class="pre">backup</span></code> command:</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>./restic backup --help <span class="go">The "backup" command creates a new snapshot and saves the files and directories</span> <span class="go">given as the arguments.</span> <span class="go">EXIT STATUS</span> <span class="go">===========</span> <span class="go">Exit status is 0 if the command was successful.</span> <span class="go">Exit status is 1 if there was a fatal error (no snapshot created).</span> <span class="go">Exit status is 3 if some source data could not be read (incomplete snapshot created).</span> <span class="go">Usage:</span> <span class="go"> restic backup [flags] FILE/DIR [FILE/DIR] ...</span> <span class="go">Flags:</span> <span class="go"> -e, --exclude pattern exclude a pattern (can be specified multiple times)</span> <span class="go"> --exclude-caches excludes cache directories that are marked with a CACHEDIR.TAG file. See https://bford.info/cachedir/ for the Cache Directory Tagging Standard</span> <span class="go"> --exclude-file file read exclude patterns from a file (can be specified multiple times)</span> <span class="go"> --exclude-if-present filename[:header] takes filename[:header], exclude contents of directories containing filename (except filename itself) if header of that file is as provided (can be specified multiple times)</span> <span class="go"> --exclude-larger-than size max size of the files to be backed up (allowed suffixes: k/K, m/M, g/G, t/T)</span> <span class="go"> --files-from file read the files to backup from file (can be combined with file args; can be specified multiple times)</span> <span class="go"> --files-from-raw file read the files to backup from file (can be combined with file args; can be specified multiple times)</span> <span class="go"> --files-from-verbatim file read the files to backup from file (can be combined with file args; can be specified multiple times)</span> <span class="go"> -f, --force force re-reading the target files/directories (overrides the "parent" flag)</span> <span class="go"> -h, --help help for backup</span> <span class="go"> -H, --host hostname set the hostname for the snapshot manually. To prevent an expensive rescan use the "parent" flag</span> <span class="go"> --iexclude pattern same as --exclude pattern but ignores the casing of filenames</span> <span class="go"> --iexclude-file file same as --exclude-file but ignores casing of filenames in patterns</span> <span class="go"> --ignore-inode ignore inode number changes when checking for modified files</span> <span class="go"> -x, --one-file-system exclude other file systems, don't cross filesystem boundaries and subvolumes</span> <span class="go"> --parent snapshot use this parent snapshot (default: last snapshot in the repo that has the same target files/directories)</span> <span class="go"> --stdin read backup from stdin</span> <span class="go"> --stdin-filename filename filename to use when reading from stdin (default "stdin")</span> <span class="go"> --tag tags add tags for the new snapshot in the format `tag[,tag,...]` (can be specified multiple times) (default [])</span> <span class="go"> --time time time of the backup (ex. '2012-11-01 22:08:41') (default: now)</span> <span class="go"> --use-fs-snapshot use filesystem snapshot where possible (currently only Windows VSS)</span> <span class="go"> --with-atime store the atime for all files and directories</span> <span class="go">Global Flags:</span> <span class="go"> --cacert file file to load root certificates from (default: use system certificates)</span> <span class="go"> --cache-dir directory set the cache directory. (default: use system default cache directory)</span> <span class="go"> --cleanup-cache auto remove old cache directories</span> <span class="go"> --json set output mode to JSON for commands that support it</span> <span class="go"> --key-hint key key ID of key to try decrypting first (default: $RESTIC_KEY_HINT)</span> <span class="go"> --limit-download int limits downloads to a maximum rate in KiB/s. (default: unlimited)</span> <span class="go"> --limit-upload int limits uploads to a maximum rate in KiB/s. (default: unlimited)</span> <span class="go"> --no-cache do not use a local cache</span> <span class="go"> --no-lock do not lock the repository, this allows some operations on read-only repositories</span> <span class="go"> -o, --option key=value set extended option (key=value, can be specified multiple times)</span> <span class="go"> --password-command command shell command to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)</span> <span class="go"> -p, --password-file file file to read the repository password from (default: $RESTIC_PASSWORD_FILE)</span> <span class="go"> -q, --quiet do not output comprehensive progress report</span> <span class="go"> -r, --repo repository repository to backup to or restore from (default: $RESTIC_REPOSITORY)</span> <span class="go"> --repository-file file file to read the repository location from (default: $RESTIC_REPOSITORY_FILE)</span> <span class="go"> --tls-client-cert file path to a file containing PEM encoded TLS client certificate and private key</span> <span class="go"> -v, --verbose n be verbose (specify multiple times or a level using --verbose=n, max level/times is 3)</span> </pre></div> </div> <p>Subcommands that support showing progress information such as <code class="docutils literal notranslate"><span class="pre">backup</span></code>, <code class="docutils literal notranslate"><span class="pre">check</span></code> and <code class="docutils literal notranslate"><span class="pre">prune</span></code> will do so unless the quiet flag <code class="docutils literal notranslate"><span class="pre">-q</span></code> or <code class="docutils literal notranslate"><span class="pre">--quiet</span></code> is set. When running from a non-interactive console progress reporting is disabled by default to not fill your logs. For interactive and non-interactive consoles the environment variable <code class="docutils literal notranslate"><span class="pre">RESTIC_PROGRESS_FPS</span></code> can be used to control the frequency of progress reporting. Use for example <code class="docutils literal notranslate"><span class="pre">0.016666</span></code> to only update the progress once per minute.</p> <p>Additionally, on Unix systems if <code class="docutils literal notranslate"><span class="pre">restic</span></code> receives a SIGUSR1 signal the current progress will be written to the standard output so you can check up on the status at will.</p> <p>Setting the <cite>RESTIC_PROGRESS_FPS</cite> environment variable or sending a <cite>SIGUSR1</cite> signal prints a status report even when <cite>–quiet</cite> was specified.</p> </section> <section id="manage-tags"> <h2>Manage tags<a class="headerlink" href="#manage-tags" title="Permalink to this headline">¶</a></h2> <p>Managing tags on snapshots is done with the <code class="docutils literal notranslate"><span class="pre">tag</span></code> command. The existing set of tags can be replaced completely, tags can be added or removed. The result is directly visible in the <code class="docutils literal notranslate"><span class="pre">snapshots</span></code> command.</p> <p>Let’s say we want to tag snapshot <code class="docutils literal notranslate"><span class="pre">590c8fc8</span></code> with the tags <code class="docutils literal notranslate"><span class="pre">NL</span></code> and <code class="docutils literal notranslate"><span class="pre">CH</span></code> and remove all other tags that may be present, the following command does that:</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>restic -r /srv/restic-repo tag --set NL --set CH 590c8fc8 <span class="go">create exclusive lock for repository</span> <span class="go">modified tags on 1 snapshots</span> </pre></div> </div> <p>Note the snapshot ID has changed, so between each change we need to look up the new ID of the snapshot. But there is an even better way - the <code class="docutils literal notranslate"><span class="pre">tag</span></code> command accepts a filter using the <code class="docutils literal notranslate"><span class="pre">--tag</span></code> option, so we can filter snapshots based on the tag we just added. This way we can add and remove tags incrementally:</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>restic -r /srv/restic-repo tag --tag NL --remove CH <span class="go">create exclusive lock for repository</span> <span class="go">modified tags on 1 snapshots</span> <span class="gp">$ </span>restic -r /srv/restic-repo tag --tag NL --add UK <span class="go">create exclusive lock for repository</span> <span class="go">modified tags on 1 snapshots</span> <span class="gp">$ </span>restic -r /srv/restic-repo tag --tag NL --remove NL <span class="go">create exclusive lock for repository</span> <span class="go">modified tags on 1 snapshots</span> <span class="gp">$ </span>restic -r /srv/restic-repo tag --tag NL --add SOMETHING <span class="go">no snapshots were modified</span> </pre></div> </div> <p>To operate on untagged snapshots only, specify the empty string <code class="docutils literal notranslate"><span class="pre">''</span></code> as the filter value to <code class="docutils literal notranslate"><span class="pre">--tag</span></code>. The following command will add the tag <code class="docutils literal notranslate"><span class="pre">OTHER</span></code> to all untagged snapshots:</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>restic -r /srv/restic-repo tag --tag <span class="s1">''</span> --add OTHER </pre></div> </div> </section> <section id="under-the-hood"> <h2>Under the hood<a class="headerlink" href="#under-the-hood" title="Permalink to this headline">¶</a></h2> <section id="browse-repository-objects"> <h3>Browse repository objects<a class="headerlink" href="#browse-repository-objects" title="Permalink to this headline">¶</a></h3> <p>Internally, a repository stores data of several different types described in the <a class="reference external" href="https://github.com/restic/restic/blob/master/doc/design.rst">design documentation</a>. You can <code class="docutils literal notranslate"><span class="pre">list</span></code> objects such as blobs, packs, index, snapshots, keys or locks with the following command:</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>restic -r /srv/restic-repo list snapshots <span class="go">d369ccc7d126594950bf74f0a348d5d98d9e99f3215082eb69bf02dc9b3e464c</span> </pre></div> </div> <p>The <code class="docutils literal notranslate"><span class="pre">find</span></code> command searches for a given <a class="reference external" href="https://golang.org/pkg/path/filepath/#Match">pattern</a> in the repository.</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>restic -r backup find test.txt <span class="go">debug log file restic.log</span> <span class="go">debug enabled</span> <span class="go">enter password for repository:</span> <span class="go">found 1 matching entries in snapshot 196bc5760c909a7681647949e80e5448e276521489558525680acf1bd428af36</span> <span class="go"> -rw-r--r-- 501 20 5 2015-08-26 14:09:57 +0200 CEST path/to/test.txt</span> </pre></div> </div> <p>The <code class="docutils literal notranslate"><span class="pre">cat</span></code> command allows you to display the JSON representation of the objects or their raw content.</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>restic -r /srv/restic-repo cat snapshot d369ccc7d126594950bf74f0a348d5d98d9e99f3215082eb69bf02dc9b3e464c <span class="go">enter password for repository:</span> <span class="go">{</span> <span class="go"> "time": "2015-08-12T12:52:44.091448856+02:00",</span> <span class="go"> "tree": "05cec17e8d3349f402576d02576a2971fc0d9f9776ce2f441c7010849c4ff5af",</span> <span class="go"> "paths": [</span> <span class="go"> "/home/user/work"</span> <span class="go"> ],</span> <span class="go"> "hostname": "kasimir",</span> <span class="go"> "username": "username",</span> <span class="go"> "uid": 501,</span> <span class="go"> "gid": 20</span> <span class="go">}</span> </pre></div> </div> </section> <section id="metadata-handling"> <h3>Metadata handling<a class="headerlink" href="#metadata-handling" title="Permalink to this headline">¶</a></h3> <p>Restic saves and restores most default attributes, including extended attributes like ACLs. Sparse files are not handled in a special way yet, and aren’t restored.</p> <p>The following metadata is handled by restic:</p> <ul class="simple"> <li><p>Name</p></li> <li><p>Type</p></li> <li><p>Mode</p></li> <li><p>ModTime</p></li> <li><p>AccessTime</p></li> <li><p>ChangeTime</p></li> <li><p>UID</p></li> <li><p>GID</p></li> <li><p>User</p></li> <li><p>Group</p></li> <li><p>Inode</p></li> <li><p>Size</p></li> <li><p>Links</p></li> <li><p>LinkTarget</p></li> <li><p>Device</p></li> <li><p>Content</p></li> <li><p>Subtree</p></li> <li><p>ExtendedAttributes</p></li> </ul> </section> <section id="getting-information-about-repository-data"> <h3>Getting information about repository data<a class="headerlink" href="#getting-information-about-repository-data" title="Permalink to this headline">¶</a></h3> <p>Use the <code class="docutils literal notranslate"><span class="pre">stats</span></code> command to count up stats about the data in the repository. There are different counting modes available using the <code class="docutils literal notranslate"><span class="pre">--mode</span></code> flag, depending on what you want to calculate. The default is the restore size, or the size required to restore the files:</p> <ul class="simple"> <li><p><code class="docutils literal notranslate"><span class="pre">restore-size</span></code> (default) counts the size of the restored files.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">files-by-contents</span></code> counts the total size of unique files as given by their contents. This can be useful since a file is considered unique only if it has unique contents. Keep in mind that a small change to a large file (even when the file name/path hasn’t changed) will cause them to look like different files, thus essentially causing the whole size of the file to be counted twice.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">raw-data</span></code> counts the size of the blobs in the repository, regardless of how many files reference them. This tells you how much restic has reduced all your original data down to (either for a single snapshot or across all your backups), and compared to the size given by the restore-size mode, can tell you how much deduplication is helping you.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">blobs-per-file</span></code> is kind of a mix between files-by-contents and raw-data modes; it is useful for knowing how much value your backup is providing you in terms of unique data stored by file. Like files-by-contents, it is resilient to file renames/moves. Unlike files-by-contents, it does not balloon to high values when large files have small edits, as long as the file path stayed the same. Unlike raw-data, this mode DOES consider how many files point to each blob such that the more files a blob is referenced by, the more it counts toward the size.</p></li> </ul> <p>For example, to calculate how much space would be required to restore the latest snapshot (from any host that made it):</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>restic stats latest <span class="go">password is correct</span> <span class="go">Total File Count: 10538</span> <span class="go"> Total Size: 37.824 GiB</span> </pre></div> </div> <p>If multiple hosts are backing up to the repository, the latest snapshot may not be the one you want. You can specify the latest snapshot from only a specific host by using the <code class="docutils literal notranslate"><span class="pre">--host</span></code> flag:</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>restic stats --host myserver latest <span class="go">password is correct</span> <span class="go">Total File Count: 21766</span> <span class="go"> Total Size: 481.783 GiB</span> </pre></div> </div> <p>There we see that it would take 482 GiB of disk space to restore the latest snapshot from “myserver”.</p> <p>In case you have multiple backups running from the same host so can also use <code class="docutils literal notranslate"><span class="pre">--tag</span></code> and <code class="docutils literal notranslate"><span class="pre">--path</span></code> to be more specific about which snapshots you are looking for.</p> <p>But how much space does that snapshot take on disk? In other words, how much has restic’s deduplication helped? We can check:</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>restic stats --host myserver --mode raw-data latest <span class="go">password is correct</span> <span class="go">Total Blob Count: 340847</span> <span class="go"> Total Size: 458.663 GiB</span> </pre></div> </div> <p>Comparing this size to the previous command, we see that restic has saved about 23 GiB of space with deduplication.</p> <p>Which mode you use depends on your exact use case. Some modes are more useful across all snapshots, while others make more sense on just a single snapshot, depending on what you’re trying to calculate.</p> </section> </section> <section id="scripting"> <h2>Scripting<a class="headerlink" href="#scripting" title="Permalink to this headline">¶</a></h2> <p>Restic supports the output of some commands in JSON format, the JSON data can then be processed by other programs (e.g. <a class="reference external" href="https://stedolan.github.io/jq/">jq</a>). The following example lists all snapshots as JSON and uses <code class="docutils literal notranslate"><span class="pre">jq</span></code> to pretty-print the result:</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>restic -r /srv/restic-repo snapshots --json <span class="p">|</span> jq . <span class="go">[</span> <span class="go"> {</span> <span class="go"> "time": "2017-03-11T09:57:43.26630619+01:00",</span> <span class="go"> "tree": "bf25241679533df554fc0fd0ae6dbb9dcf1859a13f2bc9dd4543c354eff6c464",</span> <span class="go"> "paths": [</span> <span class="go"> "/home/work/doc"</span> <span class="go"> ],</span> <span class="go"> "hostname": "kasimir",</span> <span class="go"> "username": "fd0",</span> <span class="go"> "uid": 1000,</span> <span class="go"> "gid": 100,</span> <span class="go"> "id": "bbeed6d28159aa384d1ccc6fa0b540644b1b9599b162d2972acda86b1b80f89e"</span> <span class="go"> },</span> <span class="go"> {</span> <span class="go"> "time": "2017-03-11T09:58:57.541446938+01:00",</span> <span class="go"> "tree": "7f8c95d3420baaac28dc51609796ae0e0ecfb4862b609a9f38ffaf7ae2d758da",</span> <span class="go"> "paths": [</span> <span class="go"> "/home/user/shared"</span> <span class="go"> ],</span> <span class="go"> "hostname": "kasimir",</span> <span class="go"> "username": "fd0",</span> <span class="go"> "uid": 1000,</span> <span class="go"> "gid": 100,</span> <span class="go"> "id": "b157d91c16f0ba56801ece3a708dfc53791fe2a97e827090d6ed9a69a6ebdca0"</span> <span class="go"> }</span> <span class="go">]</span> </pre></div> </div> </section> <section id="temporary-files"> <span id="id1"></span><h2>Temporary files<a class="headerlink" href="#temporary-files" title="Permalink to this headline">¶</a></h2> <p>During some operations (e.g. <code class="docutils literal notranslate"><span class="pre">backup</span></code> and <code class="docutils literal notranslate"><span class="pre">prune</span></code>) restic uses temporary files to store data. These files will, by default, be saved to the system’s temporary directory, on Linux this is usually located in <code class="docutils literal notranslate"><span class="pre">/tmp/</span></code>. The environment variable <code class="docutils literal notranslate"><span class="pre">TMPDIR</span></code> can be used to specify a different directory, e.g. to use the directory <code class="docutils literal notranslate"><span class="pre">/var/tmp/restic-tmp</span></code> instead of the default, set the environment variable like this:</p> <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="nb">export</span> <span class="nv">TMPDIR</span><span class="o">=</span>/var/tmp/restic-tmp <span class="gp">$ </span>restic -r /srv/restic-repo backup ~/work </pre></div> </div> </section> <section id="caching"> <span id="id2"></span><h2>Caching<a class="headerlink" href="#caching" title="Permalink to this headline">¶</a></h2> <p>Restic keeps a cache with some files from the repository on the local machine. This allows faster operations, since meta data does not need to be loaded from a remote repository. The cache is automatically created, usually in an OS-specific cache folder:</p> <blockquote> <div><ul class="simple"> <li><p>Linux/other: <code class="docutils literal notranslate"><span class="pre">$XDG_CACHE_HOME/restic</span></code>, or <code class="docutils literal notranslate"><span class="pre">~/.cache/restic</span></code> if <code class="docutils literal notranslate"><span class="pre">XDG_CACHE_HOME</span></code> is not set</p></li> <li><p>macOS: <code class="docutils literal notranslate"><span class="pre">~/Library/Caches/restic</span></code></p></li> <li><p>Windows: <code class="docutils literal notranslate"><span class="pre">%LOCALAPPDATA%/restic</span></code></p></li> </ul> </div></blockquote> <p>If the relevant environment variables are not set, restic exits with an error message.</p> <p>The command line parameter <code class="docutils literal notranslate"><span class="pre">--cache-dir</span></code> or the environment variable <code class="docutils literal notranslate"><span class="pre">$RESTIC_CACHE_DIR</span></code> can be used to override the default cache location. The parameter <code class="docutils literal notranslate"><span class="pre">--no-cache</span></code> disables the cache entirely. In this case, all data is loaded from the repo.</p> <p>The cache is ephemeral: When a file cannot be read from the cache, it is loaded from the repository.</p> <p>Within the cache directory, there’s a sub directory for each repository the cache was used with. Restic updates the timestamps of a repo directory each time it is used, so by looking at the timestamps of the sub directories of the cache directory it can decide which sub directories are old and probably not needed any more. You can either remove these directories manually, or run a restic command with the <code class="docutils literal notranslate"><span class="pre">--cleanup-cache</span></code> flag.</p> </section> </section> </div> </div> <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> <a href="faq.html" class="btn btn-neutral float-left" title="FAQ" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> <a href="developer_information.html" class="btn btn-neutral float-right" title="Developer Information" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> </div> <hr/> <div role="contentinfo"> <p>© Copyright 2024, restic authors.</p> </div> Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. </footer> </div> </div> </section> </div> <script> jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings