From 878b620965c9eca5612e910c61f7ed4f63c22450 Mon Sep 17 00:00:00 2001
From: bescoto Simplest case---backup local directory Simple remote case---backup directory 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). It is even possible for both the source and destination
+directories to be on other machines. Below we have also added the
+ Suppose earlier we have run Examples
+
+Sections:
+
+
+
+Backing up
+
+
+
+
+
+foo
to local
+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.
+rdiff-backup foo bar
/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.
+rdiff-backup /some/local-dir hostname.net::/whatever/remote-dir
+rdiff-backup user@hostname.net::/remote-dir local-dir
-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
Restoring
+
+
+
rdiff-backup foo bar
,
+with both foo and bar local. We accidentally deleted
+foo/dir
and now want to restore it from bar/dir
.
+
+
+
+That's right, since rdiff-backup makes a mirror, we can retrieve files
+using standard commands like cp -a bar/dir foo/dir
cp
.
For the rest of the examples in the section, we will assume
+that the user has backed up with the command rdiff-backup
+local-dir host.net::/remote-dir
. Of course, in all these
+examples it would be equally possible to have the source being remote
+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:
+
+
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.
+But the main advantage of rdiff-backup is that it keeps version
+history. This command restores
+host.net::/remote-dir/file
as it was 10 days ago into a
+new location /tmp/file
.
+
+
rdiff-backup -r 10D host.net::/remote-dir/file /tmp/file
+
+Other acceptable time strings include 5m4s
(5 minutes and
+4 seconds) and 2002-03-05
(March 5th, 2002). For more
+information, see the TIME FORMATS section of the manual page. Finally, we can use rdiff-backup to restore directory from an
+increment file. Increment files are stored in
+host.net::/remote-dir/rdiff-backup-data/increments
and
+hold the previous versions of changed files. If you specify one
+directly:
+
+
+
+, rdiff-backup will tell from the filename that it is an
+rdiff-backup file and not
+
+Foo
+ +
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.
+ +rdiff-backup --exclude /home/bob/tmp /home/bob /mnt/backup
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 --exclude /usr/local/backup --include /usr/local +--exclude /usr / /usr/local/backup
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 --remove-older-than 7D /mnt/backup
+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 -v9 important-data.2001-07-15T04:09:38-07:00.dir +temp
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 -r 3D user@remote.host.net::/backup output
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
+ +Test to see if the specified ssh command really opens up a working +rdiff-backup server on the remote side.
+ + +rdiff-backup --test-server hostname.net::/ignored