5
忽略 rsync 的文件属性同步错误
source link: https://zhiqiang.org/coding/ignore-rsync-files-attrs-error.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
忽略 rsync 的文件属性同步错误
在一个rsync
命令同步文件夹时:
rsync -avz --progress /data/2023 sz55:/data/
出现错误提示:
sending incremental file list
rsync: chgrp "/data/2023" failed: Operation not permitted (1)
rsync: failed to set times on "/data/2023": Operation not permitted (1)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3]
如果我们查看文件列表,会发现文件已经正常同步了。只是提示运行chgrp
错误以及failed to set times
的错误。
该问题出现在文件和文件夹的所有者不是当前用户,而读写权限由额外的setfacl
规则来提供的时候。
为避免提示类似的错误,我们可以使用下面的命令:
rsync -avz --omit-dir-times --no-perms --no-group --no-owner --progress /data/2023 sz55:/data/
涉及到的rsync
的参数:
--no-perms
:不同步文件权限信息。--no-group
:不同步文件分组信息。--no-group
:不同步文件所有者信息。--omit-dir-times
:忽略同步目录的时间撮。
Q. E. D.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK