rsync:如何忽略被锁定的远程文件 - 设备或资源繁忙(16)

rsync: how to ignore remote file that is locked - Device or resource busy (16)

我正在使用 rsync 复制文件,并使用 --delete。 rsync 正在尝试删除 .nfs 文件,但失败如下:

rsync: delete_file: unlink(/path/.nfs0000083729d3947392020000099) failed: Device or resource busy (16)

这是预料之中的,因为 rsync 不应尝试删除 nfs 文件。但是如何让rsync忽略这个文件呢?

我的 rsync 命令是

sync -avzq -e 'ssh -i /ssh/key' origin_dir myuser@myhost:/destination_dir --delete

将以下内容添加到命令行:

 --filter '-_.nfs*'

实际上,我包含 -C 也是为了忽略一些在目标位置无用的文件:

-C --filter '-_.nfs*

上面的选项在...我应该开始的地方...手册页中有描述! https://linux.die.net/man/1/rsync