28

I use rsync command to take backup of files from one of my ubuntu server to another ubuntu machine. Backup server trigger a script that use rysnc command. Here is the command I use

rsync -rltvh --partial --stats --exclude=.beagle/ --exclude=.* --delete-after root@live_server:/home/ /home/live_server_backup/home >> /tmp/logfile.log 2>&1

live_server is ssh-able without password. So it works. Now problem is with

--delete-after option

After all file synced .At the end I can see deletion procedure skipped.logfile error is like

IO error encountered -- skipping file deletion

When i tried to find log there were some error while file sync

rsync: send_files failed to open "/home/xyz/Desktop/PPT_session_1_context.pdf": Permission denied (13)

So my understanding is as rsync could not read all the files from target for safety reason it is skipping the file deletion.

Is there any way to make --delete-after work even if there is some permission error? I do not want to use force deletion as it will be dangerous in some situation.

2
  • 1
    Pssst again... You really should. Jun 13, 2015 at 14:45
  • 3
    @ArmelLarcier Sorry but what does it mean "Pssst again"? you really should what? Mar 4, 2022 at 8:57

4 Answers 4

28

Additional note about this issue:

vanished file should not trigger the condition IO error encountered -- skipping file deletion, but this often happens when you are creating a backup of a live system.

This is covered by rsync bug #7809 (https://bugzilla.samba.org/show_bug.cgi?id=7809) and should be solved in the upcoming release 3.1.0.

In the meantime use:

--ignore-errors         delete even if there are I/O errors
26

From the rsync man page:

--ignore-errors         delete even if there are I/O errors

That will address your problem.

1
  • No - it will not address the problem in all cases.
    – Seamus
    Oct 17, 2022 at 15:11
3

You should use an exclusion file to make rsync ignore the files that it can't read. The list can be generated with find . -exec test -r '{}' in the source directory and then massaged into the exclusion file format rsync wants.

4
  • actually my source directory is quite large (10-12GB). So each time finding files (having no read permission) will not be efficient way. what do u say?
    – XemX
    Dec 7, 2012 at 5:56
  • Run it once to build the exclusion list and don't run it again unless a whole bunch of new unreadable files are added. rsync is doing the same tree traversal, so it shouldn't be that bad, anyway.
    – Kyle Jones
    Dec 7, 2012 at 7:09
  • 1
    Yes. But that's what my scenario is like. Everyday source directory may introduce such files. and I need to backup the new files into backup machine.
    – XemX
    Dec 7, 2012 at 7:16
  • Is there a working solution to this? I also use rsync for backups from a live system and when there is a I/O Error on the reading machine, the files get deleted on the target machine, which SHOULD NOT HAPPEN!
    – bzero
    Aug 6, 2013 at 18:29
0

For me above IO errors, you see permission denied. Didn't notice at first, but I had to make sure the directory I was reading from was readable as the user I was trying to rsync from.

So probably mostly permission issues these days. chown the live server appropriately and should work.

You must log in to answer this question.

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