From 3d99a2ee601b0623bab33a08b23658b6697dd805 Mon Sep 17 00:00:00 2001 From: bescoto Date: Thu, 11 Sep 2003 22:49:42 +0000 Subject: Finished writing up the examples git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@423 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/examples-body.html | 247 +++++++++++++++++++++++++++++----------- 1 file changed, 183 insertions(+), 64 deletions(-) diff --git a/rdiff-backup/examples-body.html b/rdiff-backup/examples-body.html index d74907b..ef7f9c9 100644 --- a/rdiff-backup/examples-body.html +++ b/rdiff-backup/examples-body.html @@ -7,7 +7,8 @@
  • Restoring
  • Deleting older files
  • File selection with include/exclude options
  • - +
  • Getting information about the backup directory
  • +
  • Miscellaneous other commands
  • Backing up

    @@ -17,35 +18,34 @@ directory bar. bar will end up a copy of foo, except it will contain the directory foo/rdiff-backup-data, which will allow rdiff-backup to restore -previous states.

    +previous states. -
    rdiff-backup foo bar
    - +
    rdiff-backup foo bar

  • Simple remote case---backup directory /some/local-dir to the directory /whatever/remote-dir on the machine hostname.net. It uses ssh to open the necessary pipe to the remote copy of rdiff-backup. Just like the above except one directory is on -a remove computer.

    +a remove computer. -
    rdiff-backup /some/local-dir hostname.net::/whatever/remote-dir
    -
  • +
    rdiff-backup /some/local-dir hostname.net::/whatever/remote-dir

  • This time the source directory is remote and the destination is local. Also, we have specified the username on the remote host (by default ssh will attempt to log you in with the same username you have -on the local host).

    +on the local host). -
    rdiff-backup user@hostname.net::/remote-dir local-dir
    -
  • +
    rdiff-backup user@hostname.net::/remote-dir local-dir

  • It is even possible for both the source and destination directories to be on other machines. Below we have also added the --v5 switch for greater verbosity (verbosity settings go from -0 to 9, with 3 as the default).

    - -
    rdiff-backup -v5 user1@host1::/source-dir user2@host2::/dest-dir
  • +-v5 switch for greater verbosity (verbosity settings go +from 0 to 9, with 3 as the default), and the +--print-statistics switch so some statistics will be +displayed at the end (even without this switch, the statistics will +still be saved in the rdiff-backup-data directory). +
    rdiff-backup -v5 --print-statistics user1@host1::/source-dir user2@host2::/dest-dir

    @@ -71,12 +71,15 @@ and the backup directory local.

    In this case we can't use cp to copying host.net::remote-dir/file to local-dir/file because they are on different machines. We can get rdiff-backup to -restore the current version of that file like this: +restore the current version of that file using either of these:: -

    rdiff-backup -r now host.net::/remote-dir/file local-dir/file
    +
    rdiff-backup --restore-as-of now +host.net::/remote-dir/file local-dir/file
    rdiff-backup -r now +host.net::/remote-dir/file local-dir/file
    -The -r switch tells rdiff-backup to restore instead of -back up, and the now option indicates the current time.

    +The --restore-as-of (or -r for short) switch +tells rdiff-backup to restore instead of back up, and the +now option indicates the current time.

  • But the main advantage of rdiff-backup is that it keeps version @@ -96,72 +99,188 @@ increment file. Increment files are stored in hold the previous versions of changed files. If you specify one directly: -

    +
    rdiff-backup +host.net::/remote-dir/rdiff-backup-data/increments/file.2003-03-05T12:21:41-07:00.diff.gz local-dir/file
    + +rdiff-backup will tell from the filename that it is an rdiff-backup +increment file and thus enter restore mode. Above the restored version is written to local-dir/file.

  • + + + +

    Deleting older files

    + +

    Although rdiff-backup tries to save space by only storing file +differences, eventually space may run out in the destination +directory. rdiff-backup's --remove-older-than mode can +be used to delete older increments.

    + +

    This section assumes that rdiff-backup has been used in the past to +back up to host.net::/remote-dir, but all commands would +work locally too, if the hostname were ommitted.

    + + + + +

    File selection with include/exclude options

    + +

    Sometimes you don't want to back up all files. The various +--include and --exclude options can be used +to select exactly which files to back up. See the man page for a list +of all the options and their definitions.

    + + +

    Getting information about the backup directory

    -

    +The following examples assume that you have run rdiff-backup +in-dir out-dir in the past. -
  • -

    Back files up from /home/bob to /mnt/backup, leaving increments in -/mnt/backup/rdiff-backup-data. Do not back up directory /home/bob/tmp or -any files in it.

    +
    • This command finds all new or old files which contain the +string frobniz. -

      rdiff-backup --exclude /home/bob/tmp /home/bob /mnt/backup

    • +
      find out-dir -name '*frobniz*'
      -
    • -

      The file selection options can be combined in various ways. The following -command backs up the whole file system to /usr/local/backup. However, the -entire /usr directory is skipped, with the exception of /usr/local, which -is included, except for /usr/local/backup, which is excluded to prevent -a circularity:

      +rdiff-backup doesn't obscure the names of files at all, so often using +traditional tools work well.

    • -

      rdiff-backup --exclude /usr/local/backup --include /usr/local ---exclude /usr / /usr/local/backup

      +
    • Either of these equivalent commands lists the times of the +available versions of the file out-dir/file. It may be +useful if you need to restore an older version of +in-dir/file but aren't sure which one. -

    • -

      Suppose /mnt/backup is an rdiff-backup destination directory, and -space is running out there. The following command erases backup -information older than a week:

      +

      rdiff-backup --list-increments +out-dir/file
      rdiff-backup -l +out-dir/file

    • -

      rdiff-backup --remove-older-than 7D /mnt/backup

      +
    • The following command lists all the files under +out-dir/subdir which has changed in the last 5 days. -

    • -

      -The following reads the file important-data.2001-07-15T04:09:38-07:00.dir and -restores the resulting directory important-data as it was on Februrary 14, -2001, calling the new directory "temp". Note that rdiff-backup goes into -restore mode because it recognizes the suffix of the file. The -v9 means -keep lots of logging information.

      +

      rdiff-backup --list-changed-since 5D out-dir/subdir

    • -

      rdiff-backup -v9 important-data.2001-07-15T04:09:38-07:00.dir -temp

      +
    • This command lists all the files that were present in +out-dir/subdir 5 days ago. This includes files that have +not changed recently as well as those that have been deleted in the +last 5 days. -

    • -

      Suppose you backed up to the directory /backup on the host -remote.host.net, where your username is user. The following command -restores all of that data as it was 3 days ago to the directory -output.

      +
      rdiff-backup --list-at-time 5D +out-dir/subdir

    • -

      rdiff-backup -r 3D user@remote.host.net::/backup output

      +
    • rdiff-backup writes one statistics file per session to the +out-dir/rdiff-backup-data directory. An average of the +files can be displayed using the --calculate-average +option and specifying the statistics files to use. + +
      rdiff-backup --calculate-average out-dir/rdiff-backup-data/session_statistics*

    • +
    -
  • -

    Backup foo on one remote machine to bar on another. This will -probably be slower than running rdiff-backup from either machine.

    -

    rdiff-backup smith@host1::foo jones@host2::bar

    +

    Miscellaneous other commands

    -
  • -

    Test to see if the specified ssh command really opens up a working -rdiff-backup server on the remote side.

    +
    • If you are having problems connecting to a remote host, the +--test-server command may be useful. This command simply +verifies that there is a working rdiff-backup server on the remote +side. +

      rdiff-backup --test-server hostname.net::/ignored

    • -

      rdiff-backup --test-server hostname.net::/ignored

    -- cgit v1.2.1