当时间戳每次都不同时,如何使用 rsnapshot 备份 SVN 存储库?

发布于 2024-08-21 05:42:34 字数 429 浏览 3 评论 0原文

我想要使​​用 rsnapshot 备份 Linux 计算机上的本地磁盘 SVN 存储库。我知道我不能只是将其备份到文件系统上,因此在每个快照之前我都会使用“svnadmin hotcopy”制作一个副本。但是,每次我进行热复制时,生成的文件都具有当前时间戳,而不是与原始文件相同的时间戳。这意味着我失去了 rsnapshot 提供的写时复制式磁盘空间节省功能。

我想到的一种解决方案是让一个脚本查看热拷贝 ($DEST) 中的所有文件,并为每个文件 x,根据文件 $SOURCE/x 设置时间戳。我不知道是否有办法让 rsync 在 Linux 上执行此操作(我知道您可以在 Windows 上的 Robocopy 中执行此操作:) 我确信它可以通过 find 和 touch 完成。

欢迎提出如何执行此操作或其他解决方案的建议。我不想使用增量 svn 转储,因为我希望每个时间点快照都是当时存储库的完整副本。

I want to have rsnapshot backup a local on-disk SVN repository on a Linux machine. I know I can't just back it up off the file system, so before each snapshot I am making a copy with 'svnadmin hotcopy'. However, every time I do a hotcopy, the resulting files all have a current timestamp, rather than the same timestamp as the original file. This means I lose the ability to do the copy-on-write-esque disk space saving that rsnapshot gives.

One solution I have thought of is to have a script look at all the files in the hotcopy ($DEST) and for each file x, set the timestamp based on the file $SOURCE/x. I don't know if there is a way to make rsync do this on Linux (I know you can do it in Robocopy on Windows :) I'm sure it can be done with find and touch however.

Suggestions how to do this, or other solutions, welcomed. I'd rather not use incremental svn dumps, as I want each point-in-time snapshot to be a full copy of the repository at that time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

卷耳 2024-08-28 05:42:34

事实证明,更改所有文件上的时间戳并不那么困难:

cd /var/local/backup/svn
find . -exec touch -r /data/src/svn/\{\} \{\} \;

这将确保热复制备份中存在的文件上的时间戳与其父级具有相同的时间戳,这意味着只有在更新原始文件时才应更新它们。

Turns out changing the timestamps on all the files wasn't that difficult:

cd /var/local/backup/svn
find . -exec touch -r /data/src/svn/\{\} \{\} \;

This will ensure that the timestamps on files that exist in the hot-copy backup have the same timestamp as their parent, meaning they should only be updated when you update the original.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文