备份正在使用的文件时出现 Backup2l 错误。

备份正在使用的文件时出现 Backup2l 错误。

我已设置 backup2l 来 rsync 备份。但我发现如果在备份过程中文件正在使用,则会产生错误。

这是我收到的电子邮件:

/etc/cron.daily/zz-backup2l:
backup2l v1.5 by Gundolf Kiefer

Sun Sep 25 03:20:50 BST 2011

Running pre-backup procedure...
  writing dpkg selections to /root/.dpkg-selections.log...
 dumping databases

Removing old backups...

Preparing differential level-2 backup <all.104> based on <all.103>...
  145008 / 145008 file(s), 12432 / 12432 dir(s), 10.3GB / 10.3GB (uncompressed)
  skipping: 175 file(s), 0 dir(s), 735KB (uncompressed)

Creating archive using 'DRIVER_TAR_BZ2'...
  tar: Removing leading `/' from hard link targets
  tar: /var/vmail/vmail01/example.com/b/ba/bar/barry-2010.12.11.10.28.01/Maildir/dovecot.index.log.2: Cannot stat: No such file or directory
  tar: Exiting with failure status due to previous errors
Checking TOC of archive file (< real file, > archive entry)...
  47299d47298
  < /var/vmail/vmail01/example.com/b/ba/bar/barry-2010.12.11.10.28.01/Maildir/dovecot.index.log.2
  96928c96927
Creating check file for <all.104>...

Running post-backup procedure...

Sun Sep 25 09:26:49 BST 2011


Summary
=======

Backup       Date       Time  |  Size   | Skipped  Files+D |  New  Obs. | Err.
------------------------------------------------------------------------------
all.1        2011-09-21 02:26 |    7.3G |     198   161103 |161103     0 |    5
all.101      2011-09-22 02:25 |   51.4M |     192   161788 | 2270  1585 |    0
all.102      2011-09-23 02:25 |   46.6M |     213   162460 | 1610   938 |    0
all.103      2011-09-24 02:25 |   58.6M |     188   156809 | 2450  8101 |    0
all.104      2011-09-25 03:23 |    7.4G |     175   157440 |157440 156809 |    2

Filesystem            Size  Used Avail Use% Mounted on
/dev/vda               40G   30G  8.4G  78% /

Backup2l 配置

##################################################
# Configuration file for backup2l                #
##################################################


# Define the backup2l version for which the configuration file is written.
# This way, future versions can automatically warn if the syntax has changed.
FOR_VERSION=1.4


##################################################
# Volume identification

# This is the prefix for all output files;
# multiple volumes can be handled by using different configuration files
VOLNAME="all"



##################################################
# Source files

# List of directories to make backups of.
# All paths MUST be absolute and start with a '/'!
# SRCLIST=(/etc /root /home /var/mail /usr/local)
SRCLIST=(/etc /root /home /var/vmail /var/www /var/svn /usr/local /var/backups/mysql /var/backups/ldap)

# The following expression specifies the files not to be archived.
# See the find(1) man page for further info. It is discouraged to
# use anything different from conditions (e. g. actions) as it may have
# unforeseeable side effects.

# This example skips all files and directories with a path name containing
# '.nobackup' and all .o files:
#SKIPCOND=(-path "*.nobackup*" -o -name "*.o")
SKIPCOND=(-path "*.nobackup*" -o -name "*.o" -name "*~" -o -name "cache.*" -o -path "*/tmp/captchas/*")

# If you want to exclude several directories use the following expression:
# SKIPCOND=(-path '/path1' -o -path '/path1/*' -o -path '/path2' -o -path '/path2/*')

# NOTE: If you do not have anything to skip, use:
# SKIPCOND=(-false)     # "SKIPCOND=()" does not work



##################################################
# Destination

# Mount point of backup device (optional)
#BACKUP_DEV="/disk2"

# Destination directory for backups;
# it must exist and must not be the top-level of BACKUP_DEV
BACKUP_DIR="/var/backups/localhost"



##################################################
# Backup parameters

# Number of levels of differential backups (1..9)
MAX_LEVEL=2

# Maximum number of differential backups per level (1..9)
MAX_PER_LEVEL=7

# Maximum number of full backups (1..8)
#MAX_FULL=2
MAX_FULL=1

# For differential backups: number of generations to keep per level;
# old backups are removed such that at least GENERATIONS * MAX_PER_LEVEL
# recent versions are still available for the respective level
GENERATIONS=1

# If the following variable is 1, a check file is automatically generated
CREATE_CHECK_FILE=1

答案1

是的,这个错误信息 (a) 是故意的,并且 (b) 也经常发生在我身上。

此错误完全是由于 backup2l 的操作方式造成的:列出要备份的文件,备份它们,然后检查备份中包含哪些文件。由于备份过程需要一些时间,因此您经常会得到一些在此过程中发生更改的文件,因此会出现备份错误。您肯定想了解这些文件,因为备份失败通常是一件很严重的事[1]。

因此,我的建议是在一天中不太忙的时候进行备份。您将收到来自备份 cronjob 的邮件,无论如何您都应该仔细阅读它。有时您会遇到这些错误,但它们对备份来说并不致命。只要确保它不是每天都是同一个文件即可。

[1] 这里有一个小故事:有一段时间,我们认为将主数据分区作为回送挂载文件放在大学存储上进行备份是一个好主意。结果就是数据分区文件(约 1 TB)每晚被发送到备份服务器,这需要几个小时,然后检查是否有更改,如果有更改,则将其丢弃。几个月来实际上没有进行过备份。这是一个重大的失误,从那天起,我们确保与所有相关人员交谈,以确保备份确实进行了并且可以恢复。

相关内容