Machine A: Debian Testing (SparkyLinux 6) rsync 3.1.3
Machine B: Ubuntu Ubuntu 16.04.6, rsync 3.1.1
I have a bash script to backup a directory to a network connected machine. I have tried it both with backing up to a mounted directory (CIFS) or over rsync (rsync dameon run by root on target). Both filesystems are ext4. Both are mounted in fstab with RW,defaults.
My bash script checks for both directories existing and then runs (as root):
rsync -artzsv --force --delete --exclude=.Trash* --exclude=lost+found* /media/dcarrco/raid /media/bigdisk
Permissions on the source directory, for example, are:
drwxr-x--- 8 dcarrco dcarrco 4.0K Feb 4 2013 dev -rw-rw-r-- 1 dcarrco dcarrco 32G Nov 8 09:32 data.dat -rw-rw-r-- 1 dcarrco dcarrco 114K Sep 22 2016 flower.jpeg
Once I run rsync (either on CIFS mounted directory or through the daemon) the target drive has:
drwxr-xr-x 2 dcarrco dcarrco 0 Feb 4 2013 dev -rwxr-xr-x 1 dcarrco dcarrco 32G Feb 14 2019 data.dat -rwxr-xr-x 1 dcarrco dcarrco 114K Sep 22 2016 flower.jpeg
So the execute bits are now set on EVERY file it transferred. The next time I run rsync it transfers all those same files again (because the execute bit is NOT on the source and IS on the target).
So I tried deleting the directory on the target and just doing a fresh backup. Which worked. And then it (sigh) copied them all again the next time.
so i set the execute bit ON every file on the source. rsync copied nothing and said it was up to date.
I ran rsync with the
--itemize-changes and it's just the executable bit on the files. Again and again. Any ideas?
EDIT: this ended up being a samba problem, not rsync. i don't know why rsync over the rsync daemon encountered the same problem but once i added file_mode=0644,dir_mode=0755 to my CIFS line in fstab, it worked as expected.