Samba modifies "last modification date" of files substracting 3 hours

2.2k views Asked by At

I think this is really weird and despite having done some searching I wasn't able to find any info related to this problem.

I'm setting up a backup server with a Raspberry Pi running raspbian who will communicate to a Windows 7 PC. What I did was program auto mounting for an external drive attached to the Pi, after doing a manual backup of the files from the W7 PC. Then I shared said mounting folder over Samba and everything works great.

The thing is that I want to use a program called Synkron over windows which can monitor 2 or more folders, detec any changes and copy over the new/modified files periodically. However, when I press "analyze", the programs lists all my files (in the ext drive) as obsolete, and I've discovered that the problem is that Samba (or the Pi itself) is changing the last modified date of the files, substracting exactly 3 hours to each of them. When I remove the drive from the Pi and re analyze it connected to my PC all the files are back to normal and they show up as ok.

This exact situation has happened with 2 different sets of Raspberrys, raspbian installations, external drives, windows PC and files. Also, I checked the date on both Pi's and it was correct every time.

What do? :/

2

There are 2 answers

2
CenterOrbit On

The Raspberry Pi doesn't have a RTC, so every time it loses power the clock will reset. The Pi relies on network time to reset this everytime it boots. So your Pi will have to be connected to the internet for this to happen.

Also, make sure your pi is configured to the same timezone that you are located in. You can configure this by going through the rasp-config settings in the terminal.

Additional Samba config options:

"Time synchronization can also be very important to programmers. A useful group of settings consists of the following options:"

[global]
    time server = yes
    dos filetimes = yes
    fake directory create times = yes
    dos filetime resolution = yes
    delete readonly = yes

If the above fails, try this additional parameters:

[data]
    fake directory create times = yes

and if still, then you could manually adjust the time offset:

[global]
    time offset = 1800

WARNING: The above has the potential to break after Windows adjusts for daylight savings time.

Good luck.

0
neves On

What's your timezone? Maybe the files time are in UTC and you are in Brazil or NY timezone. You'd just need to configure the proper timezone in your Raspberry Pi our Samba Config