Software & AppsOperating SystemLinux

How To Fix Rsync Error 23 When Backing Up Files on Ubuntu

Ubuntu 1

Rsync is an incredibly useful tool for file synchronization and backup on Linux systems. However, like any tool, it can sometimes throw errors that might be confusing. One such error is the rsync error 23, which indicates that some files or directories were not transferred. This article will guide you through the steps to troubleshoot and resolve this error on Ubuntu.

Understanding Rsync Error 23

Before we dive into the solutions, it’s important to understand what rsync error 23 means. This error typically occurs when rsync is unable to transfer some files or directories. The reasons could be varied – from permission issues to non-existent source directories.

Step 1: Verifying the Rsync Command

Firstly, ensure that the rsync command you are using is correct. For instance, your command might look something like this:

sudo rsync -avz /home/maria /home/guest/backup

In this command, -a stands for archive mode, which ensures that symbolic links, devices, attributes, permissions, ownerships, etc. are preserved in the transfer. -v stands for verbose, which increases the amount of information displayed during the transfer. -z stands for compression, which compresses the data before transferring.

Step 2: Running Rsync in Verbose Mode

If the error persists, run the rsync command in verbose mode (-v) to get a more detailed output. This will help you identify the specific files or directories causing the error. You can do this by adding the -v option to your command:

sudo rsync -avz --exclude='/*/.gvfs' /home/maria /home/guest/backup

Step 3: Checking for Permission Issues

Look for any “Permission denied” errors in the rsync output. This error typically occurs when rsync does not have the necessary permissions to access certain files or directories. You may need to use sudo or adjust the file permissions accordingly.

Step 4: Excluding Certain Directories or Files

If the error persists, try excluding certain directories or files from the backup using the --exclude option. For example, to exclude the .gvfs folder, you can modify the command as follows:

sudo rsync -avz --exclude='/*/.gvfs' /home/maria /home/guest/backup

The --exclude option tells rsync to exclude files or directories that match the given pattern.

Step 5: Filtering the Output

If you have a large list of files and the error messages are getting cut off, you can use the grep command to filter the output and only display the lines containing the “failed” keyword. For example:

sudo rsync -avz --exclude='/*/.gvfs' /home/maria /home/guest/backup | grep failed

Step 6: Verifying the Source Directory

Double-check that the source directory you are trying to backup actually exists. If the directory does not exist, rsync will throw an error. Ensure that the path is correct and the directory is accessible.

Step 7: Checking the Destination Directory Permissions

Verify that the destination directory (/home/guest/backup in your case) has the necessary permissions for rsync to write the backup files. Make sure the owner and read-write list are correctly set.

By following these steps, you should be able to identify and resolve the rsync error 23 in your backup process. Remember, the key to resolving any error is understanding what it means and then systematically troubleshooting the potential causes. Happy troubleshooting!

What does the `-a`, `-v`, and `-z` options in the `rsync` command stand for?

In the rsync command, the -a option stands for archive mode, preserving symbolic links, devices, attributes, permissions, ownerships, etc. The -v option stands for verbose, increasing the amount of information displayed during the transfer. The -z option stands for compression, compressing the data before transferring.

Leave a Comment

Your email address will not be published. Required fields are marked *