rsync error seen while copying a file from remote host to cifs share
- Red Hat Enterprise Linux 6
- rsync error is reported when copying a file from a remote host to cifs share
rsync: rename "/mnt/cifs/doug/test/.test:one.Zz0cOw" -> "test/test:one": Invalid argument (22)
- CIFS is not able to access files with special characters in the file name.
- The 'mapchars' option can be used to map special characters.
- More information is available in the man page of mount.cifs:
mapchars Translate six of the seven reserved characters (not backslash, but including the colon,question mark, pipe, asterik, greater than and less than characters) to the remap range (above 0xF000), which also allows the CIFS client to recognize files created with such characters by Windows´s POSIX emulation. This can also be useful when mounting to most versions of Samba (which also forbids creating and opening files whose names contain any of these seven characters). This has no effect if the server does not support Unicode on the wire. Please note that the files created with mapchars mount option may not be accessible if the share is mounted without that option.
- The rsync command is reporting the CIFS error triggered by the colon(:) present in file name (test/test:one)
- Reproduced in Lab setup:
[root@rhel63 cifs]# less /proc/mounts | grep cifs //10.65.208.96/cifs/ /mnt/cifs cifs rw,relatime,sec=ntlm,unc=\\10.65.208.96\cifs,username=administrator,uid=0,noforceuid,gid=0,noforcegid,addr=10.65.208.96,file_mode=0755,dir_mode=0755,serverino,rsize=16384,wsize=65536 0 0 [root@rhel63 cifs]# rsync -aHv 10.65.x.x:/tmp/test /mnt/cifs/doug/ receiving incremental file list test/ test/audit.log:2014 rsync: rename "/mnt/cifs/doug/test/.audit.log:2014.5lfPna" -> "test/audit.log:2014": Invalid argument (22) test/test:one rsync: rename "/mnt/cifs/doug/test/.test:one.Zz0cOw" -> "test/test:one": Invalid argument (22) sent 53 bytes received 282 bytes 134.00 bytes/sec total size is 108 speedup is 0.32 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1505) [generator=3.0.6] [root@rhel63 cifs]# cd doug/test [root@rhel63 test]# ls -al total 0 drwxr-xr-x. 1 root root 0 Jun 25 01:07 . drwxr-xr-x. 1 root root 0 Jun 26 2014 .. -rwxr-xr-x. 1 root root 0 Jun 24 04:24 .audit.log -rwxr-xr-x. 1 root root 0 Jun 25 01:07 .test
- While when trying to rsync using the local filesystem, no error is seen:
[root@rhel63 test]# rsync -aHv 10.65.x.x:/tmp/test /opt/ receiving incremental file list test/ test/audit.log:2014 test/test:one sent 53 bytes received 282 bytes 134.00 bytes/sec total size is 108 speedup is 0.32 [root@rhel63 test]#
- Red Hat Enterprise Linux
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.