我试图从OS X(10.11)同步一个目录树到Ubuntu 14.04。 虽然大多数文件传输得很好,但名称以_ (下划线)开头的文件不会。
这里是我使用的命令:
rsync -rtvh --progress ~/Pictures/processed/ ~/mnt/processed/
并输出的一个例子:
sending incremental file list _MG_7425.jpg 4.66M 100% 169.79MB/s 0:00:00 (xfr#1, to-chk=58/60) _MG_7427.jpg 6.59M 100% 103.07MB/s 0:00:00 (xfr#2, to-chk=57/60) ... rsync: mkstemp "/Users/user/mnt/processed/._MG_7425.jpg.0cAYb3" failed: No such file or directory (2) rsync: mkstemp "/Users/user/mnt/processed/._MG_7427.jpg.5Gw1vD" failed: No such file or directory (2) sent 306.24M bytes received 9.46K bytes 122.50M bytes/sec total size is 306.17M speedup is 1.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1249) [sender=3.1.2]
我的rsync是从自制软件安装的,版本信息:
rsync version 3.1.2 protocol version 31 Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others. Web site: http://rsync.samba.org/ Capabilities: 64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints, socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace, append, ACLs, xattrs, iconv, symtimes, no prealloc, file-flags
远程位置使用sshfs挂载:
sshfs -o idmap=user username@hostname:/some/path ~/mnt -o auto_cache,reconnect,defer_permissions,noappledouble
使用cp命令复制其中一个跳过的文件成功。 我尝试添加--iconv=utf-8-mac,utf-8和--iconv=utf-8-mac,utf-8 --include '_*'选项,这些选项没有任何作用。
我究竟做错了什么?
事实certificate,罪魁祸首是在sshfs标志。 我用来摆脱.DS_Store文件的noappledouble标志实际上是干扰了rsync的工作。
从sshfs Mount选项文档:
noappledouble
此选项使osxfuse拒绝对Apple Double(
._)文件和.DS_Store文件的所有types的访问。 任何现有的文件将显然不存在。 符合条件的新文件将被禁止创build。
正如它指出的那样,该选项也与._名称前缀有关,这正是rsync用于临时文件的原因:
rsync: mkstemp "/Users/user/mnt/processed/._MG_7425.jpg.0cAYb3" failed: No such file or directory (2)
因此,当mkstemp创build临时文件时, sshfs干扰并阻止它的创build。
从sshfs装载命令中删除noappledouble选项修复了问题,并且_*文件已经被正确地传送。
感谢@Halfgaar指引我朝着正确的方向发展。