Linux 使用 rsync 进行增量备份的脚本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8523147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 03:40:29  来源:igfitidea点击:

Script to do incremental backups with rsync

linuxbash

提问by CrazyHorse

Could someone help me with a bash script in linux to make backups. would have to do a full backup every week and every day an incremental.

有人可以帮助我在 linux 中使用 bash 脚本进行备份。必须每周做一次完整备份,每天做一次增量备份。

采纳答案by dstromberg

Feel free to use or borrow ideas from Backup.rsync here.

在这里随意使用或借用 Backup.rsync 的想法。

I actually used to do rsync backups via Backup.rsync, but I've since switched to my backshiftprogram because it deduplicates better (no more O(length^2) storage requirement for large, slow-growing files), and compresses the chunks with xz. If you look it over, you'll likely see that it's inspired by rsync --link-dest.

我实际上曾经通过 Backup.rsync 进行 rsync 备份,但我已经切换到我的backshift程序,因为它可以更好地进行重复数据删除(对于大型、缓慢增长的文件不再有 O(length^2) 存储要求),并压缩块与 xz。如果您仔细查看,您可能会发现它的灵感来自 rsync --link-dest。

回答by Zsolt Botykai

I'd recommend rdiff-backup, available on popular distros, and is very capable.

我推荐rdiff-backup,在流行的发行版上可用,并且非常有能力

It has a Windows build as well!

它也有 Windows 版本!

回答by SiegeX

I've been using rsnapshotfor over four years to keep a rotation of 7 daily, 4 weekly, and 12 monthly snapshots of my Slackware Box. Because it intelligently uses hardlinks, all 23 of these snapshots only take about 30% more space than the entire size of my filesystem.

四年多来,我一直在使用rsnapshot来保持我的 Slackware Box 每天 7 次、每周 4 次和每月 12 次的轮换快照。因为它智能地使用了硬链接,所以所有这 23 个快照仅比我的文件系统的整个大小多占用大约 30% 的空间。

回答by HighKing

You could use the --link-dest switch of rsync to create incrementals. Simply do one full rsync and do a incremental with --link-dest=<path_to_full>.

您可以使用 rsync 的 --link-dest 开关来创建增量。只需执行一次完整的 rsync 并使用 --link-dest=<path_to_full> 执行增量操作。