大网数据广告活动
服务器运维问答

Rsync tasks: prioritize link-dest over file transfer

· 52CE 我爱测

I have a command which looks like this: rsync -avp -e ssh /folder user@server:/backups/2 --link-dest=../1 Folder number increases every day. This command runs every night, over my very very slow internet connection. If it did not…

问题原文

原帖链接 · Joel'-' · CC BY-SA 4.0

I have a command which looks like this:

rsync -avp -e ssh /folder user@server:/backups/2 --link-dest=../1 Folder number increases every day.

This command runs every night, over my very very slow internet connection. If it did not complete during the night, the process will be killed because otherwise my connection is unusable during the day. This would work fine, if Rsync starts with creating hard-links, and then does the data-transfer.

Unfortunately, it looks like Rsync performs its tasks on alphabetical order. So sometimes it starts with transferring data and then afterwards it will create its hard links.

If the process does not complete overnight, it needs to upload even more data the next night, because the hardlinks were not created in folder 2!

Is there a way to make Rsync create the hard links first and then do the filetransfers?

Thanks a lot!

已采纳解答

原帖链接 · Joel'-' · CC BY-SA 4.0

The answer is to add --delay-updates. This causes Rsync to build a list of all changes first. The target will then create all the hard links and create all folders. After that, the datatransfer will start.

rsync -avp --delay-updates -e ssh /folder user@server:/backups/2 --link-dest=../1

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-05-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。