How to exclude the lost+found directory in rsync?

I’m unable to exclude the lost+found folder in rsync – rights-related issues are considered as I/O errors by the program (?) and thus I can’t ever use the --delete flag for instance:

If the sending side detects any I/O errors, then the deletion of any files at the destination will be automatically disabled. This is to prevent temporary filesystem failures (such as NFS errors) on the sending side from causing a massive deletion of files on the destination.

I made sure to pass the full path using --exclude-from=/mnt/backup/lost+found. The error I receive:

rsync: [client] failed to open exclude file /mnt/backup/lost+found: Permission denied (13)
rsync error: error in file IO (code 11) at exclude.c(1188) [client=3.2.3]

It should be noted that this is an external HDD and not a path within my home directory.

Lastly, the full rsync command, if relevant:

rsync --archive --no-compress --delete-before --info=progress2 --human-readable --exclude-from=/mnt/backup/lost+found /mnt/backup/ /mnt/backup-2/
2 Likes

From the man page:

--exclude=PATTERN        exclude files matching PATTERN
--exclude-from=FILE      read exclude patterns from FILE

It tries to read lost+found to determine which files to be excluded. You need to use --exclude= option.

3 Likes

Sadly I still get the same error with:

rsync --archive --no-compress --delete-before --info=progress2 --human-readable --exclude=/mnt/b
ackup/lost+found /mnt/backup/ /mnt/backup-2/

output:

rsync: [sender] opendir "/mnt/backup/lost+found" failed: Permission denied (13)
IO error encountered -- skipping file deletion
         32.77K   0%    0.00kB/s    0:00:00  
rsync: [sender] write error: Broken pipe (32)
rsync error: error in socket IO (code 10) at io.c(823) [sender=3.2.3]
rsync error: received SIGUSR1 (code 19) at main.c(1592) [generator=3.2.3]
rsync --exclude=lost+found/ ...

Linux Manpages Online - man.cx manual pages

3 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.