From 0721cb1ede4bc538ccf08d1bacd6ebd4b062a596 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 27 Feb 2017 15:30:55 +0100 Subject: [PATCH] files cache: update inode number, fixes #2226 --- src/borg/cache.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/borg/cache.py b/src/borg/cache.py index f1a8ef85e..a17a5343e 100644 --- a/src/borg/cache.py +++ b/src/borg/cache.py @@ -575,7 +575,15 @@ Chunk index: {0.total_unique_chunks:20d} {0.total_chunks:20d}""" entry = FileCacheEntry(*msgpack.unpackb(entry)) if (entry.size == st.st_size and entry.mtime == st.st_mtime_ns and (ignore_inode or entry.inode == st.st_ino)): - self.files[path_hash] = msgpack.packb(entry._replace(age=0)) + # we ignored the inode number in the comparison above or it is still same. + # if it is still the same, replacing it in the tuple doesn't change it. + # if we ignored it, a reason for doing that is that files were moved to a new + # disk / new fs (so a one-time change of inode number is expected) and we wanted + # to avoid everything getting chunked again. to be able to re-enable the inode + # number comparison in a future backup run (and avoid chunking everything + # again at that time), we need to update the inode number in the cache with what + # we see in the filesystem. + self.files[path_hash] = msgpack.packb(entry._replace(inode=st.st_ino, age=0)) return entry.chunk_ids else: return None