Why is it trying to delete the very directories I want to back up. It goes on to do the backup. But the presence of this list of failed deletes suggests something is very wrong.
are you sure it is referring to /home/pc ? the --delete option deletes on the target, not at the source usually … (and the output doesn’t really tell you the full path )
That logs it is probably showing folders that rsync is trying to delete at the destination. This is most likely because those folders are not present on the origin anymore.
If you are trying to create a script that will backup files from time to time, maybe using --delete is not the best option as it will keep the destination sync’d with the origin and this is not the best backup strategy. Of course, this depends on what are your needs.
[andrew-1dtv] here. Had to start a new account as could not post for 15 hours. [So helpful for those of us with Ubuntu forum for a decade who are migrating. ]
Thanks. I understand that. It is trying to delete /home/pc on the target.
But the whole idea is to incrementally backup /home/pc on the target.
I cannot fathom why it begins by trying to delete it.
Plus the backup process is taking an absolute age, which may or may not have anything to do with it.
[andrew-1dtv] here. Had to start a new account as could not post for 15 hours. [So helpful for those of us with Ubuntu forum for a decade who are migrating. ]
Thanks. This is the output from rscync that I have posted.
The origin is my main home directory. Nothing has been deleted there.
And yes, I am trying to keep the thumb drive precisely synced with the home directory. That way if I reorganise a big directory, or just rename it, I do not get the thumb drive duplicating stuff and running out of space. I do my backups online with dropbox and pCloud.
You mention wanting to keep a precise sync on your target, yet using excludes & update can result in variations between source & target. Not a bad thing, quite useful depending on your needs.
Regarding --delete:
Imagine this. You rename a directory on source, --delete will delete the original directory & its contents on your target, because the directory does not exist on source anymore, then the new directory & contents are rewritten to target. Rsync doesn’t move data around, or rename directories like gui file managers act. To see this in action, give a -vvv and a -n (dry-run). This may also give you a clearer visual whether your paths & excludes are correct. You have a lot going on in your command.
When you tell rsync to --delete, it tries.
Could we have a single, itty bitty file somewhere in the hierarchy that is owned by root, or George or some other user? If so, rsyc --delete will get hung up without elevated permissions.
Careful with --delete, it can wipe your target or source if you have a mistake in you command path statements. Accidental disaster is avoided with -n and an examination of what would have happened. I almost wiped a 4tb HDD once, but -n saved me.
i assume the deletes are being applied to the target, not the source. if you have a case of source files being deleted, alert us and say that specifically because that is not possible as far as we know (unless you get source and target swapped on the command line).
what makes you think “/home/pc” (at the target) is being deleted? all i see is it trying to delete stuff in a SUBdirectory named “pc”. could there be such a subdirectory named “pc” on that device (that maybe you recently had and renamed) ? maybe you should make a list of what is there and chech it out. one sore point about rsync is that if you rename a big (or small, or huge) directory, it tries to upload it all, again, and delete the old stuff. maybe you should change “–delete” to “–delete-after”.
a really good backup tool would manage a database with checksums of the backup and when new files need to be uploaded with matching dates and sizes as other files, it checksums the new one to see if a move, or copy, or even a hard link, in the backup, will make things right without using all that bandwidth.
The idea is to keep the thumb drive synced with the main drive. Excludes are just to keep off the massive files like distro isos so the drive does not get filled up.
Great tip about -n. Lucky escapes are indeed the moment to take stock and put in one more cautionary step!