Search code examples
rsync

rsync: mkstemp failed: Invalid argument (22), stuck on a file, how to fix?


I've run this command:

sudo rsync -ra --stats --human-readable 
--no-owner --no-group  
--info=progress2 
--log-file=/home/myuser/rsync-log.log 
 ~ /media/myuser/1234ABCD/

And I've got this error:

rsync: mkstemp 
"/media/myuser/1234ABCD/myuser/.local/share/Trash/info/.image_2023-05-18T17:55:34.664473264Z-small.png.trashinfo.mBfC8n" 
failed: Invalid argument (22)

It's the second time I'm getting it, the first was when I tried to run without

--no-owner --no-group

it happened on the same file it seems.

The target destination is an external HDD with ntfs filesystem, the source is a Kubuntu home directory on ext4 filesystem.

I'd prefer to keep the destination filesystem ntfs, because I might need to store files there that would need to be accessible from Windows OS.

Also I don't understand why rsync just gets completely stuck at this point, rather than skipping the problem file and moving on?


Solution

  • I just fell into this issue as well (in my case I was rsync-ing from btrfs to exFAT), and it seems like the colon : is an illegal character on some filesystems. You can try manually renaming the file so that the file name contains no illegal characters for the target filesystem.

    See posts like this to know more about all illegal characters for NTFS.