1

I'm using Raspbian jessie (ubuntu). I made a .sh that makes a backup .img of everything (excluding mnt, tmp, run, dev, boot, etc.) and let this run once a week with crontab. It checks for modified files and only copies those. This is very useful I find since there is no need to make a big, full backup of everything, every time anew. This works perfectly. The .sh contains following command:

sudo rsync -aAHvpE --delete-during --exclude-from=/etc/rsync-exclude.txt / /mnt/usb0/backup/partition2

However, after checking the backup I noticed it still contained a file that I had already deleted on my original system. For example the file /test.txt was backed up to /mnt/usb0/backup/partition2/test.txt , however after deleting the original and making a new backup it didn't disappear on the backup.

Now my question is: what ways are there to check for files that don't exist in the original folder anymore, then delete those in my backup folder too? (WITHOUT having to delete everything first and then make a full backup from scratch).

0

Command you have used --delete-during will delete the files in receiving side /mnt/usb0/backup/partition2 However check your --exclude-from file /etc/rsync-exclude.txt has the name test.txt in it.

You can also use below options,

        --delete-before         receiver deletes before xfer, not during
        --delete-during         receiver deletes during the transfer
        --delete-delay          find deletions during, delete after
        --delete-after          receiver deletes after transfer, not during
        --delete-excluded       also delete excluded files from dest dirs
  • It SHOULD delete the files on the receiving side, but it doesn't apparently... (test.txt is not included in /etc/rsync-exclude.txt) – Kibouo Feb 10 '16 at 16:59
  • Touch few files(i.e examplefile1,2,3..) in / and run the above rsync command and after delete in source run again rsync to check the deletion process. Verify the destination in both cases /mnt/usb0/backup/partition2. If that fails paste the output to check further. – KKD Feb 11 '16 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.