0

I am using rsync to sync around ~2TB of data.

I get the following errors in the log file:

rsync: [receiver] mkstemp "/mnt/sd25-4tb-bkp4-mnt4/tns-maindatads-smb/tns-maindatads-smb/main-data-subds-1/GoogleDrive-alk8915-bkp-2024-07-09-1800/Programirane neshta failove alk19890105/SoftUni/SoftUni AI 2021 Materials/SoftUni - AI - Data Science June 2021/softuni-ai-datascience-2021-project-FINAL-SUBMISSION/softuni-ai-datascience-2021-project-atkuzmanov-FINAL/resources/images/.Icon\#015.pu2lTm" failed: Invalid argument (22)

I researched around for this error, but everywhere I found related to ownership, which should not be my case, as I am using --no-o and --no-g.

I think it is probably related to some special symbols, such as new line or ":" (colon).

I definitely have some files and directories which contain ":" (colon), they are system files and I want to be able to synchronize them without renaming them as this will cause problems. How can I do that?

Here is the rsync sync command I am running with the flags:

rsync -avvvzh \
  "$SRC" \
  "$DEST_DIR" \
  --log-file=$log_file \
  --progress \
  --links \
  --checksum \
  --bwlimit="192M" \
  --delete-during \
  --delete \
  --timeout="60" \
  --compress \
  --no-o \
  --no-g

Rsync version:

rsync --version
rsync  version 3.2.7  protocol version 31
Copyright (C) 1996-2022 by Andrew Tridgell, Wayne Davison, and others.
Web site: https://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, symlinks, symtimes, hardlinks, hardlink-specials,
    hardlink-symlinks, IPv6, atimes, batchfiles, inplace, append, ACLs,
    xattrs, optional secluded-args, iconv, prealloc, stop-at, no crtimes
Optimizations:
    SIMD-roll, no asm-roll, openssl-crypto, no asm-MD5
Checksum list:
    xxh128 xxh3 xxh64 (xxhash) md5 md4 sha1 none
Compress list:
    zstd lz4 zlibx zlib none
Daemon auth list:
    sha512 sha256 sha1 md5 md4

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

Ubuntu Server version:

ubuntu 24.04 (64 bit) LTS
12
  • 1
    rsync handles pretty much all possible file names without problem. What is the file system on your target device? Commented Aug 19, 2024 at 18:28
  • 2
    what happens if you don't use any of the many many command line options here, but simply rsync ${SRC} ${DST} (and only use --no-o and --no-g if you really need them) Commented Aug 19, 2024 at 18:30
  • 2
    It looks like the EINVAL is coming from the mkstemp (3) library call, and supposedly means "The last six characters of template were not XXXXXX". I wonder if the long pathname is causing the template to get truncated somehow? Commented Aug 19, 2024 at 21:30
  • 2
    No point using --checksum, --bwlimit, --compress or -z, and if you're saying no owner & no group just replace -a with -rt. And if it's a single file you don't need -r Commented Aug 19, 2024 at 23:37
  • 3
    What are the source and destination filesystems? Not all filesystems can handle colons Commented Aug 19, 2024 at 23:40

1 Answer 1

4

I definitely have some files and directories which contain ":" (colon), they are system files and I want to be able to synchronize them without renaming them as this will cause problems. How can I do that?

You need to either put them on a filesystem where such symbols are supported in filenames, you need to containerize them (like a tar or zip file), or you need to change the filename to only using supported characters. None of this is an rsync specific issue as it is simply trying to keep the same name in both places. If the name is not compatible with the destination, it's going to have problems.

Since your destination is under /mnt, it seems more likely that you might have something like a FAT* or NTFS volume there that does not allow backslashes in a filename. Check what fileystem you have mounted there and what characters are not valid for files in that filesystem.


From comments, this filesystem is ExFAT. From https://learn.microsoft.com/en-us/windows/win32/fileio/exfat-specification#table-35-invalid-filename-characters, both the colon (mentioned in the question) and backslash (seen in the error message) are invalid as filename characters.

11
  • 2
    @atkuzmanov nothing here indicates a colon is a problem; but the length of the paths or the presence of special characters might be. ExFAT is simply not a sensible file system for your use case of backing up. Use something else. Commented Aug 20, 2024 at 13:59
  • 1
    honestly, all the standard file systems on Linux, ext4, XFS, … will all serve you well here. Windows can these days, through WSL, mount all of them. Commented Aug 20, 2024 at 15:08
  • 1
    @atkuzmanov research, but don't overdo it. This is an external device attached via USB. The file system won't be the speed-limiting factor if you choose any of the standard file systems. Try this: df -T ~. That's shows the file system your current setup uses as file system for your files. That one is fine. Use it. Commented Aug 20, 2024 at 15:18
  • 1
    then go for XFS or ext4, seriously, this should really not be used with exFAT. Commented Aug 20, 2024 at 15:35
  • 1
    @atkuzmanov, please add the extra information you've provided here in the comments into your question. If you put all the detail in the one place it's much easier for people to read it and help you Commented Aug 20, 2024 at 21:29

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.