From 6559fa7382abfea8ad67390caf9f965901bca449 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 17 Feb 2016 16:10:31 +0100 Subject: [PATCH 1/9] Add mkdocs for readthedocs.org --- doc/Manual.md | 338 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/index.md | 17 +++ mkdocs.yml | 7 ++ 3 files changed, 362 insertions(+) create mode 100644 doc/Manual.md create mode 100644 doc/index.md create mode 100644 mkdocs.yml diff --git a/doc/Manual.md b/doc/Manual.md new file mode 100644 index 000000000..0acedf084 --- /dev/null +++ b/doc/Manual.md @@ -0,0 +1,338 @@ +--- +layout: page +title: User Manual +permalink: /manual/ +sitenav: + - { anchor: "building-restic", title: "Building restic" } + - { anchor: "initialize-repository", title: "Initialize a repository" } + - { anchor: "create-snapshot", title: "Create a snapshot" } + - { anchor: "list-snapshots", title: "List all snapshots" } + - { anchor: "restore-snapshot", title: "Restore a snapshot" } + - { anchor: "manage-repository-keys", title: "Manage repository keys" } + - { anchor: "check-integrity-consistency", title: "Check the repository" } + - { anchor: "mount-repository", title: "Mount a repository" } + - { anchor: "sftp-repository", title: "SFTP repository" } + - { anchor: "s3-repository", title: "S3 repository" } + - { anchor: "browse-repository-objects", title: "Under the hood: Browse repository objects" } +--- + +## Building restic + +If you are using Mac OS X, you can install restic using the [homebrew](http://brew.sh/) packet manager: + +{% highlight console %} +brew tap restic/restic +brew install restic +{% endhighlight %} + +If you are using Linux, BSD or Windows, the only way to install restic on your system right now is to compile it from source. restic is written in the Go programming language and you need at least Go version 1.3. See the [Getting started](https://golang.org/doc/install) guide of the Go project for instructions how to install Go. + +In order to build restic from source, execute the following steps: + +{% highlight console %} +$ git clone https://github.com/restic/restic +[...] + +$ cd restic + +$ go run build.go +[...] +{% endhighlight %} + +Usage help is available: + +{% highlight console %} +$ ./restic --help +Usage: + restic [OPTIONS] + +Application Options: + -r, --repo= Repository directory to backup to/restore from + +Help Options: + -h, --help Show this help message + +Available commands: + backup save file/directory + cache manage cache + cat dump something + find find a file/directory + fsck check the repository + init create repository + key manage keys + list lists data + ls list files + restore restore a snapshot + snapshots show snapshots + version display version +{% endhighlight %} + +Subcommand-specific help is there too: + +{% highlight console %} +$ ./restic backup --help +Usage: + restic [OPTIONS] backup DIR/FILE [DIR/FILE] [...] + +The backup command creates a snapshot of a file or directory + +Application Options: + -r, --repo= Repository directory to backup to/restore from + --cache-dir= Directory to use as a local cache + -q, --quiet Do not output comprehensive progress report (false) + --no-lock Do not lock the repo, this allows some operations on read-only repos. (false) + +Help Options: + -h, --help Show this help message + +[backup command options] + -p, --parent= use this parent snapshot (default: last snapshot in repo that has the same target) + -f, --force Force re-reading the target. Overrides the "parent" flag + -e, --exclude= Exclude a pattern (can be specified multiple times) +{% endhighlight %} + +## Initialize a repository + +First, we need to create a "repository". This is the place where your backups will be saved at. + +In order to create a repository at `/tmp/backup`, run the following command and enter the same password twice: + +{% highlight console %} +$ restic init --repo /tmp/backup +enter password for new backend: +enter password again: +created restic backend 085b3c76b9 at /tmp/backup +Please note that knowledge of your password is required to access the repository. +Losing your password means that your data is irrecoverably lost. +{% endhighlight %} + +Remembering your password is important! If you lose it, you won't be able to access data stored in the repository. + +Attention, at the moment restic only supports real Windows console interaction. If you use emulation environments like +[MSYS2](https://msys2.github.io/) or [Cygwin](https://www.cygwin.com/), which use terminals like Mintty, rxvt, +you'll get an password error: + +{% highlight console %} +$ restic -r /tmp/backup init +enter password for repository: unable to read password: Das Handle ist ungültig. +{% endhighlight %} + +You can workaround this by using a special tool called "winpty" (look [here](https://sourceforge.net/p/msys2/wiki/Porting/) +and [here](https://github.com/rprichard/winpty) for detail information). + +{% highlight console %} +# install winpty on MSYS2 +$ pacman -S winpty +$ winpty restic -r /tmp/backup init +{% endhighlight %} + +For automated backups, restic accepts the repository location in the environment variable `RESTIC_REPOSITORY` and also the password in the variable `RESTIC_PASSWORD`. + +## Create a snapshot + +Now we're ready to backup some data. The contents of a directory at a specific point in time is called a "snapshot" in restic. Run the following command and enter the repository password you chose above again: + +{% highlight console %} +$ restic -r /tmp/backup backup ~/work +enter password for repository: +scan [/home/user/work] +scanned 764 directories, 1816 files in 0:00 +[0:29] 100.00% 54.732 MiB/s 1.582 GiB / 1.582 GiB 2580 / 2580 items 0 errors ETA 0:00 +duration: 0:29, 54.47MiB/s +snapshot 40dc1520 saved +{% endhighlight %} + +As you can see, restic created a backup of the directory and was pretty fast! The specific snapshot just created is identified by a sequence of hexadecimal characters, `40dc1520` in this case. + +If you run the command again, restic will create another snapshot of your data, but this time it's even faster. This is deduplication at work! + +{% highlight console %} +$ restic -r /tmp/backup backup ~/shared/work/web +enter password for repository: +using parent snapshot 40dc1520aa6a07b7b3ae561786770a01951245d2367241e71e9485f18ae8228c +scan [/home/user/work] +scanned 764 directories, 1816 files in 0:00 +[0:00] 100.00% 0B/s 1.582 GiB / 1.582 GiB 2580 / 2580 items 0 errors ETA 0:00 +duration: 0:00, 6572.38MiB/s +snapshot 79766175 saved +{% endhighlight %} + +You can even backup individual files in the same repository. + +{% highlight console %} +$ restic -r /tmp/backup backup ~/work.txt +scan [/tmp/backup backup ~/work.txt] +scanned 0 directories, 1 files in 0:00 +[0:00] 100.00% 0B/s 220B / 220B 1 / 1 items 0 errors ETA 0:00 +duration: 0:00, 0.03MiB/s +snapshot 31f7bd63 saved +{% endhighlight %} + +In fact several hosts may use the same repository to backup directories and files leading to a greater deduplication. + +## List all snapshots + +Now, you can list all the snapshots stored in the repository: + +{% highlight console %} +$ restic -r /tmp/backup snapshots +enter password for repository: +ID Date Source Directory +---------------------------------------------------------------------- +40dc1520 2015-05-08 21:38:30 kasimir /home/user/work +79766175 2015-05-08 21:40:19 kasimir /home/user/work +{% endhighlight %} + +## Restore a snapshot + +Restoring a snapshot is as easy as it sounds, just use the following command to restore the contents of the latest snapshot to `/tmp/restore-work`: + +{% highlight console %} +$ restic -r /tmp/backup restore 79766175 --target ~/tmp/restore-work +enter password for repository: +restoring to /tmp/restore-work +{% endhighlight %} + +## Manage repository keys + +The `key` command allows you to set multiple access keys or passwords per repository. In fact, you can use the `list`, `add`, `remove` and `passwd` sub-commands to manage these keys very precisely: + +{% highlight console %} +$ restic -r /tmp/backup key list +enter password for repository: + ID User Host Created +---------------------------------------------------------------------- +*eb78040b username kasimir 2015-08-12 13:29:57 + +$ restic -r /tmp/backup key add +enter password for repository: +enter password for new key: +enter password again: +saved new key as + +$ restic -r backup key list +enter password for repository: + ID User Host Created +---------------------------------------------------------------------- + 5c657874 username kasimir 2015-08-12 13:35:05 +*eb78040b username kasimir 2015-08-12 13:29:57 +{% endhighlight %} + +## Check integrity and consistency + +Imagine your repository is saved on a server that has a faulty hard drive, or even worse, attackers get privileged access and modify your backup with the intention to make you restore malicious data: + +{% highlight console %} +$ sudo echo "boom" >> backup/index/d795ffa99a8ab8f8e42cec1f814df4e48b8f49129360fb57613df93739faee97 +{% endhighlight %} + +In order to detect these things, it is a good idea to regularly use the `check` command to test whether everything is alright, your precious backup data is consistent and the integrity is unharmed: + +{% highlight console %} +$ restic -r /tmp/backup check +Load indexes +ciphertext verification failed +{% endhighlight %} + +Trying to restore a snapshot which has been modified as shown above will yield the same error: + +{% highlight console %} +$ restic -r /tmp/backup restore 79766175 --target ~/tmp/restore-work +Load indexes +ciphertext verification failed +{% endhighlight %} + +## Mount a repository + +Browsing your backup as a regular file system is also very easy. First, create a mount point such as `/mnt/restic` and then use the following command to serve the repository with FUSE: + +{% highlight console %} +$ mkdir /mnt/restic +$ restic -r /tmp/backup mount /mnt/restic +enter password for repository: +Now serving /tmp/backup at /tmp/restic +Don't forget to umount after quitting! +{% endhighlight %} + +Windows doesn't support FUSE directly. Projects like [dokan](http://dokan-dev.github.io/) try to fill the gap. +We haven't tested it yet, but we'd like to hear about your experience. For setup information see +[dokan FUSE in dokan's wiki](https://github.com/dokan-dev/dokany/wiki/FUSE). + +## Create an SFTP repository + +In order to backup data via SFTP, you must first set up a server with SSH and let it know your public key. Passwordless login is really important since restic fails to connect to the repository if the server prompts for credentials. + +Once the server is configured, the setup of the SFTP repository can simply be achieved by changing the URL scheme in the `init` command: + +{% highlight console %} +$ restic -r sftp://user@host//tmp/backup init +enter password for new backend: +enter password again: +created restic backend f1c6108821 at sftp://user@host//tmp/backup +Please note that knowledge of your password is required to access the repository. +Losing your password means that your data is irrecoverably lost. +{% endhighlight %} + +Yes, that's really two slash (`/`) characters after the host name, here the directory `/tmp/backup` on the server is meant. If you'd rather like to create a repository in the user's home directory on the server, use the location `sftp://user@host/foo/bar/repo`. In this case the directory is relative to the user's home directory: `foo/bar/repo`. + + +## Create an Amazon S3 repository + +Restic can backup data to any Amazon S3 bucket. However, in this case, changing the URL scheme is not enough since Amazon uses special security credentials to sign HTTP requests. By consequence, you must first setup the following environment variables with the credentials you obtained while creating the bucket. + +{% highlight console %} +$ export AWS_ACCESS_KEY_ID= +$ export AWS_SECRET_ACCESS_KEY= +{% endhighlight %} + +You can then easily initialize a repository that uses your Amazon S3 as a backend. + +{% highlight console %} +$ restic -r s3://s3.amazonaws.com/bucket_name init +enter password for new backend: +enter password again: +created restic backend eefee03bbd at s3://s3.amazonaws.com/bucket_name +Please note that knowledge of your password is required to access the repository. +Losing your password means that your data is irrecoverably lost. +{% endhighlight %} + +For an S3-compatible repository without TLS available, use the alternative URI protocol `s3:http://server:port/bucket_name`. + +## Under the hood: Browse repository objects + +Internally, a repository stores data of several different types described in the [design documentation](https://github.com/restic/restic/blob/master/doc/Design.md). You can `list` objects such as blobs, packs, index, snapshots, keys or locks with the following command: + +{% highlight console %} +$ restic -r /tmp/backup list snapshots +d369ccc7d126594950bf74f0a348d5d98d9e99f3215082eb69bf02dc9b3e464c +{% endhighlight %} + +The `find` command searches for a given [pattern](http://golang.org/pkg/path/filepath/#Match) in the repository. + +``` +restic -r backup find test.txt +debug log file restic.log +debug enabled +enter password for repository: +found 1 matching entries in snapshot 196bc5760c909a7681647949e80e5448e276521489558525680acf1bd428af36 + -rw-r--r-- 501 20 5 2015-08-26 14:09:57 +0200 CEST path/to/test.txt +``` + +The `cat` command allows you to display the JSON representation of the objects or its raw content. + +{% highlight console %} +$ restic -r /tmp/backup cat snapshot d369ccc7d126594950bf74f0a348d5d98d9e99f3215082eb69bf02dc9b3e464c +enter password for repository: +{ + "time": "2015-08-12T12:52:44.091448856+02:00", + "tree": "05cec17e8d3349f402576d02576a2971fc0d9f9776ce2f441c7010849c4ff5af", + "paths": [ + "/home/user/work" + ], + "hostname": "kasimir", + "username": "username", + "uid": 501, + "gid": 20 +} +{% endhighlight %} + diff --git a/doc/index.md b/doc/index.md new file mode 100644 index 000000000..da37213ad --- /dev/null +++ b/doc/index.md @@ -0,0 +1,17 @@ +# Welcome to MkDocs + +For full documentation visit [mkdocs.org](http://mkdocs.org). + +## Commands + +* `mkdocs new [dir-name]` - Create a new project. +* `mkdocs serve` - Start the live-reloading docs server. +* `mkdocs build` - Build the documentation site. +* `mkdocs help` - Print this help message. + +## Project layout + + mkdocs.yml # The configuration file. + docs/ + index.md # The documentation homepage. + ... # Other markdown pages, images and other files. diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 000000000..7ff238920 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,7 @@ +site_name: Documentation for restic +theme: readthedocs +docs_dir: doc +pages: + - Getting Started: index.md + - User Manual: Manual.md + - restic Design Document: Design.md From 7c4bd662cbce1725c1978236b0707d0ebb346926 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 17 Feb 2016 16:31:07 +0100 Subject: [PATCH 2/9] Manual: Fix shell blocks and ToC --- doc/Manual.md | 132 ++++++++++++++++++++++---------------------------- 1 file changed, 57 insertions(+), 75 deletions(-) diff --git a/doc/Manual.md b/doc/Manual.md index 0acedf084..9ea8df413 100644 --- a/doc/Manual.md +++ b/doc/Manual.md @@ -1,35 +1,17 @@ ---- -layout: page -title: User Manual -permalink: /manual/ -sitenav: - - { anchor: "building-restic", title: "Building restic" } - - { anchor: "initialize-repository", title: "Initialize a repository" } - - { anchor: "create-snapshot", title: "Create a snapshot" } - - { anchor: "list-snapshots", title: "List all snapshots" } - - { anchor: "restore-snapshot", title: "Restore a snapshot" } - - { anchor: "manage-repository-keys", title: "Manage repository keys" } - - { anchor: "check-integrity-consistency", title: "Check the repository" } - - { anchor: "mount-repository", title: "Mount a repository" } - - { anchor: "sftp-repository", title: "SFTP repository" } - - { anchor: "s3-repository", title: "S3 repository" } - - { anchor: "browse-repository-objects", title: "Under the hood: Browse repository objects" } ---- - -## Building restic +## Building restic If you are using Mac OS X, you can install restic using the [homebrew](http://brew.sh/) packet manager: -{% highlight console %} -brew tap restic/restic -brew install restic -{% endhighlight %} +```shell +$ brew tap restic/restic +$ brew install restic +``` If you are using Linux, BSD or Windows, the only way to install restic on your system right now is to compile it from source. restic is written in the Go programming language and you need at least Go version 1.3. See the [Getting started](https://golang.org/doc/install) guide of the Go project for instructions how to install Go. In order to build restic from source, execute the following steps: -{% highlight console %} +```shell $ git clone https://github.com/restic/restic [...] @@ -37,11 +19,11 @@ $ cd restic $ go run build.go [...] -{% endhighlight %} +``` Usage help is available: -{% highlight console %} +```shell $ ./restic --help Usage: restic [OPTIONS] @@ -65,11 +47,11 @@ Available commands: restore restore a snapshot snapshots show snapshots version display version -{% endhighlight %} +``` Subcommand-specific help is there too: -{% highlight console %} +```shell $ ./restic backup --help Usage: restic [OPTIONS] backup DIR/FILE [DIR/FILE] [...] @@ -89,22 +71,22 @@ Help Options: -p, --parent= use this parent snapshot (default: last snapshot in repo that has the same target) -f, --force Force re-reading the target. Overrides the "parent" flag -e, --exclude= Exclude a pattern (can be specified multiple times) -{% endhighlight %} +``` -## Initialize a repository +## Initialize a repository First, we need to create a "repository". This is the place where your backups will be saved at. In order to create a repository at `/tmp/backup`, run the following command and enter the same password twice: -{% highlight console %} +```shell $ restic init --repo /tmp/backup enter password for new backend: enter password again: created restic backend 085b3c76b9 at /tmp/backup Please note that knowledge of your password is required to access the repository. Losing your password means that your data is irrecoverably lost. -{% endhighlight %} +``` Remembering your password is important! If you lose it, you won't be able to access data stored in the repository. @@ -112,27 +94,27 @@ Attention, at the moment restic only supports real Windows console interaction. [MSYS2](https://msys2.github.io/) or [Cygwin](https://www.cygwin.com/), which use terminals like Mintty, rxvt, you'll get an password error: -{% highlight console %} +```shell $ restic -r /tmp/backup init enter password for repository: unable to read password: Das Handle ist ungültig. -{% endhighlight %} +``` You can workaround this by using a special tool called "winpty" (look [here](https://sourceforge.net/p/msys2/wiki/Porting/) and [here](https://github.com/rprichard/winpty) for detail information). -{% highlight console %} +```shell # install winpty on MSYS2 $ pacman -S winpty $ winpty restic -r /tmp/backup init -{% endhighlight %} +``` For automated backups, restic accepts the repository location in the environment variable `RESTIC_REPOSITORY` and also the password in the variable `RESTIC_PASSWORD`. -## Create a snapshot +## Create a snapshot Now we're ready to backup some data. The contents of a directory at a specific point in time is called a "snapshot" in restic. Run the following command and enter the repository password you chose above again: -{% highlight console %} +```shell $ restic -r /tmp/backup backup ~/work enter password for repository: scan [/home/user/work] @@ -140,13 +122,13 @@ scanned 764 directories, 1816 files in 0:00 [0:29] 100.00% 54.732 MiB/s 1.582 GiB / 1.582 GiB 2580 / 2580 items 0 errors ETA 0:00 duration: 0:29, 54.47MiB/s snapshot 40dc1520 saved -{% endhighlight %} +``` As you can see, restic created a backup of the directory and was pretty fast! The specific snapshot just created is identified by a sequence of hexadecimal characters, `40dc1520` in this case. If you run the command again, restic will create another snapshot of your data, but this time it's even faster. This is deduplication at work! -{% highlight console %} +```shell $ restic -r /tmp/backup backup ~/shared/work/web enter password for repository: using parent snapshot 40dc1520aa6a07b7b3ae561786770a01951245d2367241e71e9485f18ae8228c @@ -155,49 +137,49 @@ scanned 764 directories, 1816 files in 0:00 [0:00] 100.00% 0B/s 1.582 GiB / 1.582 GiB 2580 / 2580 items 0 errors ETA 0:00 duration: 0:00, 6572.38MiB/s snapshot 79766175 saved -{% endhighlight %} +``` You can even backup individual files in the same repository. -{% highlight console %} +```shell $ restic -r /tmp/backup backup ~/work.txt scan [/tmp/backup backup ~/work.txt] scanned 0 directories, 1 files in 0:00 [0:00] 100.00% 0B/s 220B / 220B 1 / 1 items 0 errors ETA 0:00 duration: 0:00, 0.03MiB/s snapshot 31f7bd63 saved -{% endhighlight %} +``` In fact several hosts may use the same repository to backup directories and files leading to a greater deduplication. -## List all snapshots +## List all snapshots Now, you can list all the snapshots stored in the repository: -{% highlight console %} +```shell $ restic -r /tmp/backup snapshots enter password for repository: ID Date Source Directory ---------------------------------------------------------------------- 40dc1520 2015-05-08 21:38:30 kasimir /home/user/work 79766175 2015-05-08 21:40:19 kasimir /home/user/work -{% endhighlight %} +``` -## Restore a snapshot +## Restore a snapshot Restoring a snapshot is as easy as it sounds, just use the following command to restore the contents of the latest snapshot to `/tmp/restore-work`: -{% highlight console %} +```shell $ restic -r /tmp/backup restore 79766175 --target ~/tmp/restore-work enter password for repository: restoring to /tmp/restore-work -{% endhighlight %} +``` -## Manage repository keys +## Manage repository keys The `key` command allows you to set multiple access keys or passwords per repository. In fact, you can use the `list`, `add`, `remove` and `passwd` sub-commands to manage these keys very precisely: -{% highlight console %} +```shell $ restic -r /tmp/backup key list enter password for repository: ID User Host Created @@ -216,96 +198,96 @@ enter password for repository: ---------------------------------------------------------------------- 5c657874 username kasimir 2015-08-12 13:35:05 *eb78040b username kasimir 2015-08-12 13:29:57 -{% endhighlight %} +``` -## Check integrity and consistency +## Check integrity and consistency Imagine your repository is saved on a server that has a faulty hard drive, or even worse, attackers get privileged access and modify your backup with the intention to make you restore malicious data: -{% highlight console %} +```shell $ sudo echo "boom" >> backup/index/d795ffa99a8ab8f8e42cec1f814df4e48b8f49129360fb57613df93739faee97 -{% endhighlight %} +``` In order to detect these things, it is a good idea to regularly use the `check` command to test whether everything is alright, your precious backup data is consistent and the integrity is unharmed: -{% highlight console %} +```shell $ restic -r /tmp/backup check Load indexes ciphertext verification failed -{% endhighlight %} +``` Trying to restore a snapshot which has been modified as shown above will yield the same error: -{% highlight console %} +```shell $ restic -r /tmp/backup restore 79766175 --target ~/tmp/restore-work Load indexes ciphertext verification failed -{% endhighlight %} +``` -## Mount a repository +## Mount a repository Browsing your backup as a regular file system is also very easy. First, create a mount point such as `/mnt/restic` and then use the following command to serve the repository with FUSE: -{% highlight console %} +```shell $ mkdir /mnt/restic $ restic -r /tmp/backup mount /mnt/restic enter password for repository: Now serving /tmp/backup at /tmp/restic Don't forget to umount after quitting! -{% endhighlight %} +``` Windows doesn't support FUSE directly. Projects like [dokan](http://dokan-dev.github.io/) try to fill the gap. We haven't tested it yet, but we'd like to hear about your experience. For setup information see [dokan FUSE in dokan's wiki](https://github.com/dokan-dev/dokany/wiki/FUSE). -## Create an SFTP repository +## Create an SFTP repository In order to backup data via SFTP, you must first set up a server with SSH and let it know your public key. Passwordless login is really important since restic fails to connect to the repository if the server prompts for credentials. Once the server is configured, the setup of the SFTP repository can simply be achieved by changing the URL scheme in the `init` command: -{% highlight console %} +```shell $ restic -r sftp://user@host//tmp/backup init enter password for new backend: enter password again: created restic backend f1c6108821 at sftp://user@host//tmp/backup Please note that knowledge of your password is required to access the repository. Losing your password means that your data is irrecoverably lost. -{% endhighlight %} +``` Yes, that's really two slash (`/`) characters after the host name, here the directory `/tmp/backup` on the server is meant. If you'd rather like to create a repository in the user's home directory on the server, use the location `sftp://user@host/foo/bar/repo`. In this case the directory is relative to the user's home directory: `foo/bar/repo`. -## Create an Amazon S3 repository +## Create an Amazon S3 repository Restic can backup data to any Amazon S3 bucket. However, in this case, changing the URL scheme is not enough since Amazon uses special security credentials to sign HTTP requests. By consequence, you must first setup the following environment variables with the credentials you obtained while creating the bucket. -{% highlight console %} +```shell $ export AWS_ACCESS_KEY_ID= $ export AWS_SECRET_ACCESS_KEY= -{% endhighlight %} +``` You can then easily initialize a repository that uses your Amazon S3 as a backend. -{% highlight console %} +```shell $ restic -r s3://s3.amazonaws.com/bucket_name init enter password for new backend: enter password again: created restic backend eefee03bbd at s3://s3.amazonaws.com/bucket_name Please note that knowledge of your password is required to access the repository. Losing your password means that your data is irrecoverably lost. -{% endhighlight %} +``` For an S3-compatible repository without TLS available, use the alternative URI protocol `s3:http://server:port/bucket_name`. -## Under the hood: Browse repository objects +## Under the hood: Browse repository objects Internally, a repository stores data of several different types described in the [design documentation](https://github.com/restic/restic/blob/master/doc/Design.md). You can `list` objects such as blobs, packs, index, snapshots, keys or locks with the following command: -{% highlight console %} +```shell $ restic -r /tmp/backup list snapshots d369ccc7d126594950bf74f0a348d5d98d9e99f3215082eb69bf02dc9b3e464c -{% endhighlight %} +``` The `find` command searches for a given [pattern](http://golang.org/pkg/path/filepath/#Match) in the repository. @@ -320,7 +302,7 @@ found 1 matching entries in snapshot 196bc5760c909a7681647949e80e5448e2765214895 The `cat` command allows you to display the JSON representation of the objects or its raw content. -{% highlight console %} +```shell $ restic -r /tmp/backup cat snapshot d369ccc7d126594950bf74f0a348d5d98d9e99f3215082eb69bf02dc9b3e464c enter password for repository: { @@ -334,5 +316,5 @@ enter password for repository: "uid": 501, "gid": 20 } -{% endhighlight %} +``` From e71e2c74f80c38823ae762e8f6b70c241a8f0b04 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 17 Feb 2016 16:45:36 +0100 Subject: [PATCH 3/9] README: Add readthedocs badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 014afa9ec..e1d20cb2c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Documentation](https://readthedocs.org/projects/restic/badge/?version=latest)](https://restic.readthedocs.org/en/latest/?badge=latest) [![Build Status](https://travis-ci.org/restic/restic.svg?branch=master)](https://travis-ci.org/restic/restic) [![Build status](https://ci.appveyor.com/api/projects/status/nuy4lfbgfbytw92q/branch/master?svg=true)](https://ci.appveyor.com/project/fd0/restic/branch/master) [![Report Card](http://goreportcard.com/badge/restic/restic)](http://goreportcard.com/report/restic/restic) From a13f9f14d00c0bda33f8af7ccb428358a71791f8 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 17 Feb 2016 16:52:09 +0100 Subject: [PATCH 4/9] Add something to the front page --- doc/index.md | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/doc/index.md b/doc/index.md index da37213ad..119f6750d 100644 --- a/doc/index.md +++ b/doc/index.md @@ -1,17 +1,4 @@ -# Welcome to MkDocs +Welcome to restic +================= -For full documentation visit [mkdocs.org](http://mkdocs.org). - -## Commands - -* `mkdocs new [dir-name]` - Create a new project. -* `mkdocs serve` - Start the live-reloading docs server. -* `mkdocs build` - Build the documentation site. -* `mkdocs help` - Print this help message. - -## Project layout - - mkdocs.yml # The configuration file. - docs/ - index.md # The documentation homepage. - ... # Other markdown pages, images and other files. +restic is backup program that is verify fast, secure and efficient. From dc994699d9c83ccd001cf5dd52e826426d0838cb Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 21 Feb 2016 12:29:13 +0100 Subject: [PATCH 5/9] Remove obsolete structure image --- doc/structure.svg | 884 ---------------------------------------------- 1 file changed, 884 deletions(-) delete mode 100644 doc/structure.svg diff --git a/doc/structure.svg b/doc/structure.svg deleted file mode 100644 index a5181f02d..000000000 --- a/doc/structure.svg +++ /dev/null @@ -1,884 +0,0 @@ - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - data/ - keys/ - snapshots/ - trees/ - maps/ - - 6e4065 - - b35a97 - - 1bde93 - 1b/ - - 47808f - 47/ - - 47853a - - 967de5 - 9f/ - - a0c69f - a0/ - - beb505 - be/ - - - - - - - - - - - - - tmp/ - locks/ - - - - version - - - c913e0 - - - {time: 2015-01-01T13:12:13.40, dir: /data, hostname: kasimir, username: hans, tree: {id: 486f6c, sid: 967de5}, [...]} - - - snapshot - 6e4065 - - - - - - - tree - 486f6c - { nodes: [ { name: testdir1, type: dir, mode: 0755, user: hans, subtree: a8838f} },{ name: testfile, type: file, mode: 0640, user: hans, content: [50f77b, ea0cc4, [...]] }], map:[ { id: 50f77b, sid: 1bde93 },{ id: a8838f, sid: a0c69f },{ id: ea0cc4, sid: 47853a }, [...]]} - - - - - From 1c2992e2e532f22b0672b17ee3d5d63bd3259b19 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 21 Feb 2016 12:51:52 +0100 Subject: [PATCH 6/9] Update manual --- doc/Manual.md | 444 +++++++++++++++++++++++++------------------------- doc/index.md | 7 +- 2 files changed, 230 insertions(+), 221 deletions(-) diff --git a/doc/Manual.md b/doc/Manual.md index 9ea8df413..f09bb6ea9 100644 --- a/doc/Manual.md +++ b/doc/Manual.md @@ -1,284 +1,291 @@ +# User Manual + +Thanks for using restic. This document will give you an overview of the basic +functionality provided by restic. + ## Building restic -If you are using Mac OS X, you can install restic using the [homebrew](http://brew.sh/) packet manager: +If you are using Mac OS X, you can install restic using the +[homebrew](http://brew.sh/) packet manager: -```shell -$ brew tap restic/restic -$ brew install restic -``` + $ brew tap restic/restic + $ brew install restic -If you are using Linux, BSD or Windows, the only way to install restic on your system right now is to compile it from source. restic is written in the Go programming language and you need at least Go version 1.3. See the [Getting started](https://golang.org/doc/install) guide of the Go project for instructions how to install Go. +On archlinux, there is a package called `restic-git` which can be installed from AUR, e.g. with `pacaur`: + + $ pacaur -S restic-git + +If you are using Linux, BSD or Windows, the only way to install restic on your +system right now is to compile it from source. restic is written in the Go +programming language and you need at least Go version 1.3. See the [Getting +started](https://golang.org/doc/install) guide of the Go project for +instructions how to install Go. In order to build restic from source, execute the following steps: -```shell -$ git clone https://github.com/restic/restic -[...] + $ git clone https://github.com/restic/restic + [...] -$ cd restic + $ cd restic -$ go run build.go -[...] -``` + $ go run build.go Usage help is available: -```shell -$ ./restic --help -Usage: - restic [OPTIONS] + $ ./restic --help + Usage: + restic [OPTIONS] -Application Options: - -r, --repo= Repository directory to backup to/restore from + Application Options: + -r, --repo= Repository directory to backup to/restore from -Help Options: - -h, --help Show this help message + Help Options: + -h, --help Show this help message -Available commands: - backup save file/directory - cache manage cache - cat dump something - find find a file/directory - fsck check the repository - init create repository - key manage keys - list lists data - ls list files - restore restore a snapshot - snapshots show snapshots - version display version -``` + Available commands: + backup save file/directory + cache manage cache + cat dump something + find find a file/directory + fsck check the repository + init create repository + key manage keys + list lists data + ls list files + restore restore a snapshot + snapshots show snapshots + version display version -Subcommand-specific help is there too: +Similar to programs such as `git`, 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 `backup` command: -```shell -$ ./restic backup --help -Usage: - restic [OPTIONS] backup DIR/FILE [DIR/FILE] [...] + $ ./restic backup --help + Usage: + restic [OPTIONS] backup DIR/FILE [DIR/FILE] [...] -The backup command creates a snapshot of a file or directory + The backup command creates a snapshot of a file or directory -Application Options: - -r, --repo= Repository directory to backup to/restore from - --cache-dir= Directory to use as a local cache - -q, --quiet Do not output comprehensive progress report (false) - --no-lock Do not lock the repo, this allows some operations on read-only repos. (false) + Application Options: + -r, --repo= Repository directory to backup to/restore from + --cache-dir= Directory to use as a local cache + -q, --quiet Do not output comprehensive progress report (false) + --no-lock Do not lock the repo, this allows some operations on read-only repos. (false) -Help Options: - -h, --help Show this help message + Help Options: + -h, --help Show this help message -[backup command options] - -p, --parent= use this parent snapshot (default: last snapshot in repo that has the same target) - -f, --force Force re-reading the target. Overrides the "parent" flag - -e, --exclude= Exclude a pattern (can be specified multiple times) -``` + [backup command options] + -p, --parent= use this parent snapshot (default: last snapshot in repo that has the same target) + -f, --force Force re-reading the target. Overrides the "parent" flag + -e, --exclude= Exclude a pattern (can be specified multiple times) ## Initialize a repository -First, we need to create a "repository". This is the place where your backups will be saved at. +First, we need to create a "repository". This is the place where your backups +will be saved at. -In order to create a repository at `/tmp/backup`, run the following command and enter the same password twice: +In order to create a repository at `/tmp/backup`, run the following command and +enter the same password twice: -```shell -$ restic init --repo /tmp/backup -enter password for new backend: -enter password again: -created restic backend 085b3c76b9 at /tmp/backup -Please note that knowledge of your password is required to access the repository. -Losing your password means that your data is irrecoverably lost. -``` + $ restic init --repo /tmp/backup + enter password for new backend: + enter password again: + created restic backend 085b3c76b9 at /tmp/backup + Please note that knowledge of your password is required to access the repository. + Losing your password means that your data is irrecoverably lost. -Remembering your password is important! If you lose it, you won't be able to access data stored in the repository. +Remembering your password is important! If you lose it, you won't be able to +access data stored in the repository. -Attention, at the moment restic only supports real Windows console interaction. If you use emulation environments like -[MSYS2](https://msys2.github.io/) or [Cygwin](https://www.cygwin.com/), which use terminals like Mintty, rxvt, -you'll get an password error: +For automated backups, restic accepts the repository location in the +environment variable `RESTIC_REPOSITORY` and also the password in the variable +`RESTIC_PASSWORD`. -```shell -$ restic -r /tmp/backup init -enter password for repository: unable to read password: Das Handle ist ungültig. -``` +### Password prompt on Windows -You can workaround this by using a special tool called "winpty" (look [here](https://sourceforge.net/p/msys2/wiki/Porting/) -and [here](https://github.com/rprichard/winpty) for detail information). +At the moment, restic only supports the default Windows console interaction. +If you use emulation environments like [MSYS2](https://msys2.github.io/) or +[Cygwin](https://www.cygwin.com/), which use terminals like `Mintty` or `rxvt`, +you may get a password error: -```shell -# install winpty on MSYS2 -$ pacman -S winpty -$ winpty restic -r /tmp/backup init -``` +You can workaround this by using a special tool called `winpty` (look +[here](https://sourceforge.net/p/msys2/wiki/Porting/) and +[here](https://github.com/rprichard/winpty) for detail information). On MSYS2, +you can install `winpty` as follows: -For automated backups, restic accepts the repository location in the environment variable `RESTIC_REPOSITORY` and also the password in the variable `RESTIC_PASSWORD`. + $ pacman -S winpty + $ winpty restic -r /tmp/backup init ## Create a snapshot -Now we're ready to backup some data. The contents of a directory at a specific point in time is called a "snapshot" in restic. Run the following command and enter the repository password you chose above again: +Now we're ready to backup some data. The contents of a directory at a specific +point in time is called a "snapshot" in restic. Run the following command and +enter the repository password you chose above again: -```shell -$ restic -r /tmp/backup backup ~/work -enter password for repository: -scan [/home/user/work] -scanned 764 directories, 1816 files in 0:00 -[0:29] 100.00% 54.732 MiB/s 1.582 GiB / 1.582 GiB 2580 / 2580 items 0 errors ETA 0:00 -duration: 0:29, 54.47MiB/s -snapshot 40dc1520 saved -``` + $ restic -r /tmp/backup backup ~/work + enter password for repository: + scan [/home/user/work] + scanned 764 directories, 1816 files in 0:00 + [0:29] 100.00% 54.732 MiB/s 1.582 GiB / 1.582 GiB 2580 / 2580 items 0 errors ETA 0:00 + duration: 0:29, 54.47MiB/s + snapshot 40dc1520 saved -As you can see, restic created a backup of the directory and was pretty fast! The specific snapshot just created is identified by a sequence of hexadecimal characters, `40dc1520` in this case. +As you can see, restic created a backup of the directory and was pretty fast! +The specific snapshot just created is identified by a sequence of hexadecimal +characters, `40dc1520` in this case. -If you run the command again, restic will create another snapshot of your data, but this time it's even faster. This is deduplication at work! +If you run the command again, restic will create another snapshot of your data, +but this time it's even faster. This is de-duplication at work! -```shell -$ restic -r /tmp/backup backup ~/shared/work/web -enter password for repository: -using parent snapshot 40dc1520aa6a07b7b3ae561786770a01951245d2367241e71e9485f18ae8228c -scan [/home/user/work] -scanned 764 directories, 1816 files in 0:00 -[0:00] 100.00% 0B/s 1.582 GiB / 1.582 GiB 2580 / 2580 items 0 errors ETA 0:00 -duration: 0:00, 6572.38MiB/s -snapshot 79766175 saved -``` + $ restic -r /tmp/backup backup ~/shared/work/web + enter password for repository: + using parent snapshot 40dc1520aa6a07b7b3ae561786770a01951245d2367241e71e9485f18ae8228c + scan [/home/user/work] + scanned 764 directories, 1816 files in 0:00 + [0:00] 100.00% 0B/s 1.582 GiB / 1.582 GiB 2580 / 2580 items 0 errors ETA 0:00 + duration: 0:00, 6572.38MiB/s + snapshot 79766175 saved You can even backup individual files in the same repository. -```shell -$ restic -r /tmp/backup backup ~/work.txt -scan [/tmp/backup backup ~/work.txt] -scanned 0 directories, 1 files in 0:00 -[0:00] 100.00% 0B/s 220B / 220B 1 / 1 items 0 errors ETA 0:00 -duration: 0:00, 0.03MiB/s -snapshot 31f7bd63 saved -``` + $ restic -r /tmp/backup backup ~/work.txt + scan [~/work.txt] + scanned 0 directories, 1 files in 0:00 + [0:00] 100.00% 0B/s 220B / 220B 1 / 1 items 0 errors ETA 0:00 + duration: 0:00, 0.03MiB/s + snapshot 31f7bd63 saved -In fact several hosts may use the same repository to backup directories and files leading to a greater deduplication. +In fact several hosts may use the same repository to backup directories and +files leading to a greater de-duplication. ## List all snapshots Now, you can list all the snapshots stored in the repository: -```shell -$ restic -r /tmp/backup snapshots -enter password for repository: -ID Date Source Directory ----------------------------------------------------------------------- -40dc1520 2015-05-08 21:38:30 kasimir /home/user/work -79766175 2015-05-08 21:40:19 kasimir /home/user/work -``` + $ restic -r /tmp/backup snapshots + enter password for repository: + ID Date Source Directory + ---------------------------------------------------------------------- + 40dc1520 2015-05-08 21:38:30 kasimir /home/user/work + 79766175 2015-05-08 21:40:19 kasimir /home/user/work ## Restore a snapshot -Restoring a snapshot is as easy as it sounds, just use the following command to restore the contents of the latest snapshot to `/tmp/restore-work`: +Restoring a snapshot is as easy as it sounds, just use the following command to +restore the contents of the latest snapshot to `/tmp/restore-work`: -```shell -$ restic -r /tmp/backup restore 79766175 --target ~/tmp/restore-work -enter password for repository: -restoring to /tmp/restore-work -``` + $ restic -r /tmp/backup restore 79766175 --target ~/tmp/restore-work + enter password for repository: + restoring to /tmp/restore-work ## Manage repository keys -The `key` command allows you to set multiple access keys or passwords per repository. In fact, you can use the `list`, `add`, `remove` and `passwd` sub-commands to manage these keys very precisely: +The `key` command allows you to set multiple access keys or passwords per +repository. In fact, you can use the `list`, `add`, `remove` and `passwd` +sub-commands to manage these keys very precisely: -```shell -$ restic -r /tmp/backup key list -enter password for repository: - ID User Host Created ----------------------------------------------------------------------- -*eb78040b username kasimir 2015-08-12 13:29:57 + $ restic -r /tmp/backup key list + enter password for repository: + ID User Host Created + ---------------------------------------------------------------------- + *eb78040b username kasimir 2015-08-12 13:29:57 -$ restic -r /tmp/backup key add -enter password for repository: -enter password for new key: -enter password again: -saved new key as + $ restic -r /tmp/backup key add + enter password for repository: + enter password for new key: + enter password again: + saved new key as -$ restic -r backup key list -enter password for repository: - ID User Host Created ----------------------------------------------------------------------- - 5c657874 username kasimir 2015-08-12 13:35:05 -*eb78040b username kasimir 2015-08-12 13:29:57 -``` + $ restic -r backup key list + enter password for repository: + ID User Host Created + ---------------------------------------------------------------------- + 5c657874 username kasimir 2015-08-12 13:35:05 + *eb78040b username kasimir 2015-08-12 13:29:57 ## Check integrity and consistency -Imagine your repository is saved on a server that has a faulty hard drive, or even worse, attackers get privileged access and modify your backup with the intention to make you restore malicious data: +Imagine your repository is saved on a server that has a faulty hard drive, or +even worse, attackers get privileged access and modify your backup with the +intention to make you restore malicious data: -```shell -$ sudo echo "boom" >> backup/index/d795ffa99a8ab8f8e42cec1f814df4e48b8f49129360fb57613df93739faee97 -``` + $ sudo echo "boom" >> backup/index/d795ffa99a8ab8f8e42cec1f814df4e48b8f49129360fb57613df93739faee97 -In order to detect these things, it is a good idea to regularly use the `check` command to test whether everything is alright, your precious backup data is consistent and the integrity is unharmed: +In order to detect these things, it is a good idea to regularly use the `check` +command to test whether everything is alright, your precious backup data is +consistent and the integrity is unharmed: -```shell -$ restic -r /tmp/backup check -Load indexes -ciphertext verification failed -``` + $ restic -r /tmp/backup check + Load indexes + ciphertext verification failed -Trying to restore a snapshot which has been modified as shown above will yield the same error: +Trying to restore a snapshot which has been modified as shown above will yield +the same error: -```shell -$ restic -r /tmp/backup restore 79766175 --target ~/tmp/restore-work -Load indexes -ciphertext verification failed -``` + $ restic -r /tmp/backup restore 79766175 --target ~/tmp/restore-work + Load indexes + ciphertext verification failed ## Mount a repository -Browsing your backup as a regular file system is also very easy. First, create a mount point such as `/mnt/restic` and then use the following command to serve the repository with FUSE: +Browsing your backup as a regular file system is also very easy. First, create +a mount point such as `/mnt/restic` and then use the following command to serve +the repository with FUSE: -```shell -$ mkdir /mnt/restic -$ restic -r /tmp/backup mount /mnt/restic -enter password for repository: -Now serving /tmp/backup at /tmp/restic -Don't forget to umount after quitting! -``` + $ mkdir /mnt/restic + $ restic -r /tmp/backup mount /mnt/restic + enter password for repository: + Now serving /tmp/backup at /tmp/restic + Don't forget to umount after quitting! -Windows doesn't support FUSE directly. Projects like [dokan](http://dokan-dev.github.io/) try to fill the gap. -We haven't tested it yet, but we'd like to hear about your experience. For setup information see +Windows doesn't support FUSE directly. Projects like +[dokan](http://dokan-dev.github.io/) try to fill the gap. We haven't tested it +yet, but we'd like to hear about your experience. For setup information see [dokan FUSE in dokan's wiki](https://github.com/dokan-dev/dokany/wiki/FUSE). ## Create an SFTP repository -In order to backup data via SFTP, you must first set up a server with SSH and let it know your public key. Passwordless login is really important since restic fails to connect to the repository if the server prompts for credentials. +In order to backup data via SFTP, you must first set up a server with SSH and +let it know your public key. Passwordless login is really important since +restic fails to connect to the repository if the server prompts for +credentials. -Once the server is configured, the setup of the SFTP repository can simply be achieved by changing the URL scheme in the `init` command: +Once the server is configured, the setup of the SFTP repository can simply be +achieved by changing the URL scheme in the `init` command: -```shell -$ restic -r sftp://user@host//tmp/backup init -enter password for new backend: -enter password again: -created restic backend f1c6108821 at sftp://user@host//tmp/backup -Please note that knowledge of your password is required to access the repository. -Losing your password means that your data is irrecoverably lost. -``` - -Yes, that's really two slash (`/`) characters after the host name, here the directory `/tmp/backup` on the server is meant. If you'd rather like to create a repository in the user's home directory on the server, use the location `sftp://user@host/foo/bar/repo`. In this case the directory is relative to the user's home directory: `foo/bar/repo`. + $ restic -r sftp://user@host//tmp/backup init + enter password for new backend: + enter password again: + created restic backend f1c6108821 at sftp://user@host//tmp/backup + Please note that knowledge of your password is required to access the repository. + Losing your password means that your data is irrecoverably lost. +Yes, that's really two slash (`/`) characters after the host name, here the +directory `/tmp/backup` on the server is meant. If you'd rather like to create +a repository in the user's home directory on the server, use the location +`sftp://user@host/foo/bar/repo`. In this case the directory is relative to the +user's home directory: `foo/bar/repo`. ## Create an Amazon S3 repository Restic can backup data to any Amazon S3 bucket. However, in this case, changing the URL scheme is not enough since Amazon uses special security credentials to sign HTTP requests. By consequence, you must first setup the following environment variables with the credentials you obtained while creating the bucket. -```shell -$ export AWS_ACCESS_KEY_ID= -$ export AWS_SECRET_ACCESS_KEY= -``` + $ export AWS_ACCESS_KEY_ID= + $ export AWS_SECRET_ACCESS_KEY= You can then easily initialize a repository that uses your Amazon S3 as a backend. -```shell -$ restic -r s3://s3.amazonaws.com/bucket_name init -enter password for new backend: -enter password again: -created restic backend eefee03bbd at s3://s3.amazonaws.com/bucket_name -Please note that knowledge of your password is required to access the repository. -Losing your password means that your data is irrecoverably lost. -``` + $ restic -r s3://s3.amazonaws.com/bucket_name init + enter password for new backend: + enter password again: + created restic backend eefee03bbd at s3://s3.amazonaws.com/bucket_name + Please note that knowledge of your password is required to access the repository. + Losing your password means that your data is irrecoverably lost. -For an S3-compatible repository without TLS available, use the alternative URI protocol `s3:http://server:port/bucket_name`. +For an S3-compatible repository without TLS available, use the alternative URI +protocol `s3:http://server:port/bucket_name`. ## Under the hood: Browse repository objects @@ -289,32 +296,29 @@ $ restic -r /tmp/backup list snapshots d369ccc7d126594950bf74f0a348d5d98d9e99f3215082eb69bf02dc9b3e464c ``` -The `find` command searches for a given [pattern](http://golang.org/pkg/path/filepath/#Match) in the repository. +The `find` command searches for a given +[pattern](http://golang.org/pkg/path/filepath/#Match) in the repository. -``` -restic -r backup find test.txt -debug log file restic.log -debug enabled -enter password for repository: -found 1 matching entries in snapshot 196bc5760c909a7681647949e80e5448e276521489558525680acf1bd428af36 - -rw-r--r-- 501 20 5 2015-08-26 14:09:57 +0200 CEST path/to/test.txt -``` + $ restic -r backup find test.txt + debug log file restic.log + debug enabled + enter password for repository: + found 1 matching entries in snapshot 196bc5760c909a7681647949e80e5448e276521489558525680acf1bd428af36 + -rw-r--r-- 501 20 5 2015-08-26 14:09:57 +0200 CEST path/to/test.txt -The `cat` command allows you to display the JSON representation of the objects or its raw content. - -```shell -$ restic -r /tmp/backup cat snapshot d369ccc7d126594950bf74f0a348d5d98d9e99f3215082eb69bf02dc9b3e464c -enter password for repository: -{ - "time": "2015-08-12T12:52:44.091448856+02:00", - "tree": "05cec17e8d3349f402576d02576a2971fc0d9f9776ce2f441c7010849c4ff5af", - "paths": [ - "/home/user/work" - ], - "hostname": "kasimir", - "username": "username", - "uid": 501, - "gid": 20 -} -``` +The `cat` command allows you to display the JSON representation of the objects +or its raw content. + $ restic -r /tmp/backup cat snapshot d369ccc7d126594950bf74f0a348d5d98d9e99f3215082eb69bf02dc9b3e464c + enter password for repository: + { + "time": "2015-08-12T12:52:44.091448856+02:00", + "tree": "05cec17e8d3349f402576d02576a2971fc0d9f9776ce2f441c7010849c4ff5af", + "paths": [ + "/home/user/work" + ], + "hostname": "kasimir", + "username": "username", + "uid": 501, + "gid": 20 + } diff --git a/doc/index.md b/doc/index.md index 119f6750d..70d3dfa68 100644 --- a/doc/index.md +++ b/doc/index.md @@ -1,4 +1,9 @@ Welcome to restic ================= -restic is backup program that is verify fast, secure and efficient. +![restic logo](logo/logo.svg) + +restic is a backup program that is fast, efficient and secure. On the left you +can find an overview of the documentation. The project's homepage is +, the source code repository can be found on GitHub +at the URL . From 7de8bf6c271707b6a3563144ead8d42394ea4494 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 21 Feb 2016 12:56:25 +0100 Subject: [PATCH 7/9] Manual: Correct headings, add section about debug --- doc/Manual.md | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/doc/Manual.md b/doc/Manual.md index f09bb6ea9..361a12de1 100644 --- a/doc/Manual.md +++ b/doc/Manual.md @@ -1,9 +1,7 @@ -# User Manual - Thanks for using restic. This document will give you an overview of the basic functionality provided by restic. -## Building restic +# Building/installing restic If you are using Mac OS X, you can install restic using the [homebrew](http://brew.sh/) packet manager: @@ -81,7 +79,7 @@ them, e.g. for the `backup` command: -f, --force Force re-reading the target. Overrides the "parent" flag -e, --exclude= Exclude a pattern (can be specified multiple times) -## Initialize a repository +# Initialize a repository First, we need to create a "repository". This is the place where your backups will be saved at. @@ -103,7 +101,7 @@ For automated backups, restic accepts the repository location in the environment variable `RESTIC_REPOSITORY` and also the password in the variable `RESTIC_PASSWORD`. -### Password prompt on Windows +## Password prompt on Windows At the moment, restic only supports the default Windows console interaction. If you use emulation environments like [MSYS2](https://msys2.github.io/) or @@ -118,7 +116,7 @@ you can install `winpty` as follows: $ pacman -S winpty $ winpty restic -r /tmp/backup init -## Create a snapshot +# Create a snapshot Now we're ready to backup some data. The contents of a directory at a specific point in time is called a "snapshot" in restic. Run the following command and @@ -160,7 +158,7 @@ You can even backup individual files in the same repository. In fact several hosts may use the same repository to backup directories and files leading to a greater de-duplication. -## List all snapshots +# List all snapshots Now, you can list all the snapshots stored in the repository: @@ -171,7 +169,7 @@ Now, you can list all the snapshots stored in the repository: 40dc1520 2015-05-08 21:38:30 kasimir /home/user/work 79766175 2015-05-08 21:40:19 kasimir /home/user/work -## Restore a snapshot +# Restore a snapshot Restoring a snapshot is as easy as it sounds, just use the following command to restore the contents of the latest snapshot to `/tmp/restore-work`: @@ -180,7 +178,7 @@ restore the contents of the latest snapshot to `/tmp/restore-work`: enter password for repository: restoring to /tmp/restore-work -## Manage repository keys +# Manage repository keys The `key` command allows you to set multiple access keys or passwords per repository. In fact, you can use the `list`, `add`, `remove` and `passwd` @@ -205,7 +203,7 @@ sub-commands to manage these keys very precisely: 5c657874 username kasimir 2015-08-12 13:35:05 *eb78040b username kasimir 2015-08-12 13:29:57 -## Check integrity and consistency +# Check integrity and consistency Imagine your repository is saved on a server that has a faulty hard drive, or even worse, attackers get privileged access and modify your backup with the @@ -228,7 +226,7 @@ the same error: Load indexes ciphertext verification failed -## Mount a repository +# Mount a repository Browsing your backup as a regular file system is also very easy. First, create a mount point such as `/mnt/restic` and then use the following command to serve @@ -245,7 +243,7 @@ Windows doesn't support FUSE directly. Projects like yet, but we'd like to hear about your experience. For setup information see [dokan FUSE in dokan's wiki](https://github.com/dokan-dev/dokany/wiki/FUSE). -## Create an SFTP repository +# Create an SFTP repository In order to backup data via SFTP, you must first set up a server with SSH and let it know your public key. Passwordless login is really important since @@ -268,7 +266,7 @@ a repository in the user's home directory on the server, use the location `sftp://user@host/foo/bar/repo`. In this case the directory is relative to the user's home directory: `foo/bar/repo`. -## Create an Amazon S3 repository +# Create an Amazon S3 repository Restic can backup data to any Amazon S3 bucket. However, in this case, changing the URL scheme is not enough since Amazon uses special security credentials to sign HTTP requests. By consequence, you must first setup the following environment variables with the credentials you obtained while creating the bucket. @@ -287,7 +285,22 @@ You can then easily initialize a repository that uses your Amazon S3 as a backen For an S3-compatible repository without TLS available, use the alternative URI protocol `s3:http://server:port/bucket_name`. -## Under the hood: Browse repository objects +# Debugging restic + +The program can be built with debug support like this: + + $ go run build.go -tags debug + +Afterwards, extensive debug messages are written to the file in environment +variable `RESTIC_DEBUG`, e.g.: + + $ RESTIC_DEBUG=/tmp/restic-debug.log restic backup ~/work + +If you suspect that there is a bug, you can have a look at the debug log. +Please be aware that the debug log might contain sensitive information such as +file and directory names. + +# Under the hood: Browse repository objects Internally, a repository stores data of several different types described in the [design documentation](https://github.com/restic/restic/blob/master/doc/Design.md). You can `list` objects such as blobs, packs, index, snapshots, keys or locks with the following command: From 45e9561b48ad72121761743949e10d975f751745 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 21 Feb 2016 12:58:42 +0100 Subject: [PATCH 8/9] doc: Add paragraph about documentation version --- doc/index.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/index.md b/doc/index.md index 70d3dfa68..51bed2e27 100644 --- a/doc/index.md +++ b/doc/index.md @@ -7,3 +7,9 @@ restic is a backup program that is fast, efficient and secure. On the left you can find an overview of the documentation. The project's homepage is , the source code repository can be found on GitHub at the URL . + +The documentation you're currently viewing may not match the version of restic +you have installed. If you cloned the repository manually, you can find the +right documentation in the directory `doc/`. If you're viewing this online at +, there is a small menu at the bottom left of +this page, where you can select the version. From 1edf9c1ee4c229ee7a097fc7f4fdfa686411b52c Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 21 Feb 2016 13:04:45 +0100 Subject: [PATCH 9/9] doc: Add paragraph about mkdocs --- doc/index.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/index.md b/doc/index.md index 51bed2e27..b0512bfba 100644 --- a/doc/index.md +++ b/doc/index.md @@ -13,3 +13,13 @@ you have installed. If you cloned the repository manually, you can find the right documentation in the directory `doc/`. If you're viewing this online at , there is a small menu at the bottom left of this page, where you can select the version. + +The restic documentation is built with [MkDocs](http://www.mkdocs.org). After +installing it, you can edit and view the documentation locally by running: + + $ mkdocs serve + INFO - Building documentation... + INFO - Cleaning site directory + [I 160221 12:33:57 server:271] Serving on http://127.0.0.1:8000 + +Afterwards visit the URL with a browser.