Somehow related to my previous post: As of currently – i.e. September 2020 – there is a weird bug in Ubuntu 20.04’s exfat support: When you mount an exfat file system (like the one on pretty much any MicroSD card that you would use in a GoPro), it will not only show all files as exactly one month into the future, but it will even change the modification date to that one month in the future. Thus, if you mount an exfat filesystem two times in a row, all files will have a modification date two months in the future. Very annoying.
Luckily there is an easy workaround: Instead of the built-in (kernel module?) exfat support, just install the packages ‘exfat-fuse’ and ‘exfat-utils’ (i.e. type sudo apt install exfat-fuse exfat-utils
in the shell). Once you mount the MicroSD card again, it will be mounted using the fuse driver, which does not mess up the modification dates.
Those dates that have already been messed up though, need to be fixed. I’ve created a small script that can do that. Download it (here), chmod +x
it and then run it with the file name(s) of the affected files as parameter(s). If the date has already been messed up to more than one month into the future, just run the script multiple times.
Thanks Patrick for fixing my problem with my new usb key.
You are welcome 🙂
It seems that the new built-in exFAT version 1.3.0 solves the problem.
That’s great to know, thanks! 🙂
Hello Patrick, now something else happened. With last sunday time change in France when I compare the file on my usb key and the files on my hard drive, the files on my hard drive went back 1h. So that I have to potentially synchronize huge amount of data again. Is there a way to tell ubuntu keep the files time the way they were and not have time change affect them? Would appreciate if you could help.
Hi Alexandre, I don’t really know what happened there. I just googled a bit, and it looks like exfat should store the timezone in the file meta data, which means what you’ve described should usually not happen.
When France switched from Central European Summer Time (CEST) to Central European Time (CET), did you change the system time of your computer manually, and left the time zone at ‘CEST’ by any chance? That’s the only scenario that I can think of, where now the timestamps of your files on the exfat file system would show up with a one hour time difference.
I’ve checked the files on my SD card from before the time change (I’m in Germany, i.e. we’re in the same time zone, and we switched from summer to winter time on the same day), and their timestamps look fine. Dolphin (my file manager program) also shows the correct time zone in the meta data view.
Oh, it just occurred to me, there is another possible scenario: Maybe the device / machine that created the files on your file system was / is using a time zone that does not make the summer -> winter time switch – e.g. UTC (commonly used on servers, for example).
In any case, it’s pretty easy to change the timestamps of the files (and also the timezone), using the ‘touch’ and the ‘date’ commands. You can have a look at the script I linked from the article. With the help of the man pages of the ‘date’ command you should be able to figure out how to change either by one hour, or change the time zone. If you need help, please let me know.
Hello,
just to let you know:
one could also change the timestamps with the exiftool:
exiftool “-FileModifyDate<DateTimeOriginal" ~/path/to/photos/
this will replace all photo-files atime and mtime stamps to the one that is in exif field DateTimeOriginal
best regards
Reiner
Good idea! But that only works for files that actually have EXIF meta data, i.e. images. For videos, for example, that won’t work, right?
Yes, only for photos with exif data.
That was my problem here 😉
Here is the link where I found this info:
https://www.heise.de/select/ct/2016/15/1468839560140348
regards
Reiner