Running RPi4 with Buster with two external 500GB USB drives.
My issue is about this rsync command.
sudo rsync -vru --delete /media/USBDRIVE/ /media/pi/MyBookPi/
On USBDRIVE at the root level, there are two folders with several folders and files under them. (This maybe important later.)
I ran the above command three days ago to copy all of the files on USBDRIVE to MyBookPi. After it completed, I added a file to USBDRIVE to test the command to make sure that it only copied the new file since nothing else had changed. That was successful. Next I added a file to MyBookPi, ran the command again and it only deleted the new file, once again, successfully.
So yesterday, I added a new file to one of the sub-sub-folders on USBDRIVE. I then ran the command this morning. It then proceeded to delete all of the files and folders under the root level folder including the root level folder under which that the file was added.
Here is the output of running the command today:
pi@RPi4-dlnafile:~ $ sudo rsync -vru --delete /media/USBDRIVE/ /media/pi/MyBookPi/
sending incremental file list
MicroSD_mages/Pi3/RPi3-PNY-7071-msd-H-1.img <=========== This was the only new file that should have been copied.
sent 159,505,866,365 bytes received 651 bytes 22,316,315.78 bytes/sec
total size is 161,210,851,162 speedup is 1.01
So, the question is, why were the unchanged files deleted and then recopied along with the new file. I expected that only one file would be copied, not the whole folder.
Am I using the options wrong to only copy new files, overwrite changed files and delete the removed file keeping the destination a virtual copy of the source harddrive?
Thanks in advance.
3 posts • Page 1 of 1
BINGO. Good eye, I'm not sure I would have ever noticed it since I was just sure it was in my rsync setup. Not sure what I did to cause it, but that was the issue.
I fixed the folder names and the command works as expected.
Thanks a bunch.
Using both RPi3 & 4's for model railroading, NAS file sharing and miniDLNA.