0

I updated my rsync ignore file and used the --delete-excluded flag to remove now-redundant files from the destination side. rsync can't complete the task since I have the line lost+found/ in the said file:

rsync: [generator] opendir "/mnt/text/lost+found" failed: Permission denied (13)
IO error encountered -- skipping file deletion

my command:

rsync --archive --no-compress --info=progress2 --human-readable --exclude-from='rsync.exclude.txt' --delete-excluded $HOME/ /mnt/text/

As a system directory lost+found can't be removed.

I recall getting permission errors with lost+found on at least Fedora 33 (on the sending side) and thus have since had the folder excluded. On my current Fedora 35 rsync worked fine without (currently there's no data in the directory, if relevant).


Is it truly necessary to manually exclude the folder or have I encountered a bug (and as a result misunderstood how rsync functions)? This would imply that rsync would always fail under Linux when the default settings are used due to the I/O error...

2
  • ...and $HOME is a separate mount containing a top-level lost+found? Or is the destination a mount that happens to contain a top-level lost+found? Commented Apr 13, 2022 at 17:35
  • Both a separate mounted drives.
    – user598527
    Commented Apr 13, 2022 at 17:43

1 Answer 1

0

First, answering the question you asked, "Does rsync process the lost+found directory by default?" the answer to that is yes if you have included it in the scope. rsync -av / remoteHost:/some/path will attempt to include all files and directories - and will fail on files or directories that the current user cannot access, including /lost+found if you're not root. (It will also fail on most of /proc and /sys but for different reasons.)

Now, looking at the question body as a whole. This seems to be one-off run to remove the files and directories that you're now excluding from the source copy.

You can't really exclude lost+found from the exclusions so the easiest solution would be to include the --ignore-errors flag. This will allow the deletions to occur for the files and directories that you have permission to delete. You'll still get an error for lost+found but it won't prevent the other deletions.

Once this is done you should revert your processing so that you no longer have --delete-excluded or --ignore-errors.

2
  • Yes, this was a one-time command. Using the ignore errors flag could however introduce corruption if a malfunction happens to occur on the sending side during the rsync transfer — I may avoid for now. rsync happened to finish when I commented out the lost+found/ line in my exclude file and doesn't at least consistently return an error when used.
    – user598527
    Commented Apr 14, 2022 at 15:47
  • 1
    ...but if rsync can still print out the error messages with --ignore-errors flag I'd consider this as safe.
    – user598527
    Commented Apr 14, 2022 at 15:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .