Backups and file transferring are important for server management. And Rsync is one of the best shots, but errors are always a setback.
Rsync error code 12 is a tricky error that occurs due to insufficient disk space, network errors and so on.
That is why at Bobcares, we often get requests to fix Rsync errors as a part of our Server Management Services.
Today, let’s see how our Support Engineers fix Rsync error code 12 for our customers.
Explaining Rsync error code 12
Rsync is one of the popular file synchronization tools. It is useful for both local and remote file transfer.
If the destination already contains the source file then the Rsync only copies the differences. This makes Rsync a faster file transfer option.
But, in many situations, the Rsync operation ends by showing the error message:
rsync error: error in rsync protocol data stream (code 12) at io.c(xxx).
So, why does the file transfer end by showing an error code 12?
Usually, the reason for this varies from insufficient disk space to network errors, improper destination, and so on.
Let’s now check on a few reasons and see how our Support Engineers fix them.
An Overview:
- Impacts of Rsync Error Code 12
- Causes and fixes for the Rsync error 12
- 1. Insufficient Disk Space
- 2. Missing Rsync on Remote Server
- 3. Idle Connection
- 4. Network Errors
- 5. Mismatched Rsync Versions
- 6. File Permissions Issues
- 7. Large Number of Files
- Prevention Strategies
Impacts of Rsync Error Code 12
- The error can stop ongoing file transfers, preventing the completion of synchronization tasks.
- If backups are interrupted, they may result in partial data being saved, leading to potential data loss.
- Regular backup processes are essential for server management; an error can disrupt these operations, affecting overall system performance.
- Troubleshooting and resolving the error can lead to increased downtime, impacting business continuity.
- Incomplete or failed transfers may compromise data integrity, making it difficult to restore systems reliably.
- Errors can delay critical operations that rely on timely data synchronization or backup processes.
- Continuous attempts to resolve the error can consume system resources, affecting other operations and potentially leading to further issues.
Causes and fixes for the Rsync error 12
Whenever a server operation ends up in error, the initial troubleshooting starts from the log file. In the case of Rsync, our Support Engineers always make sure to set up the log file right. As a result, the reason that leads to the error can be easily found out from the log file.
The most common reasons for the Rsync error code 12 are:
1. Insufficient Disk Space
The destination server may not have enough disk space to accommodate the incoming files.
Fix:
Before transferring large files, check available disk space by running:
df -h
Ensure that the free space exceeds the size of the largest file being transferred. If not, clear some space or increase the disk capacity.
2. Missing Rsync on Remote Server
If Rsync is not installed on the destination server, it will lead to this error.
Fix:
Verify that Rsync is installed on the remote server by executing:
rsync –version
If Rsync is not installed, install it using:
apt-get install rsync
3. Idle Connection
An idle connection can time out during long transfers, triggering error code 12.
Fix:
Use the –timeout option in your Rsync command to keep connections alive:
rsync --timeout=60 ...
Additionally, configure SSH settings to maintain connectivity by editing the SSH configuration file (usually located at /etc/ssh/sshd_config) to include:
ClientAliveInterval 60
ClientAliveCountMax 5
4. Network Errors
Interruptions in network connectivity can disrupt file transfers.
Fix:
Check your network connection to ensure both servers are reachable by using:
ping remote-server-ip
Use traceroute to diagnose network issues if necessary.
5. Mismatched Rsync Versions
Different versions of Rsync on the source and destination can lead to compatibility issues.
Fix:
Check the version of Rsync on both systems:
rsync –version
Ensure both systems are running compatible versions of Rsync and update if necessary.
6. File Permissions Issues
Lack of necessary permissions on files or directories can prevent successful transfers.
Fix:
Check permissions of the source and destination directories using:
ls -l /path/to/directory
We can modify permissions if needed with:
chmod -R 755 /path/to/directory
7. Large Number of Files
Transferring a very large number of small files can overwhelm system resources.
Fix:
Consider compressing files before transfer to reduce the number of individual files being sent.
tar -czf archive.tar.gz /path/to/files/
Alternatively, use Rsync’s –inplace option to reduce resource usage during transfer:
rsync --inplace ...
Prevention Strategies
- Implement monitoring tools to alert administrators when disk space is low.
- Regularly check for software updates and ensure all necessary tools are installed on both servers.
- Test network stability before large transfers and consider using VPNs for secure connections.
- Utilize options like –partial to allow resuming interrupted transfers without starting over.
[Having trouble in fixing Rsync errors? – We’ll help you.]
Conclusion
In short, Rsync error code 12 denotes ‘error in rsync protocol data stream’. Usually, this error occurs due to insufficient disk space, missing Rsync at the destination, idle connection timeout and so on. Today, we saw how our Support Engineers fix this error for our customers.
I restart rsync daemon process resolve this problem.
Thanks. it was helpful. I was trying to rsync a docker running on AWS instance. the docker’s fingerprint changed and had to first ssh into the docker to have it updated.
Another cause for this problem is a mismatch between rsync and ssh. For example, on a Windows laptop with Cygwin, using the cygwin rsync with the Windows ssh will cause this error. A solution in that case is to make sure to install the cygwin ssh.
Thank you for the update Charles.
Another item you may want to add that I figured out since this was one of the top Google results. If you are on Windows, have Cygwin installed, and invoke rsync outside of a cygwin console, you will get a rsync 12 error since rsync is trying to use the wrong ssh. Apparently the window’s built in one doesn’t work with rsync and you need to use -e to pass the correct one.