Ziemek Jankowski
2025-Sep-14 20:42 UTC
[Samba] File modification date randomly not preserved when copying from Mac to Samba
Hello I'm having this issue for long time, across many Mac devices. I've spent a ton of time looking for solution, but couldn't fix it. I'm not even sure whether this is Samba issue, or Mac issue. I will appreciate any hints. Mac file managers (ForkLift, Commander One, CRAX, Double Commander) can't reliably preserve modification date/time when copying from Mac to Samba. Enabling vfs_fruit seems to be making this problem more pronounced. I've put some monitoring on Samba server and I've learned there are three scenarios: SCENARIO 1 - CORRECT (never seen this with vfs_fruit enabled) 1. New file is created with current timestamp. 2. Timestamp is changed to that of source file. SCENARIO 2 - INCORRECT 1. File is created with current timestamp. 2. Timestamp is changed to that of source file. 3. Timestamp is changed to current time (!) SCENARIO 3 - CORRECT (?) 1. File is created with current timestamp. 2. Timestamp is changed to that of source file. 3. Timestamp is changed to current time (!) 4. Timestamp is changed to that of source file (!) Example (these are filtered results of "date; ls -l test_file" running in a loop during copy operation). "Sep 14" was the current time, "Sep 5" was timestamp of the source file. 2025-09-14 16:28:20.384424258 -rwxr--r--. 1 test test 0 Sep 14 16:28 test_file 2025-09-14 16:28:25.179527130 -rwxr--r--. 1 test test 69335712 Sep 5 23:22 test_file 2025-09-14 16:28:25.385041799 -rwxr--r--. 1 test test 69335712 Sep 14 16:28 test_file 2025-09-14 16:28:26.292423805 -rwxr--r--. 1 test test 69335712 Sep 5 23:22 test_file When I looked into Samba log, I've seen a lot of operations, much more than I would expect for simply creating new file and setting attributes, but I couldn't make anything out of this. Note that Mac shows correct timestamp on Samba share for some time, possibly until cache expires. Only then the wrong timestamp is visible. When I copy several files, timestamps are randomly preserved. Here is example where all source files have same modification timestamp, and this is what I see on Samba server after copy: -rwxr--r--. 1 test test 69335712 Sep 5 23:22 test_file -rwxr--r--. 1 test test 69335712 Sep 5 23:22 test_file_a -rwxr--r--. 1 test test 69335712 Sep 5 23:22 test_file_b -rwxr--r--. 1 test test 69335712 Sep 14 20:24 test_file_c -rwxr--r--. 1 test test 69335712 Sep 5 23:22 test_file_d -rwxr--r--. 1 test test 69335712 Sep 14 20:24 test_file_e I noted some of the file managers preserve more timestamps (Commander One, CRAX), other less (ForkLift, Double Commander). I would appreciate any hints how to fix or debug this issue. If any additional information could help, please let me know. Samba 4.22.3 Kernel 6.15.5 Fedora 42 Cheers