Disk-Usage

rdiff-backup 需要太多空間來從以前的備份失敗中恢復?

  • April 22, 2020

我在這個文件系統上有很多可用空間(和 inode),但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

您需要禁用 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 文件中的 tempfile.tempdir 條目。所需的可用空間量可能會有所不同,但通常大約是要恢復的最大文件的大小。

https://www.nongnu.org/rdiff-backup/FAQ.html

引用自:https://unix.stackexchange.com/questions/485747