rdiff-backup(增量备份工具)手册_中英文对照_机翻
Version 1.3.3
MARCH 2009
SYNOPSIS 简介
rdiff-backup [options] [[[user@]host1.foo]::source_directory] [[[user@]host2.foo]::destination_directory]
rdiff-backup {{ -l | --list-increments } | --remove-older-than time_interval | --list-at-time time | --list-changed-since time | --list-increment-sizes | --verify | --verify-at-time time} [[[user@]host2.foo]::destination_directory]
rdiff-backup --calculate-average statfile1 statfile2 ...
rdiff-backup --test-server [user1]@host1.net1::path [[user2]@host2.net2::path] ...
DESCRIPTION 说明
rdiff-backup is a script, written in python(1) that backs up one directory to another. The target directory ends up a copy (mirror) of the source directory, but extra reverse diffs are stored in a special subdirectory of that target directory, so you can still recover files lost some time ago. The idea is to combine the best features of a mirror and an incremental backup. rdiff-backup also preserves symlinks, special files, hardlinks, permissions, uid/gid ownership, and modification times.
Rdiff-backup是一个用python(1)编写的脚本,它将一个目录备份到另一个目录。目标目录最终是源目录的一个副本(镜像),但是额外的反向差异存储在目标目录的一个特殊子目录中,因此您仍然可以恢复一段时间前丢失的文件。其思想是将镜像和增量备份的最佳功能结合起来。Rdiff-backup还保留符号链接、特殊文件、硬链接、权限、uid/gid所有权和修改时间。
rdiff-backup can also operate in a bandwidth efficient manner over a pipe, like rsync(1). Thus you can use ssh and rdiff-backup to securely back a hard drive up to a remote location, and only the differences will be transmitted. Using the default settings, rdiff-backup requires that the remote system accept ssh connections, and that rdiff-backup is installed in the user's PATH on the remote system. For information on other options, see the section on REMOTE OPERATION.
Rdiff-backup也可以通过管道以带宽高效的方式运行,如rsync(1)。因此,您可以使用ssh和rdiff备份将硬盘安全地备份到远程位置,并且只传输差异。使用默认设置,rdiff备份要求远程系统接受ssh连接,并且rdiff-backup安装在远程系统的用户路径中。有关其他选项的信息,请参阅有关远程操作的部分。
Note that you should not write to the mirror directory except with rdiff-backup. Many of the increments are stored as reverse diffs, so if you delete or modify a file, you may lose the ability to restore previous versions of that file.
请注意,除了使用rdiff-backup外,不应写入镜像目录。许多增量存储为反向差异,因此如果删除或修改文件,可能会失去还原该文件以前版本的能力。
Finally, this man page is intended more as a precise description of the behavior and syntax of rdiff-backup. New users may want to check out the examples.html file included in the rdiff-backup distribution.
最后,此手册页旨在更准确地描述rdiff-backup的行为和语法。新用户可能希望给出rdiff-backup分发中包含的examples.html文件。
OPTIONS 选项
-b, --backup-mode
Force backup mode even if first argument appears to be an increment or mirror file.
强制备份模式,即使第一个参数看起来是增量或镜像文件。
--calculate-average
Enter calculate average mode. The arguments should be a number of statistics files. rdiff-backup will print the average of the listed statistics files and exit.
进入计算平均值模式。参数应该是一些统计文件。rdiff-backup将打印列出的统计文件的平均值并退出。
--carbonfile
Enable backup of MacOS X carbonfile information.
启用MacOS X carbonfile信息的备份。
--check-destination-dir
If an rdiff-backup session fails, running rdiff-backup with this option on the destination dir will undo the failed directory. This happens automatically if you attempt to back up to a directory and the last backup failed.
如果rdiff-backup会话失败,在目标目录上使用此选项运行rdiff-backup将撤消失败的目录。如果您尝试备份到目录,但最后一次备份失败,则会自动发生这种情况。
--compare
This is equivalent to '--compare-at-time now'
这相当于“—compare-at-time now”
--compare-at-time time
Compare a directory with the backup set at the given time. This can be useful to see how archived data differs from current data, or to check that a backup is current. This only compares metadata, in the same way rdiff-backup decides whether a file has changed.
将目录与给定时间的备份集进行比较。这有助于查看存档数据与当前数据的区别,或者检查备份是否为当前备份。这只比较元数据,就像rdiff-backup决定文件是否已更改一样。
--compare-full
This is equivalent to '--compare-full-at-time now'
--compare-full-at-time time
Compare a directory with the backup set at the given time. To compare regular files, the repository data will be copied in its entirety to the source side and compared byte by byte. This is the slowest but most complete compare option.
将目录与给定时间的备份集进行比较。为了比较常规文件,存储库数据将全部复制到源端,并逐字节进行比较。这是最慢但最完整的比较选项。
--compare-hash
This is equivalent to '--compare-hash-at-time now'
--compare-hash-at-time time
Compare a directory with the backup set at the given time. Regular files will be compared by computing their SHA1 digest on the source side and comparing it to the digest recorded in the metadata.
将目录与给定时间的备份集进行比较。通过计算源端的SHA1摘要并将其与元数据中记录的摘要进行比较,可以比较常规文件。
--create-full-path
Normally only the final directory of the destination path will be created if it does not exist. With this option, all missing directories on the destination path will be created. Use this option with care: if there is a typo in the remote path, the remote filesystem could fill up very quickly (by creating a duplicate backup tree). For this reason this option is primarily aimed at scripts which automate backups.
通常,如果目标路径不存在,则只创建该路径的最终目录。使用此选项,将在目标路径上创建所有缺少的目录。小心使用此选项:如果远程路径中有输入错误,远程文件系统可能会很快填满(通过创建一个重复的备份树)。因此,此选项主要针对自动备份的脚本。
--current-time seconds
This option is useful mainly for testing. If set, rdiff-backup will use it for the current time instead of consulting the clock. The argument is the number of seconds since the epoch.
此选项主要用于测试。如果设置,rdiff backup将在当前时间使用它,而不是查询时钟。参数是自纪元以来的秒数。
--exclude shell_pattern
Exclude the file or files matched by shell_pattern. If a directory is matched, then files under that directory will also be matched. See the FILE SELECTION section for more information.
排除一个或多个与外壳模式匹配的文件。如果目录匹配,则该目录下的文件也将匹配。有关详细信息,请参见文件选择部分。
--exclude-device-files
Exclude all device files. This can be useful for security/permissions reasons or if rdiff-backup is not handling device files correctly.
排除所有设备文件。这对于安全/权限原因或rdiff-backup未正确处理设备文件时非常有用。
--exclude-fifos
Exclude all fifo files.
排除所有fifo文件。
--exclude-filelist filename
Excludes the files listed in filename. If filename is handwritten you probably want --exclude-globbing-filelist instead. See the FILE SELECTION section for more information.
排除文件名中列出的文件。如果文件名是手写的,您可能需要这个命令--exclude-globbing-filelist。有关详细信息,请参见文件选择部分。
--exclude-filelist-stdin
Like --exclude-filelist, but the list of files will be read from standard input. See the FILE SELECTION section for more information.
与—exclude-filelist相似,但将从标准输入读取文件列表。有关详细信息,请参见文件选择部分。
--exclude-globbing-filelist filename
Like --exclude-filelist but each line of the filelist will be interpreted according to the same rules as --include and --exclude.
与—exclude-filelist相似,但是filelist的每一行都将按照--include和--exclude相同的规则进行解释。
--exclude-globbing-filelist-stdin
Like --exclude-globbing-filelist, but the list of files will be read from standard input.
与—exclude-globbing-filelist相似,但将从标准输入读取文件列表。
--exclude-other-filesystems
Exclude files on file systems (identified by device number) other than the file system the root of the source directory is on.
排除文件系统(由设备号标识)上的文件,而不是源目录根目录所在的文件系统。
--exclude-regexp regexp
Exclude files matching the given regexp. Unlike the --exclude option, this option does not match files in a directory it matches. See the FILE SELECTION section for more information.
排除与给定regexp匹配的文件。与--exclude选项不同,此选项与它匹配的目录中的文件不匹配。有关详细信息,请参见文件选择部分。
--exclude-special-files
Exclude all device files, fifo files, socket files, and symbolic links.
排除所有设备文件、fifo文件、套接字文件和符号链接。
--exclude-sockets
Exclude all socket files.
排除所有套接字文件。
--exclude-symbolic-links
Exclude all symbolic links. This option is automatically enabled if the backup source is running on native Windows to avoid backing-up NTFS reparse points.
排除所有符号链接。
--exclude-if-present filename
Exclude directories if filename is present. This option needs to come before any other include or exclude options.
如果存在文件名,则排除目录。此选项必须先于任何其他包含或排除选项。
--force
Authorize a more drastic modification of a directory than usual (for instance, when overwriting of a destination path, or when removing multiple sessions with --remove-older-than). rdiff-backup will generally tell you if it needs this. WARNING: You can cause data loss if you mis-use this option. Furthermore, do NOT use this option when doing a restore, as it will DELETE FILES, unless you absolutely know what you are doing.
授权对目录进行比通常更剧烈的修改(例如,当覆盖目标路径时,或当使用—remove-older-than删除多个会话时)。rdiff备份通常会告诉你它是否需要这个。警告:如果不正确使用此选项,可能会导致数据丢失。此外,在执行还原时不要使用此选项,因为它将删除文件,除非您完全知道要执行的操作。
--group-mapping-file filename
Map group names and ids according the the group mapping file filename. See the USERS AND GROUPS section for more information.
根据组映射文件名映射组名称和标识。有关详细信息,请参阅“用户和组”部分。
--include shell_pattern
Similar to --exclude but include matched files instead. Unlike --exclude, this option will also match parent directories of matched files (although not necessarily their contents). See the FILE SELECTION section for more information.
类似于—exclude,包含匹配的文件。与--exclude不同,此选项还将匹配文件的父目录(尽管不一定是其内容)。有关详细信息,请参见文件选择部分。
--include-filelist filename
Like --exclude-filelist, but include the listed files instead. If filename is handwritten you probably want --include-globbing-filelist instead. See the FILE SELECTION section for more information.
与—exclude-filelist相似,但要包含列出的文件。如果文件名是手写的,您可能需要这个命令-- include-globbing-filelist。有关详细信息,请参见文件选择部分。
--include-filelist-stdin
Like --include-filelist, but read the list of included files from standard input.
与—include-filelist相似,但从标准输入中读取包含文件的列表。
--include-globbing-filelist filename
Like --include-filelist but each line of the filelist will be interpreted according to the same rules as --include and --exclude.
与—include-filelist相似,但是文件列表的每一行都将按照--include和--exclude相同的规则进行解释。
--include-globbing-filelist-stdin
Like --include-globbing-filelist, but the list of files will be read from standard input.
与—include-globbing-filelist相似,但文件列表将从标准输入读取。
--include-regexp regexp
Include files matching the regular expression regexp. Only files explicitly matched by regexp will be included by this option. See the FILE SELECTION section for more information.
包含与正则表达式regexp匹配的文件。此选项只包含与regexp显式匹配的文件。有关详细信息,请参见文件选择部分。
--include-special-files
Include all device files, fifo files, socket files, and symbolic links.
包括所有设备文件、fifo文件、套接字文件和符号链接。
--include-symbolic-links
Include all symbolic links.
包括所有符号链接。
--list-at-time time
List the files in the archive that were present at the given time. If a directory in the archive is specified, list only the files under that directory.
列出存档中在给定时间存在的文件。如果指定了存档中的目录,则仅列出该目录下的文件。
--list-changed-since time
List the files that have changed in the destination directory since the given time. See TIME FORMATS for the format of time. If a directory in the archive is specified, list only the files under that directory. This option does not read the source directory; it is used to compare the contents of two different rdiff-backup sessions.
列出自给定时间以来目标目录中已更改的文件。有关时间格式,请参见时间格式。如果指定了存档中的目录,则仅列出该目录下的文件。此选项不读取源目录;它用于比较两个不同rdiff-backup会话的内容。
-l, --list-increments
List the number and date of partial incremental backups contained in the specified destination directory. No backup or restore will take place if this option is given.
列出指定目标目录中包含的部分增量备份的数目和日期。如果提供此选项,则不会进行备份或还原。
--list-increment-sizes
List the total size of all the increment and mirror files by time. This may be helpful in deciding how many increments to keep, and when to --remove-older-than. Specifying a subdirectory is allowable; then only the sizes of the mirror and increments pertaining to that subdirectory will be listed.
按时间列出所有增量和镜像文件的总大小。这可能有助于确定要保留多少增量,以及何时删除早于的增量。允许指定子目录;然后只列出镜像的大小和与该子目录相关的增量。
--max-file-size size
Exclude files that are larger than the given size in bytes
排除大于给定字节大小的文件
--min-file-size size
Exclude files that are smaller than the given size in bytes
排除小于给定字节大小的文件
--never-drop-acls
Exit with error instead of dropping acls or acl entries. Normally this may happen (with a warning) because the destination does not support them or because the relevant user/group names do not exist on the destination side.
退出时出错,而不是删除acl或acl条目。通常情况下,这可能会发生(带有警告),因为目标不支持它们,或者因为目标端不存在相关的用户/组名称。
--no-acls
No Access Control Lists - disable backup of ACLs
无访问控制列表-禁用ACL备份
--no-carbonfile
Disable backup of MacOS X carbonfile information
禁用MacOS X carbonfile信息的备份
--no-compare-inode
This option prevents rdiff-backup from flagging a hardlinked file as changed when its device number and/or inode changes. This option is useful in situations where the source filesystem lacks persistent device and/or inode numbering. For example, network filesystems may have mount-to-mount differences in their device number (but possibly stable inode numbers); USB/1394 devices may come up at different device numbers each remount (but would generally have same inode number); and there are filesystems which don't even have the same inode numbers from use to use. Without the option rdiff-backup may generate unnecessary numbers of tiny diff files.
此选项可防止rdiff-backup在硬链接文件的设备号和/或索引节点更改时将其标记为已更改。在源文件系统缺少持久设备和/或索引节点编号的情况下,此选项非常有用。例如,网络文件系统可能在其设备编号(但可能是稳定的inode编号)上存在装载到装载的差异;每次重新装载时,USB/1394设备可能会出现不同的设备编号(但通常会有相同的inode编号);并且有些文件系统甚至在使用时都没有相同的inode编号。如果没有rdiff备份选项,可能会生成不必要数量的微型diff文件。
--no-compression
Disable the default gzip compression of most of the .snapshot and .diff increment files stored in the rdiff-backup-data directory. A backup volume can contain compressed and uncompressed increments, so using this option inconsistently is fine.
禁用默认gzip压缩,存储在rdiff-backup-data目录中的大多数.snapshot和.diff增量文件的默认gzip压缩。备份卷可以包含压缩增量和未压缩增量,因此可以不一致地使用此选项。
--no-compression-regexp regexp
Do not compress increments based on files whose filenames match regexp. The default includes many common audiovisual and archive files, and may be found in Globals.py.
不要基于文件名与regexp匹配的文件压缩增量。默认值包括许多常见的视听和存档文件,可以在全局.py。 globals() 函数会以字典类型返回当前位置的全部全局变量。
--no-eas
No Extended Attributes support - disable backup of EAs.
不支持扩展属性-禁用EAs备份。
--no-file-statistics
This will disable writing to the file_statistics file in the rdiff-backup-data directory. rdiff-backup will run slightly quicker and take up a bit less space.
这将禁用对rdiff-backup-data目录中的文件统计信息文件的写入。Rdiff-backup将运行得稍微快一点,占用的空间也会少一点。
--no-hard-links
Don't replicate hard links on destination side. If many hardlinked files are present, this option can drastically decrease memory usage. This option is enabled by default if the backup source or restore destination is running on native Windows.
不要在目标端复制硬链接。如果存在许多硬链接文件,则此选项可以显著减少内存使用。如果备份源或还原目标在本机Windows上运行,则默认情况下启用此选项。
--null-separator
Use nulls (\0) instead of newlines (\n) as line separators, which may help when dealing with filenames containing newlines. This affects the expected format of the files specified by the --{include|exclude}-filelist[-stdin] switches as well as the format of the directory statistics file.
使用nulls(\0)而不是newlines(\n)作为行分隔符,这可能有助于处理包含新行的文件名。这会影响--{include | exclude}-filelist[-stdin]开关指定的文件的预期格式以及目录统计文件的格式。
--override-chars-to-quote
If the filesystem to which we are backing up is not case-sensitive, automatic 'quoting' of characters occurs. For example, a file 'Developer.doc' will be converted into ';068eveloper.doc'. To override this behavior, you need to specify this option.
如果要备份的文件系统不是区分大小写的,则会自动“引用”字符。例如,一个文件‘Devieloper.doc’将转换为‘;068eveloper.doc’文件. 要禁止此行为,需要指定此选项。
--parsable-output
If set, rdiff-backup's output will be tailored for easy parsing by computers, instead of convenience for humans. Currently this only applies when listing increments using the -l or --list-increments switches, where the time will be given in seconds since the epoch.
设置此项,rdiff-backup的输出将被定制为便于计算机解析,而不是方便人类。目前,这仅适用于使用-l或--lis-increments列出增量时,其中的时间将以自纪元以来的秒为单位。
--preserve-numerical-ids
If set, rdiff-backup will preserve uids/gids instead of trying to preserve unames and gnames. See the USERS AND GROUPS section for more information.
如果设置,rdiff-backup将保留uid/gid,而不是试图保留uname和gnames。有关详细信息,请参阅“用户和组”部分。
--print-statistics
If set, summary statistics will be printed after a successful backup. If not set, this information will still be available from the session statistics file. See the STATISTICS section for more information.
如果设置,则成功备份后将打印摘要统计信息。如果未设置,则会话统计文件中仍将提供此信息。有关详细信息,请参阅“统计”部分。
-r, --restore-as-of restore_time
Restore the specified directory as it was as of restore_time. See the TIME FORMATS section for more information on the format of restore_time, and see the RESTORING section for more information on restoring.
将指定目录还原为某个时间时的状态。有关还原时间格式的详细信息,请参阅时间格式部分;有关还原的详细信息,请参阅还原部分。
--remote-cmd cmd
Deprecated. Please use --remote-schema instead
已弃用。请改用—remote-schema
--remote-schema schema
Specify an alternate method of connecting to a remote computer. This is necessary to get rdiff-backup not to use ssh for remote backups, or if, for instance, rdiff-backup is not in the PATH on the remote side. See the REMOTE OPERATION section for more information.
指定另一种连接到远程计算机的方法。这对于rdiff-backup不使用ssh进行远程备份是必要的,或者如果rdiff-backup不在远程端的路径中。有关详细信息,请参阅远程操作部分。
--remote-tempdir path
Adds the --tempdir option with argument path when invoking remote instances of rdiff-backup.
在调用rdiff-backup的远程实例时,添加带参数path的--tempdir选项。
--remove-older-than time_spec
Remove the incremental backup information in the destination directory that has been around longer than the given time. time_spec can be either an absolute time, like "2002-01-04", or a time interval. The time interval is an integer followed by the character s, m, h, D, W, M, or Y, indicating seconds, minutes, hours, days, weeks, months, or years respectively, or a number of these concatenated. For example, 32m means 32 minutes, and 3W2D10h7s means 3 weeks, 2 days, 10 hours, and 7 seconds. In this context, a month means 30 days, a year is 365 days, and a day is always 86400 seconds.
删除目标目录中超过给定时间的增量备份信息。时间规范可以是绝对时间,如“2002-01-04”,也可以是时间间隔。时间间隔是一个整数,后跟字符s、m、h、D、W、m或Y,分别表示秒、分钟、小时、天、周、月或年,或这些连接的数字。例如,32m表示32分钟,3W2D10h7s表示3周、2天、10小时和7秒。在这种情况下,一个月意味着30天,一年意味着365天,一天总是86400秒。
rdiff-backup cannot remove-older-than and back up or restore in a single session. In order to both backup a directory and remove old files in it, you must run rdiff-backup twice.
Rdiff-backup无法在单个备份或还原会话中删除。为了备份目录并删除其中的旧文件,必须运行rdiff backup两次。
By default, rdiff-backup will only delete information from one session at a time. To remove two or more sessions at the same time, supply the --force option (rdiff-backup will tell you if --force is required).
默认情况下,rdiff-backup一次只能从一个会话中删除信息。要同时删除两个或多个会话,请提供--force选项(rdiff backup将告诉您是否需要--force)。
Note that snapshots of deleted files are covered by this operation. Thus if you deleted a file two weeks ago, backed up immediately afterwards, and then ran rdiff-backup with --remove-older-than 10D today, no trace of that file would remain. Finally, file selection options such as --include and --exclude don't affect --remove-older-than.
请注意,此操作将包含已删除文件的快照。因此,如果两周前删除了一个文件,然后立即备份,然后使用—remove-older-than 10D today运行rdiff backup,则不会保留该文件的任何痕迹。最后,文件选择选项(如--include和--exclude)不影响—remove-older-than。
--restrict path
Require that all file access be inside the given path. This switch, and the following two, are intended to be used with the --server switch to provide a bit more protection when doing automated remote backups. They are not intended as your only line of defense so please don't do something silly like allow public access to an rdiff-backup server run with --restrict-read-only.
要求所有文件访问都在给定路径内。此选项和以下两个选项是与—server选项一起使用,以便在执行自动远程备份时提供更多保护。它们并不是你唯一的防线,所以请不要做一些愚蠢的事情,比如允许公共访问rdiff-backup服务器,运行时使用—restrict-read-only。
--restrict-read-only path
Like --restrict, but also reject all write requests.
与—restrict相似,但拒绝所有写请求。
--restrict-update-only path
Like --restrict, but only allow writes as part of an incremental backup. Requests for other types of writes (for instance, deleting path) will be rejected.
与—restrict相似,但只允许写入作为增量备份的一部分。对其他类型写入(例如,删除路径)的请求将被拒绝。
--server
Enter server mode (not to be invoked directly, but instead used by another rdiff-backup process on a remote computer).
进入服务器模式(不直接调用,而是由远程计算机上的另一个rdiff-backup进程使用)。
--ssh-no-compression
When running ssh, do not use the -C option to enable compression. --ssh-no-compression is ignored if you specify a new schema using --remote-schema.
运行ssh时,不要使用-C选项来启用压缩。--如果使用—remote-schema指定新架构,则不忽略ssh-no-compression。
--tempdir path
Sets the directory that rdiff-backup uses for temporary files to the given path. The environment variables TMPDIR, TEMP, and TMP can also be used to set the temporary files directory. See the documentation of the Python tempfile module for more information.
将rdiff-backup用于临时文件的目录设置为给定路径。环境变量TMPDIR、TEMP和TMP也可用于设置临时文件目录。有关更多信息,请参阅Python tempfile模块的文档。
--terminal-verbosity [0-9]
Select which messages will be displayed to the terminal. If missing the level defaults to the verbosity level.
选择将向终端显示的消息。如果缺少级别,则默认为详细级别。
--test-server
Test for the presence of a compatible rdiff-backup server as specified in the following host::filename argument(s). The filename section will be ignored.
测试是否存在以下host::filename参数中指定的兼容rdiff-backup服务器。文件名部分将被忽略。
--use-compatible-timestamps
Create timestamps in which the hour/minute/second separator is a - (hyphen) instead of a : (colon). It is safe to use this option on one backup, and then not use it on another; rdiff-backup supports the intermingling of different timestamp formats. This option is enabled by default on platforms which require that the colon be escaped.
创建时间戳,其中小时/分钟/秒分隔符是一个 -(连字符)而不是一个:(冒号)。在一个备份上使用此选项是安全的,但在另一个备份上不使用;rdiff-backup支持不同时间戳格式的混合。此选项在要求冒号转义的平台上默认启用。
--user-mapping-file filename
Map user names and ids according to the user mapping file filename. See the USERS AND GROUPS section for more information.
根据用户映射文件名映射用户名和id。有关详细信息,请参阅“用户和组”部分。
-v[0-9], --verbosity [0-9]
Specify verbosity level (0 is totally silent, 3 is the default, and 9 is noisiest). This determines how much is written to the log file.
指定详细级别(0是完全静默的,3是默认的,9是最详细的)。这决定了写入日志文件的量。
--verify
This is short for --verify-at-time now
这是 --verify-at-time now
--verify-at-time now
Check all the data in the repository at the given time by computing the SHA1 hash of all the regular files and comparing them with the hashes stored in the metadata file.
通过计算所有常规文件的SHA1散列并将它们与元数据文件中存储的散列进行比较,在给定时间检查存储库中的所有数据。
-V, --version
Print the current version and exit
打印当前版本并退出
RESTORING 恢复
There are two ways to tell rdiff-backup to restore a file or directory. Firstly, you can run rdiff-backup on a mirror file and use the -r or --restore-as-of options. Secondly, you can run it on an increment file.
Rdiff-backup还原文件或目录有两种方法。首先,可以在镜像文件上运行rdiff-backup,并使用-r或—restore-as选项。其次,可以在增量文件上运行它。
For example, suppose in the past you have run:
例如,假设您过去运行过:
rdiff-backup /usr /usr.backup
to back up the /usr directory into the /usr.backup directory, and now want a copy of the /usr/local directory the way it was 3 days ago placed at /usr/local.old.
将/usr目录备份到/usr.backup目录,现在需要一个/usr/local目录3天前的副本放到/usr/local.old目录。
One way to do this is to run:
一种方法是运行:
rdiff-backup -r 3D /usr.backup/local /usr/local.old
where above the "3D" means 3 days (for other ways to specify the time, see the TIME FORMATS section). The /usr.backup/local directory was selected, because that is the directory containing the current version of /usr/local.
上面的“3D”表示3天(有关指定时间的其他方式,请参见“时间格式”部分)。那个/usr.backup/local已选择目录,因为该目录包含当前版本的/usr/local。
Note that the option to --restore-as-of always specifies an exact time. (So "3D" refers to the instant 72 hours before the present.) If there was no backup made at that time, rdiff-backup restores the state recorded for the previous backup. For instance, in the above case, if "3D" is used, and there are only backups from 2 days and 4 days ago, /usr/local as it was 4 days ago will be restored.
注意—restore-as-of的选项总是指定一个确切的时间。(因此“3D”指的是当前备份前72小时的瞬间。)如果当时没有备份,rdiff-backup将恢复为指定时间点上一次备份记录的状态。例如,在上述情况下,如果使用“3D”,并且只有2天和4天以前的备份,那么/usr/local将恢复到4天以前的状态。
The second way to restore files involves finding the corresponding increment file. It would be in the /backup/rdiff-backup-data/increments/usr directory, and its name would be something like "local.2002-11-09T12:43:53-04:00.dir" where the time indicates it is from 3 days ago. Note that the increment files all end in ".diff", ".snapshot", ".dir", or ".missing", where ".missing" just means that the file didn't exist at that time (finally, some of these may be gzip-compressed, and have an extra ".gz" to indicate this). Then running:
恢复文件的第二种方法是查找相应的增量文件。它将位于/backup/rdiff-backup-data/increments/usr目录中,其名称类似于“local.2002-11-09T12:43:53-04:00.dir”,其中时间表示它来自3天前。请注意,增量文件都以“.diff”、“.snapshot”、“.dir”或“.missing”结尾,其中“.missing”仅表示该文件当时不存在(最后,其中一些文件可能是gzip压缩的,并有一个额外的“.gz”来表示这一点)。然后运行:
rdiff-backup /backup/rdiff-backup-data/increments/usr/local.<time>.dir /usr/local.old
would also restore the file as desired.
也会根据需要还原文件。
If you are not sure exactly which version of a file you need, it is probably easiest to either restore from the increments files as described immediately above, or to see which increments are available with -l/--list-increments, and then specify exact times into -r/--restore-as-of.
如果您不确定到底需要哪个版本的文件,则可能最容易的方法是从上述增量文件中还原,或者查看-l/--list-incrememts增量中可用的增量,然后指定还原到-r/--restore的确切时间。
TIME FORMATS时间格式
rdiff-backup uses time strings in two places. Firstly, all of the increment files rdiff-backup creates will have the time in their file-names in the w3 datetime format as described in a w3 note at http://www.w3.org/TR/NOTE-datetime.Basically they look like "2001-07-15T04:09:38-07:00", which means what it looks like. The "-07:00" section means the time zone is 7 hours behind UTC.
Secondly, the -r, --restore-as-of, and --remove-older-than options take a time string, which can be given in any of several formats:
rdiff-backup在两个地方使用到时间字符串。首先,rdiff backup创建的所有增量文件的时间都将以w3 datetime格式显示在其文件名中,参考http://www.w3.org/TR/NOTE-datetime。例如“2001-07-15T04:09:38-07:00”, “-07:00”部分表示时区比UTC晚7小时。
其次,-r,--restore-as-of和--remove-older-than选项使用一个时间字符串,该字符串可以以多种格式给出:
1. the string "now" (refers to the current time)
字符串“now”(指当前时间)
2. a sequences of digits, like "123456890" (indicating the time in seconds after the epoch)
一系列数字,如“123456890”(表示纪元后的秒数)
时间戳是自 1970 年 1 月 1 日(08:00:00 GMT)(00:00:00 UTC)
3. A string like "2002-01-25T07:00:00+02:00" in datetime format
日期时间格式的字符串,如“2002-01-25T07:00:00+02:00”
4. An interval, which is a number followed by one of the characters s, m, h, D, W, M, or Y (indicating seconds, minutes, hours, days, weeks, months, or years respectively), or a series of such pairs. In this case the string refers to the time that preceded the current time by the length of the interval. For instance, "1h78m" indicates the time that was one hour and 78 minutes ago. The calendar here is unsophisticated: a month is always 30 days, a year is always 365 days, and a day is always 86400 seconds.
一种间隔,它是一个数字,后跟字符s、m、h、D、W、M或Y中的一个(分别表示秒、分、小时、天、周、月或年),或一系列这样的对。在这种情况下,字符串是指当前时间之前的时间与间隔的长度。例如,“1h78m”表示一小时七八分钟前的时间。这里的日历很简单:一个月总是30天,一年总是365天,一天总是86400秒。
5. A date format of the form YYYY/MM/DD, YYYY-MM-DD, MM/DD/YYYY, or MM-DD-YYYY, which indicates midnight on the day in question, relative to the current timezone settings. For instance, "2002/3/5", "03-05-2002", and "2002-3-05" all mean March 5th, 2002.
格式为YYYY/MM/DD、YYYY-MM-DD、MM/DD/YYYY或MM-DD-YYYY的日期格式,相对于当前时区设置,它表示指定日期的午夜(凌晨零点,包含这一天)。例如,“2002/3/5”、“03-05-2002”和“2002-3-05”都是指2002年3月5日00:00:00。
6. A backup session specification which is a non-negative integer followed by 'B'. For instance, '0B' specifies the time of the current mirror, and '3B' specifies the time of the 3rd newest increment.
一个备份会话规范,它是一个非负整数,后跟“B”。例如,“0B”指定当前镜像的时间,“3B”指定第三个最新增量的时间。
REMOTE OPERATION 远程操作
In order to access remote files, rdiff-backup opens up a pipe to a copyof rdiff-backup running on the remote machine. Thus rdiff-backup must be installed on both ends. To open this pipe, rdiff-backup first splits the filename into host_info::pathname. It then substitutes host_info into the remote schema, and runs the resulting command, reading its input and output.
为了访问远程文件,rdiff-backup打开了一个管道,指向远程计算机上运行的rdiff-backup副本。因此,必须在两端安装rdiff-backup。要打开此管道,rdiff-backup首先将文件名拆分为主机信息::路径名。然后,它将主机信息替换到远程模式中,并运行生成的命令,读取其输入和输出。
The default remote schema is 'ssh -C %s rdiff-backup --server' where host_info is substituted for '%s'. So if the host_info is user@host.net, then rdiff-backup runs 'ssh user@host.net rdiff-backup --server'. Using --remote-schema, rdiff-backup can invoke an arbitrary command in order to open up a remote pipe. For instance,
默认的远程架构是“ssh –C %s rdiff-backup --server”,其中'%s'替换为主机信息。如果主机信息是user@host.net,然后rdiff-backup运行'ssh user@host.net rdiff-backup --server。使用—remote-schema,rdiff-backup可以调用任意命令来打开远程管道。例如,
rdiff-backup --remote-schema 'cd /usr; %s' foo 'rdiff-backup --server'::bar
is basically equivalent to (but slower than)
基本上等同于(但慢于)
rdiff-backup foo /usr/bar
Concerning quoting, if for some reason you need to put two consecutive colons in the host_info section of a host_info::pathname argument, or in the pathname of a local file, you can quote one of them by prepending a backslash. So in 'a\::b::c', host_info is 'a::b' and the pathname is 'c'. Similarly, if you want to refer to a local file whose filename contains two consecutive colons, like 'strange::file', you'll have to quote one of the colons as in 'strange\::file'. Because the backslash is a quote character in these circumstances, it too must be quoted to get a literal backslash, so 'foo\::\\bar' evaluates to 'foo::\bar'. To make things more complicated, because the backslash is also a common shell quoting character, you may need to type in '\\\\' at the shell prompt to get a literal backslash (if it makes you feel better, I had to type in 8 backslashes to get that in this man page...). And finally, to include a literal % in the string specified by --remote-schema, quote it with another %, as in %%.
关于引用,如果出于某种原因,您需要在host_info::pathname参数的host_info部分或本地文件的路径名中放置两个连续冒号,则可以通过在反斜杠前加上一个冒号来引用其中一个冒号。所以在“a\::b::c”中,主机信息是“a::b”,路径名是“c”。类似地,如果要引用文件名包含两个连续冒号的本地文件,如“strange::file”,则必须引用其中一个冒号,如“strange\::file”。因为在这种情况下,反斜杠是引号字符,所以它也必须被引号括起来才能得到文字反斜杠,所以'foo\::\\bar'的计算结果为'foo::\bar'。为了使事情变得更复杂,因为反斜杠也是一个常用的shell引用字符,您可能需要在shell提示符处键入“\\\\”,以获得一个文本反斜杠(如果它让您感觉更好,我必须键入8个反斜杠才能在本手册页中获得它…)。最后,要在—remote-schema指定的字符串中包含一个文本%,请用另一个%引用它,如%%。
Although ssh itself may be secure, using rdiff-backup in the default way presents some security risks. For instance if the server is run as root, then an attacker who compromised the client could then use rdiff-backup to overwrite arbitrary server files by "backing up" over them. Such a setup can be made more secure by using the sshd configuration option command="rdiff-backup --server" possibly along with the --restrict* options to rdiff-backup. For more information, see the web page, the wiki, and the entries for the --restrict* options on this man page.
尽管ssh本身可能是安全的,但以默认方式使用rdiff-backup会带来一些安全风险。例如,如果服务器以root用户身份运行,那么危害客户端的攻击者可以使用rdiff-backup通过“备份”任意服务器文件来覆盖这些文件。使用sshd配置选项command=“rdiff-backup --server”可以使这样的设置更加安全,这可能与rdiff-backup的—restrict*选项一起使用。有关详细信息,请参见网页、wiki和此手册页上--restrict*选项的条目。
FILE SELECTION 文件选择
rdiff-backup has a number of file selection options. When rdiff-backup is run, it searches through the given source directory and backs up all the files matching the specified options. This selection system may appear complicated, but it is supposed to be flexible and easy-to-use. If you just want to learn the basics, first look at the selection exam-ples in the examples.html file included in the package, or on the web at http://rdiff-backup.nongnu.org/examples.html
rdiff backup有许多文件选择选项。运行rdiff backup时,它会搜索给定的源目录并备份与指定选项匹配的所有文件。这个选择系统可能看起来很复杂,但它应该是灵活和易于使用的。如果你只想学习基本知识,首先看看示例.html包中包含的文件,或在网站上http://rdiff-backup.nongnu.org/examples.html
rdiff-backup's selection system was originally inspired by rsync(1), but there are many differences. (For instance, trailing backslashes have no special significance.)
rdiff-backup的选择系统最初是受rsync(1)启发的,但有很多不同之处。(例如,后面的反斜杠没有特殊意义。)
The file selection system comprises a number of file selection condi-tions, which are set using one of the following command line options: --exclude, --exclude-filelist, --exclude-device-files, --exclude-fifos, --exclude-sockets, --exclude-symbolic-links, --exclude-globbing- filelist, --exclude-globbing-filelist-stdin, --exclude-filelist-stdin, --exclude-regexp, --exclude-special-files, --include, --include-filelist, --include-globbing-filelist, --include-globbing-filelist-stdin, --include-filelist-stdin, and --include-regexp. Each file selection condition either matches or doesn't match a given file. A given file is excluded by the file selection system exactly when the first matching file selection condition specifies that the file be excluded; otherwise the file is included. When backing up, if a file is excluded, rdiff-backup acts as if that file does not exist in the source directory. When restoring, an excluded file is considered not to exist in either the source or target directories.
文件选择系统包含许多文件选择条件,使用下边一个设置选项命令:--exclude, --exclude-filelist, --exclude-device-files, --exclude-fifos, --exclude-sockets, --exclude-symbolic-links, --exclude-globbing- filelist, --exclude-globbing-filelist-stdin, --exclude-filelist-stdin, --exclude-regexp, --exclude-special-files, --include, --include-filelist, --include-globbing-filelist, --include-globbing-filelist-stdin, --include-filelist-stdin, and --include-regexp. 每个文件选择条件要么匹配要么不匹配给定的文件。当第一个匹配的文件选择条件指定排除文件时,文件选择系统将完全排除给定的文件;否则将包括该文件。备份时,如果排除了某个文件,rdiff backup的作用就像源目录中不存在该文件一样。还原时,排除的文件被认为不存在于源目录或目标目录中。
USERS AND GROUPS用户和组
There can be complications preserving ownership across systems. For instance the username that owns a file on the source system may not exist on the destination. Here is how rdiff-backup maps ownership on the source to the destination (or vice-versa, in the case of restoring):
跨系统保留所有权可能会有一些复杂的问题。例如,在源系统上拥有文件的用户名在目标系统上可能不存在。以下是rdiff-backup如何将源上的所有权映射到目标(在还原的情况下,反之亦然):
1. If the --preserve-numerical-ids option is given, the remote files will always have the same uid and gid, both for ownership and ACL entries. This may cause unames and gnames to change.
如果指定了--preserve numerical ids选项,则远程文件的所有权和ACL条目将始终具有相同的uid和gid。这可能会导致unames和gnames发生变化。
2. Otherwise, attempt to preserve the user and group names for ownership and in ACLs. This may result in files having different uids and gids across systems.
否则,请尝试保留所有权和ACL中的用户名和组名。这可能导致跨系统的文件具有不同的uid和gid。
3. If a name cannot be preserved (e.g. because the username does not exist), preserve the original id, but only in cases of user and group ownership. For ACLs, omit any entry that has a bad user or group name.
如果无法保留名称(例如,因为用户名不存在),请保留原始id,但仅限于用户和组所有权的情况。对于acl,省略任何具有错误用户名或组名的条目。
4. The --user-mapping-file and --group-mapping-file options override this behavior. If either of these options is given, the policy described in 2 and 3 above will be followed, but with the mapped user and group instead of the original. If you specify both --preserve-numerical-ids and one of the mapping options, the behavior is undefined.
--user-mapping-file和—group-mapping-file选项将覆盖此行为。如果给定了这些选项中的任何一个,则将遵循上面2和3中描述的策略,但使用映射的用户和组而不是原始用户和组。如果同时指定—preserve-numerical-ids和一个映射选项,则行为未定义。
5. The user and group mapping files both have the same form:
用户和组映射文件的格式相同:
old_name_or_id1:new_name_or_id1
old_name_or_id2:new_name_or_id2
<etc>
Each line should contain a name or id, followed by a colon ":", followed by another name or id. If a name or id is not listed, they are treated in the default way described above.
每行应包含名称或id,后跟冒号“:”,后跟其他名称或id。如果未列出名称或id,则按上述默认方式处理。
When restoring, the above behavior is also followed, but note that the original source user/group information will be the input, not the already mapped user/group information present in the backup repository. For instance, suppose you have mapped all the files owned by alice in the source so that they are owned by ben in the repository, and now you want to restore, making sure the files owned originally by alice are still owned by alice. In this case there is no need to use any of the mapping options. However, if you wanted to restore the files so that the files originally owned by alice on the source are now owned by ben, you would have to use the mapping options, even though you just want the unames of the repository's files preserved in the restored files.
还原时,也会遵循上述行为,但请注意,原始源用户/组信息将是输入,而不是备份存储库中已映射的用户/组信息。例如,假设您已经映射了源中alice拥有的所有文件,以便它们在存储库中归ben所有,现在您要还原,确保alice最初拥有的文件仍然归alice所有。在这种情况下,不需要使用任何映射选项。但是,如果要还原文件,以便alice在源上最初拥有的文件现在归ben所有,则必须使用映射选项,即使您只希望存储库文件的uname保留在还原的文件中。
STATISTICS 统计数据
Every session rdiff-backup saves various statistics into two files, the session statistics file at rdiff-backup-data/session_statistics.<time>.data and the directory statistics file at rdiff-backup-data/directory_statistics.<time>.data. They are both text files and contain similar information: how many files changed, how many were deleted, the total size of increment files created, etc. However, the session statistics file is intended to be very readable and only describes the session as a whole. The directory statistics file is more compact (and slightly less readable) but describes every directory backed up. It also may be compressed to save space.
每个会话rdiff-backup都将各种统计信息保存到两个文件中,分别是rdiff-backup-data/session-statistics.<time>.data会话统计信息文件和rdiff-backup-data/directory-statistics.<time>.data目录统计信息文件。它们都是文本文件,包含类似的信息:更改了多少文件、删除了多少文件、创建的增量文件的总大小等。但是,会话统计文件的可读性很强,只描述整个会话。目录统计文件更紧凑(可读性稍差),但描述了备份的每个目录。它也可以压缩以节省空间。
Statistics-related options include --print-statistics and --null-sepa-rator.
统计相关选项包括—print-statistics和—null-sepa-rator。
Also, rdiff-backup will save various messages to the log file, which is rdiff-backup-data/backup.log for backup sessions and rdiff-backup-data/restore.log for restore sessions. Generally what is written to this file will coincide with the messages displayed to stdout or stderr, although this can be changed with the --terminal-verbosity option.
此外,rdiff-backup会将各种消息保存到日志文件中,即rdiff-backup-data/backup.log用于备份会话和rdiff-backup-data/restore.log用于还原会话。通常,写入该文件的内容将与显示给stdout或stderr的消息一致,尽管可以使用—terminal-verbosity选项来更改。
The log file is not compressed and can become quite large if rdiff-backup is run with high verbosity.
如果rdiff-backup以高详细度运行,则日志文件不会压缩,并且可能会变得很大。
EXIT STATUS 退出状态
If rdiff-backup finishes successfully, the exit status will be 0. If there is an unrecoverable (critical) error, it will be non-zero (usually 1, but don't depend on this specific value). When setting up rdiff-backup to run automatically (as from cron(8) or similar) it is probably a good idea to check the exit code.
如果rdiff-backup成功完成,退出状态将为0。如果有一个不可恢复(严重)的错误,它将是非零的(通常是1,但不依赖于这个特定的值)。将rdiff-backup设置为自动运行(从cron(8)或类似版本)时,最好检查退出代码。
BUGS
The gzip library in versions 2.2 and earlier of python (but fixed in 2.3a1) has trouble producing files over 2GB in length. This bug will prevent rdiff-backup from producing large compressed increments (snapshots or diffs). A workaround is to disable compression for large uncompressable files.
python版本2.2及更早版本中的gzip库(在2.3a1中已修复)在生成长度超过2GB的文件时遇到问题。此错误将阻止rdiff备份产生大的压缩增量(快照或差异)。解决方法是对大型不可压缩文件禁用压缩。
AUTHOR 作者
Ben Escoto <ben@emerose.org>
Feel free to ask me questions or send me bug reports, but you may wantto see the web page, mentioned below, first.
请随时向我提问或向我发送错误报告,但您可能希望首先看到下面提到的网页。
SEE ALSO 另见
python(1), rdiff(1), rsync(1), ssh(1). The main rdiff-backup web page is at http://rdiff-backup.nongnu.org/. It has more information, links to the mailing list and CVS, etc.
python(1)、rdiff(1)、rsync(1)、ssh(1)。主rdiff-backup网页位于http://rdiff backup.nongu.org/。它有更多的信息,链接到邮件列表和简历等。