反向增量备份策略——好主意还是坏主意?
2 分•作者: datastack•7 个月前
我最近想出了一个备份策略,它看起来非常简单,我猜想它肯定已经存在了——但我还没有在任何主流工具中看到它。
这个想法是:
最新的备份(带时间戳)始终包含当前源状态的完整副本。
任何先前的备份都存储为增量:与下一个(较新)版本相比,已删除或修改的文件。
没有版本号——只有时间戳。可以自然地插入新版本。
每次备份时:
1. 将当前源与最新备份进行比较。
2. 对于已更改或已删除的文件:将它们移动到新的增量文件夹(带时间戳)。
3. 对于新/更改的文件:仅在需要时将它们复制到最新的快照文件夹中。
4. 可选地轮换旧的增量以保持历史记录的可管理性。
这意味着:
最新的备份始终是可用的完整快照(快速恢复)。
可以通过应用反向增量来重建以前的版本。
如果源完好无损,系统会自我修复:损坏的备份将在下次运行时被替换。
只需要一个完整副本,就像一个版本化的 rsync 镜像。
随着时间的推移,丢失旧版本的影响很小。
它对用户友好,因为可以使用常规的文件资源管理器浏览最新的备份。
示例:
初始备份:
latest/
a.txt # "Hello"
b.txt # "World"
第二天,a.txt 被更改,b.txt 被删除:
latest/
a.txt # "Hi"
backup-2024-06-27T14:00:00/
a.txt # "Hello"
b.txt # "World"
最新版本始终在 latest/ 中,可以通过反向应用增量来重建以前的版本。
我很好奇:这之前是否以其他名称完成过?我是否忽略了使其在实际工具中不切实际的边缘情况?
很想听听你的想法。
查看原文
I recently came up with a backup strategy that seems so simple I assume it must already exist — but I haven’t seen it in any mainstream tools.<p>The idea is:<p>The latest backup (timestamped) always contains a full copy of the current source state.<p>Any previous backups are stored as deltas: files that were deleted or modified compared to the next (newer) version.<p>There are no version numbers — just timestamps. New versions can be inserted naturally.<p>Each time you back up:<p>1. Compare the current source with the latest backup.<p>2. For files that changed or were deleted: move them into a new delta folder (timestamped).<p>3. For new/changed files: copy them into the latest snapshot folder (only as needed).<p>4. Optionally rotate old deltas to keep history manageable.<p>This means:<p>The latest backup is always a usable full snapshot (fast restore).<p>Previous versions can be reconstructed by applying reverse deltas.<p>If the source is intact, the system self-heals: corrupted backups are replaced on the next run.<p>Only one full copy is needed, like a versioned rsync mirror.<p>As time goes by, losing old versions is low-impact.<p>It's user friendly since the latest backup can be browsed through with regular file explorers.<p>Example:<p>Initial backup:<p>latest/
a.txt # "Hello"
b.txt # "World"<p>Next day, a.txt is changed and b.txt is deleted:<p>latest/
a.txt # "Hi"
backup-2024-06-27T14:00:00/
a.txt # "Hello"
b.txt # "World"<p>The newest version is always in latest/, and previous versions can be reconstructed by applying the deltas in reverse.<p>I'm curious: has this been done before under another name? Are there edge cases I’m overlooking that make it impractical in real-world tools?<p>Would love your thoughts.