rdiff-backup 需要太多空间才能从先前备份的失败中恢复?

rdiff-backup 需要太多空间才能从先前备份的失败中恢复?

我在这个文件系统上有相当多的可用空间(和索引节点),但rdiff-backup显然空间不足。因此我的备份目前不起作用:-(。为什么?

(我想知道将来我应该为此保留多少空间!)

我的 rdiff-backup 是 version 1.2.8-7。我的操作系统是 Debian 9“stretch”。

# df -h /d/backup
Filesystem                      Size  Used Avail Use% Mounted on
/dev/mapper/vg_brick-lv_backup  139G   95G   38G  72% /d/backup

# df -i /d/backup
Filesystem                      Inodes  IUsed   IFree IUse% Mounted on
/dev/mapper/vg_brick-lv_backup 9240576 413341 8827235    5% /d/backup

# df -h
Filesystem                      Size  Used Avail Use% Mounted on
udev                            244M     0  244M   0% /dev
tmpfs                            51M  1.9M   49M   4% /run
/dev/sda7                        15G  4.1G  9.8G  30% /
tmpfs                           251M     0  251M   0% /dev/shm
tmpfs                           5.0M     0  5.0M   0% /run/lock
tmpfs                           251M     0  251M   0% /sys/fs/cgroup
/dev/ubi0_0                     462M  225M  233M  50% /d/ubi
tmpfs                           251M  4.0K  251M   1% /tmp
/dev/mapper/vg_brick-lv_attic    44G   21G   21G  50% /d/attic
/dev/mapper/vg_brick-lv_backup  139G   95G   38G  72% /d/backup
/dev/sda6                       2.0G   81M  1.8G   5% /boot
/dev/mapper/vg_brick-lv_home    134G   91G   37G  71% /home
/dev/sda10                      9.8G  2.9G  6.9G  30% /d/xfer
tmpfs                            51M     0   51M   0% /run/user/1003

root@brick:/d/backup/jenkins-desktop# du -sh mike
5.7G    mike
root@brick:/d/backup/jenkins-desktop# du -sh ../jenkins-desktop.rdiff/mike
8.2G    ../jenkins-desktop.rdiff/mike

root@brick:/d/backup/jenkins-desktop# rdiff-backup mike ../jenkins-desktop.rdiff/mike
Previous backup seems to have failed, regressing destination now.                                                                                     
Exception '[Errno 28] No space left on device' raised of class '<type 'exceptions.IOError'>':                                                         
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/robust.py", line 32, in check_common_error                                                      
    try: return function(*args)                                                                                                                       
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/restore.py", line 468, in get_fp                                                                
    Rdiff.write_patched_fp(current_fp, delta_fp, new_fp)                                                                                              
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Rdiff.py", line 73, in write_patched_fp                                                         
    rpath.copyfileobj(librsync.PatchedFile(basis_fp, delta_fp), out_fp)                                                                               
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/rpath.py", line 64, in copyfileobj                                                              
    outputfp.write(inbuf)

Exception '[Errno 28] No space left on device' raised of class '<type 'exceptions.IOError'>':                                                         
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 304, in error_check_Main                                                         
    try: Main(arglist)                                                                                                                                
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 324, in Main
    take_action(rps)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 280, in take_action
    elif action == "backup": Backup(rps[0], rps[1])
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 337, in Backup
    backup_final_init(rpout)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 501, in backup_final_init
    checkdest_if_necessary(rpout)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 920, in checkdest_if_necessary
    dest_rp.conn.regress.Regress(dest_rp)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/regress.py", line 71, in Regress
    for rf in iterate_meta_rfs(mirror_rp, inc_rpath): ITR(rf.index, rf)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/rorpiter.py", line 281, in __call__
    last_branch.fast_process(*args)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/regress.py", line 268, in fast_process
    if rf.metadata_rorp.isreg(): self.restore_orig_regfile(rf)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/regress.py", line 290, in restore_orig_regfile
    tf.write_from_fileobj(rf.get_restore_fp())
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/restore.py", line 488, in get_restore_fp
    return robust.check_common_error(error_handler, get_fp)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/robust.py", line 32, in check_common_error
    try: return function(*args)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/restore.py", line 468, in get_fp
    Rdiff.write_patched_fp(current_fp, delta_fp, new_fp)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Rdiff.py", line 73, in write_patched_fp
    rpath.copyfileobj(librsync.PatchedFile(basis_fp, delta_fp), out_fp)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/rpath.py", line 64, in copyfileobj
    outputfp.write(inbuf)

Traceback (most recent call last):                                                                                                                    
  File "/usr/bin/rdiff-backup", line 30, in <module>                                                                                                  
    rdiff_backup.Main.error_check_Main(sys.argv[1:])                                                                                                  
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 304, in error_check_Main    
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 324, in Main
    take_action(rps)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 280, in take_action
    elif action == "backup": Backup(rps[0], rps[1])
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 337, in Backup
    backup_final_init(rpout)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 501, in backup_final_init
    checkdest_if_necessary(rpout)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Main.py", line 920, in checkdest_if_necessary
    dest_rp.conn.regress.Regress(dest_rp)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/regress.py", line 71, in Regress
    for rf in iterate_meta_rfs(mirror_rp, inc_rpath): ITR(rf.index, rf)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/rorpiter.py", line 281, in __call__
    last_branch.fast_process(*args)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/regress.py", line 268, in fast_process
    if rf.metadata_rorp.isreg(): self.restore_orig_regfile(rf)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/regress.py", line 290, in restore_orig_regfile
    tf.write_from_fileobj(rf.get_restore_fp())
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/restore.py", line 488, in get_restore_fp
    return robust.check_common_error(error_handler, get_fp)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/robust.py", line 32, in check_common_error
    try: return function(*args)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/restore.py", line 468, in get_fp
    Rdiff.write_patched_fp(current_fp, delta_fp, new_fp)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/Rdiff.py", line 73, in write_patched_fp
    rpath.copyfileobj(librsync.PatchedFile(basis_fp, delta_fp), out_fp)
  File "/usr/lib/python2.7/dist-packages/rdiff_backup/rpath.py", line 64, in copyfileobj
    outputfp.write(inbuf)
IOError: [Errno 28] No space left on device

答案1

您需要禁用 tmpfs on /tmp,或配置rdiff-backup为使用其他有足够空间的临时目录。可能/var/tmp

tmpfs                           251M  4.0K  251M   1% /tmp

恢复或回归时,rdiff-backup 需要默认临时目录中的可用空间。在 unix 系统下,这通常是 /tmp 目录。 rdiff-backup 使用的临时目录可以使用 1.1.13 及更高版本中提供的 --tempdir 和 --remote-tempdir 选项进行设置。有关默认临时目录的更多信息,请参阅 Python 临时文件文档中的 tempfile.tempdir 条目。所需的可用空间量可能有所不同,但通常约为要恢复的最大文件的大小。

-- rdiff-备份常见问题解答:rdiff-backup 在哪里需要可用空间以及需要多少空间?当 rdiff-backup 提示“ValueError:生成的数据长度不正确”时,是什么问题?

答案2

我不确定这是否是OP的情况,但就我而言,我截断了我正在备份的主机上的96Gb mssql“备份”文件(我发现mssql备份是追加使其无限增长;见这个答案了解详情)。

当我的 rdiff-backup master 尝试备份我的 mssql“备份”文件的新的截断版本时,它首先在其 /tmp 目录中生成该文件的先前 96Gb 版本。我假设 rdiff-backup 这样做是为了对文件执行“diff”操作。但在生成这个巨大的先前版本的过程中,主 rdiff 备份进程耗尽了 /tmp 中的空间,导致结果如本问题所示。

一旦我理解了这个问题,我就按照标题为 rdiff FAQ 项目中的步骤进行操作由于某种原因,rdiff-backup 在备份时失败。现在每次运行时都会显示“正在回归目的地”,然后再次失败。我应该怎么办?禁用回归。因此,我假设 rdiff-backup “放弃”比较文件,而是依赖目录信息。结果,我的 rdiff-backup master 不再消耗其所有 /tmp 空间,并且我的备份成功了。

答案3

我已经使用 rdiff-backup 多年了,我绝对相信它,但如果其他方法都失败了,rsync -av (source dir) (dest dir)还有一个替代方案。

重要编辑:也就是说,如果您可以使用另一个(目标目录)或驱动器,否则可能会对您的 rdiff 备份历史文件造成严重破坏。谢谢@sourcejedi

相关内容