Results 1 to 6 of 6

Thread: rsync: problem with --delete

  1. #1
    Join Date
    Sep 2008
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    rsync: problem with --delete

    Hello dears,

    I am trying to use rsync as a backup tool I am using this command

    Code:
    rsync -a -v --progress --delete   home   external_hd
    the problem is that while the command changes update files on the destination, it doesn't delete the files removed from source, so everything removed from destination still appears on the destination.

    I thought the option --delete should have done the job. Could somebody help me?

    Best Wishes
    Pietro

  2. #2
    Join Date
    Sep 2005
    Location
    Somerville, MA
    Beans
    98

    Re: rsync: problem with --delete

    Does rsync complain about "not being able to stat all files" or something like that? If so, it will not go into the delete phase. Try piping the output to a log file, like so:

    rsync blah blah blah 2>&1 | tee /tmp/backup.log

    The most likely culprit is .gvfs in your home directory. Add the option --exclude=.gvfs, and you should be good. (This is a known problem with .gvfs -- even root can't stat it.)

    (I should also mention that this is probably not the correct forum for your question, since it isn't System76-specific.)

  3. #3
    Join Date
    Sep 2008
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: rsync: problem with --delete

    Hello,

    Quote Originally Posted by phyzome View Post
    ...
    The most likely culprit is .gvfs in your home directory. Add the option --exclude=.gvfs, and you should be good. (This is a known problem with .gvfs -- even root can't stat it.)

    I tried --exclude=.gvfs but the problem is still there, I also put the option

    --log-file=/media/BKDISK/rsync_log

    but I don't get any log file at the end. Anyway that's the output when there no changes on the source directory:

    Code:
    rsync: opendir "/home/pietro/.local/share/Trash/expunged/45063646/cdrtools-2.01.01/libvms" failed: Permission denied (13)
    rsync: opendir "/media/EHD1/tribeca-home-pietro/.local/share/Trash/expunged/45063646/cdrtools-2.01.01/libvms" failed: Permission denied (13)
    IO error encountered -- skipping file deletion
    sent 2177604 bytes  received 4874 bytes  4364956.00 bytes/sec
    total size is 203335370473  speedup is 93167.20
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1057) [sender=3.0.6]
    I hope this can be solved

    Pietro

  4. #4
    Join Date
    Sep 2005
    Location
    Somerville, MA
    Beans
    98

    Re: rsync: problem with --delete

    Quote Originally Posted by WDYSUN View Post
    Code:
    IO error encountered -- skipping file deletion
    Well, there's your problem. Look around in the output more:

    Quote Originally Posted by WDYSUN View Post
    Code:
    rsync: opendir "/home/pietro/.local/share/Trash/expunged/45063646/cdrtools-2.01.01/libvms" failed: Permission denied (13)
    Well, try accessing that file! Can you open it? Try reading it as root instead.

    I generally do my backups as root, because I occasionally end up with files in my home dir that were written by root.

  5. #5
    Join Date
    Sep 2008
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: rsync: problem with --delete

    Ok now it works! Thanks a lot! I didn't know that the home dir could contain root owned file/dir.

    By the way it does not save the log file.

    Best Wishes
    Pietro

  6. #6
    Join Date
    Oct 2012
    Beans
    1

    Re: rsync: problem with --delete

    What I understand after lot of debugging for this issue...If rsync has a read error at source(e.g due to permission) it cannot determine whether to delete the file in destination or not...and it skip the -delete action for all other files for saftey reason.

    Make sure all files has read permission at source.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •