Score:1

rsync is not preserving file timestamps with the 'a' option when writing to cifs mount

US flag
Rob

My Ubuntu 22.04 VM (on my synology nas) preserves file timestamps when writing to it's local filesystem, but not when writing to a cifs mount (on the nas). This causes it to re-grab the non-preserved files the next times it runs again.

My laptop pop_os 22.04 will preserve file timestamps on the same cifs mount.

Both are running the same versions of rsync and cifs-tools.

Mounts listed here:

vm: //192.168.86.37/files on /home/rob/synner type cifs (rw,relatime,vers=3.1.1,cache=strict,username=rob,uid=1000,noforceuid,gid=0,noforcegid,addr=192.168.86.37,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1)

laptop: //192.168.86.37/files on /home/rob/synner type cifs (rw,relatime,vers=3.1.1,cache=strict,username=rob,uid=1000,noforceuid,gid=0,noforcegid,addr=192.168.86.37,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,closetimeo=5)

mount command used on both: mount -t cifs -o username=rob,password=<redacted>,uid=1000 //192.168.86.37/files /home/rob/synner

rsync command being used: /usr/bin/rsync -avz --progress root@kp3:/home/backup/ /home/rob/synner/hosting_backups/kp3/

Edit: with more info..

When the VM looks at remote (kp3), along with new files, it will also re-download files it has already grabbed, but will timestamp everything with the time it's actually grabbing the files, so it will just do it all over again the next day when it runs.

I've also added 'noserverino' to the mount command on the VM to get rid of the 'serverino' portion in it's mount statement with no difference.

Score:1
ng flag

I just had this issue (rsync silently not preserving timestamps) when trying to copy ~60 GB of jpg/mp4 files from a src: exfat mount to a dst: cifs mount.

At first I wondered if it was the source filesystem causing issues but it turned out to be an issue with either my cifs client or server versions (of the binaries/libs installed).

What helped me in the end was to force the smb/cifs client version to mount.cifs -o vers=2.0.

After this rsync was able to preserve the destination filesystem timestamps as expected when using --archive, -a or --times, -t.

Here are the smb/cifs versions that were causing me issues.

# client
smbclient -V
Version 4.13.13-Debian

apt-cache policy smbclient
smbclient:
  Installed: 2:4.13.13+dfsg-1~deb11u5

# server
smbd -V
Version 4.9.5-Debian

apt-cache policy samba
samba:
  Installed: 2:4.9.5+dfsg-5+deb10u1

I came across Ubuntu bug #2007055 which gave me the idea to try downgrading the client protocol from automatically chosen SMB3_11 to SMB2_02. I'm guessing with latest versions the bug goes away.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.