I'm working on a server via SSH and need to copy a directory from the server to an HPC with rsync
:
rsync -a -q "sourcedir" "username@hpc:~/destdir/"
In this example, sourcedir
is on the server and contains a sub-directory which contains a small .csv
file. destdir
doesn't exist on the HPC, but gets created by rsync
(when it works).
It works roughly 3/4th of the time, but sometimes fails with one of two errors:
a 'stale file handle':
rsync: recv_generator: failed to stat "/home/u27/username/destdir/path/to/file.csv": Stale file handle (116) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]
OR
'error in file IO' error
rsync: mkdir "/home/u27/username/destdir" failed: File exists (17) rsync error: error in file IO (code 11) at main.c(656) [Receiver=3.1.2]
The stale file handle error (1) happens more often than the error in file IO (2).
Environment:
- Host is a Virtual Machine running Ubuntu 18.04.6 on OpenStack. Data are stored in a mounted volume. Both the VM and data are hosted on OpenStack.
- The HPC is running CentOS Linux 7 and is accessed via SSH through a bastion host.
I suspect that the problem is happening on the host, not the HPC, because I can't reproduce this error on my laptop running macOS. I can reproduce this problem using both the sftp set up for transferring files to the HPC as well as via ssh.
Any ideas what could be causing this, or what further steps I could do to debug or eliminate this error?
Cross-posted here: https://github.com/WayneD/rsync/discussions/415
UPDATE: I'm able to reproduce this problem with or without a trailing "/" on username@hpc:~/destdir/
mkdir "/home/u27/username/destdir" failed: File exists (17)
tells us it does exist sometimes.destdir
does not exist on the HPC because I remove it before each test run of rsync in this example. Also,rsync
generally does not care if the directory exists or not. If it doesn't exist, it makes it, right?