Fri 19 Jun 2009 09:30:56 PM UTC, original submission:
The following series of commands will result in a "Hash for f3 missing, cannot check" error during the last restore command (using rdiff-backup 1.2.8):
#!/bin/bash
# Create a directory with 2 hardlinked files and back it up:
mkdir d1
touch d1/f1
link d1/f1 d1/f3
rdiff-backup d1 d2
# Now add a 3rd hardlinked file (but don't name it
# to be the first of the 3) and back up again:
link d1/f1 d1/f2
sleep 1
rdiff-backup d1 d2
# The following restore generates an error:
rdiff-backup -r now d2 d3
Furthermore, the metadata file for the second backup looks like this (note the discrepancy for 'NumHardLinks'):
File .
Type dir
ModTime 1245442871
Uid 0
Uname root
Gid 0
Gname root
Permissions 493
File f1
Type reg
Size 0
NumHardLinks 2
Inode 79457
DeviceLoc 64775
SHA1Digest da39a3ee5e6b4b0d3255bfef95601890afd80709
ModTime 1245442871
Uid 0
Uname root
Gid 0
Gname root
Permissions 420
File f2
Type reg
Size 0
NumHardLinks 3
Inode 79457
DeviceLoc 64775
ModTime 1245442871
Uid 0
Uname root
Gid 0
Gname root
Permissions 420
File f3
Type reg
Size 0
NumHardLinks 2
Inode 79457
DeviceLoc 64775
ModTime 1245442871
Uid 0
Uname root
Gid 0
Gname root
Permissions 420
Furthermore, the restored files are linked differently from the original files:
# ls -li d[13]/
d1:
total 12
79457 -rw-r--r-- 3 root root 0 Jun 19 16:21 f1
79457 -rw-r--r-- 3 root root 0 Jun 19 16:21 f2
79457 -rw-r--r-- 3 root root 0 Jun 19 16:21 f3
d3:
total 12
79492 -rw-r--r-- 2 root root 0 Jun 19 16:21 f1
79492 -rw-r--r-- 2 root root 0 Jun 19 16:21 f2
79493 -rw-r--r-- 1 root root 0 Jun 19 16:21 f3
#
I've attached a file to this bug report which contains a possible patch for Hardlink.py that seems to fix this bug for me.
A real life example (on a CentOS-4 system) of this bug occurs if you have a few kernel-devel RPMs installed (for different kernels) and you back up the system, then you install another kernel-devel RPM for a newer kernel and you back up the system again, then you try to restore the most recent backup. The restore will generate numerous (4,495 in my case) "Hash for foo missing, cannot check" errors. The reason is because the kernel-devel RPM has a post-install script like this:
cd /usr/src/kernels/2.6.9-78.0.22.EL-i686
find . -type f | while read f; do hardlink -c /usr/src/kernels/*/$f $f ; done
As noted in the man page for hardlink:
"hardlink traverses one or more directories searching for duplicate files. When it finds duplicate files, it uses one of them as the master. It then removes all other duplicates and places a hardlink for each one pointing to the master file. This allows for conservation of disk space where multiple directories on a single filesystem contain many duplicate files."
So the hardlink command is adding new hardlinks to files that were already hardlinked, which triggers the bug in rdiff-backup.
|