github.com/advanderveer/restic@v0.8.1-0.20171209104529-42a8c19aaea6/doc/050_restore.rst (about)

     1  ..
     2    Normally, there are no heading levels assigned to certain characters as the structure is
     3    determined from the succession of headings. However, this convention is used in Python’s
     4    Style Guide for documenting which you may follow:
     5  
     6    # with overline, for parts
     7    * for chapters
     8    = for sections
     9    - for subsections
    10    ^ for subsubsections
    11    " for paragraphs
    12  
    13  #####################
    14  Restoring from backup
    15  #####################
    16  
    17  Restoring from a snapshot
    18  =========================
    19  
    20  Restoring a snapshot is as easy as it sounds, just use the following
    21  command to restore the contents of the latest snapshot to
    22  ``/tmp/restore-work``:
    23  
    24  .. code-block:: console
    25  
    26      $ restic -r /tmp/backup restore 79766175 --target /tmp/restore-work
    27      enter password for repository:
    28      restoring <Snapshot of [/home/user/work] at 2015-05-08 21:40:19.884408621 +0200 CEST> to /tmp/restore-work
    29  
    30  Use the word ``latest`` to restore the last backup. You can also combine
    31  ``latest`` with the ``--host`` and ``--path`` filters to choose the last
    32  backup for a specific host, path or both.
    33  
    34  .. code-block:: console
    35  
    36      $ restic -r /tmp/backup restore latest --target /tmp/restore-art --path "/home/art" --host luigi
    37      enter password for repository:
    38      restoring <Snapshot of [/home/art] at 2015-05-08 21:45:17.884408621 +0200 CEST> to /tmp/restore-art
    39  
    40  Use ``--exclude`` and ``--include`` to restrict the restore to a subset of
    41  files in the snapshot. For example, to restore a single file:
    42  
    43  .. code-block:: console
    44  
    45      $ restic -r /tmp/backup restore 79766175 --target /tmp/restore-work --include /work/foo
    46      enter password for repository:
    47      restoring <Snapshot of [/home/user/work] at 2015-05-08 21:40:19.884408621 +0200 CEST> to /tmp/restore-work
    48  
    49  This will restore the file ``foo`` to ``/tmp/restore-work/work/foo``.
    50  
    51  Restore using mount
    52  ===================
    53  
    54  Browsing your backup as a regular file system is also very easy. First,
    55  create a mount point such as ``/mnt/restic`` and then use the following
    56  command to serve the repository with FUSE:
    57  
    58  .. code-block:: console
    59  
    60      $ mkdir /mnt/restic
    61      $ restic -r /tmp/backup mount /mnt/restic
    62      enter password for repository:
    63      Now serving /tmp/backup at /mnt/restic
    64      Don't forget to umount after quitting!
    65  
    66  Mounting repositories via FUSE is not possible on Windows and OpenBSD.
    67  
    68  Restic supports storage and preservation of hard links. However, since
    69  hard links exist in the scope of a filesystem by definition, restoring
    70  hard links from a fuse mount should be done by a program that preserves
    71  hard links. A program that does so is ``rsync``, used with the option
    72  --hard-links.
    73  
    74  Printing files to stdout
    75  ========================
    76  
    77  Sometimes it's helpful to print files to stdout so that other programs can read
    78  the data directly. This can be achieved by using the `dump` command, like this:
    79  
    80  .. code-block:: console
    81  
    82      $ restic -r /tmp/backup dump latest production.sql | mysql