Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


rsync: --delete not working
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

rsync: --delete not working

J1021J1021 Member
edited September 2014 in Help

Hi,

I have the following command to backup my entire HDD on my laptop to an external USB HDD.

sudo rsync -va --exclude '/media' --exclude '/proc/kcore' --delete --progress / '/media/TOSHIBA HDD/rsync-backup/'

My laptop HDD is 750GB whilst the external HDD is 1TB. Despite the external HDD only holding the backing, it is currently running at 31GB available. I have taken a look through the files and it appears that files deleted from the laptop are remaining on the backup drive.

Can anyone shed anylight on why deleted files aren't being deleted from the backup copy?

Jack

Comments

  • sudo?

  • @wych said:
    sudo?

    Sorry, I do run under sudo already. I type sudo manually and copy the rest of the command from a text file.

  • rm_rm_ IPv6 Advocate, Veteran
    edited September 2014

    said: Can anyone shed anylight on why deleted files aren't being deleted from the backup copy?

    I think it won't do deletions if it had any error during copy, which it very well might have had, considering you don't exclude things such as /dev and various weird files in /proc and /sys. Just exclude all of these 3 entirely, no need for the "/proc/kcore" b/s.

  • rm_ said: I think it won't do deletions if it had any error during copy, which it very well might have had, considering you don't exclude things such as /dev and various weird files in /proc and /sys

    It always definitely will have errors. I will try using

    --delete-before

    .

  • rm_rm_ IPv6 Advocate, Veteran
    edited September 2014

    kcaj said: always definitely will have errors

    Why would that be?

    Also forgot to note, for backups like this, check out rdiff-backup, not just rsync.

    http://manual.aptosid.com/en/sys-admin-rdiff-en.htm

  • It maybe the order of the flags:

    rsync -va --delete --progress --exclude '/media' --exclude '/proc/kcore' / '/media/TOSHIBA HDD/rsync-backup/'

  • I tried using --delete-before and changing the order of the flags, no luck.

  • Try adding a trailing slash to the directories.

  • I'd try some of the other --delete options from the manpage.

  • CharlesACharlesA Member
    edited September 2014

    @qrwteyrutiyoup said:
    Try adding a trailing slash to the directories.

    Might work, but I don't know.

    I pulled the rsync command I've been using:

    rsync --archive --itemize-changes --delete /home/charles/Steam /backup

    Here's one I have with the exclude switch.

    rsync --archive --itemize-changes --delete --log-file /tmp/rsync.log /home/charles --exclude /home/charles/Steam --exclude lost+found --exclude virtualbox /backup
  • GoodHostingGoodHosting Member
    edited September 2014

    I always just use something simple, like:

    rsync -ravP /src /dst --delete-after

    EDIT: And add -e when required.

    rsync -ravP -e "ssh -l root" /src remote:/dst --delete-after

    Thanked by 1ironhide
Sign In or Register to comment.