FORUMS
Remove All Ads from XDA

[GUIDE][HOW-TO]Keep timestamp and attributes correct

966 posts
Thanks Meter: 346
 
By tag68, Senior Member on 3rd December 2014, 11:45 AM
Post Reply Email Thread
1. What is the problem?
The implementation of FUSE by Google runs using the root-account. The disadvantage is that the standard user is not capable of changing any attribute including timestamp. A copy or move file operation usually keeps all attributes including date and time on all known operating system - except Android if FUSE is involved. This can complicate management of backups or syncing - and sorting or filtering by date is not helpful anymore.


2. What is concerned?
The problem exists at least on all file systems which are emulated by Android using FUSE. Android 8 and later uses SDCardFS and therefore is not concerned.

Concerned from Android 4.0: ext4, exFAT
Not Concerned on 4.0: FAT32
It seems FAT32 is done via FUSE in later Android versions also, so it seems every file system is concerned from 4.1 to last Android 7.

Most Android 4.x-devices are using ext4 for the file system of the internal storage and are therefore concerned. The usage of FAT32 which can not manage file greater than 4 GiB seems not appropriate anyway. For memory cards smaller than 64 GiB it is usual to use FAT32, bigger cards use exFAT by default.

It is possible to access external file systems, eg SAMBA or FTP, and then usually the timestamp is set correctly, because this is not part of FUSE and uses other file systems. AFAIK most file manager still try to set the timestamps, although it always fails without root, and ignore the error returned by FUSE, so copying and moving should be fine. At least Total Commander copies the timestamp fine if writing to Samba using the appropriate plug-in on non-rooted devices.


3. How to recognize/test the problem?
If you copy or move a file, the date and time should be kept. But if the destination on Android uses FUSE, instead of the original timestamp the current date/time is being set. Also all other attributes which the file system may manage (rights, owner, groups etc.) usually are concerned. The original values vanish.

If you want to see which file system is being used for internal memory or some external card you may use the app DiskInfo.
If it shows vfat, it means FAT32.



4. Which possibilities exist to correct the behavior?
Google fixed the bug in Android 8 which was known for a long time (start of 2009).
Google issue 34691 with links to related issues
With Android 8 usage of FUSE was removed, the problem was corrected
https://issuetracker.google.com/issu...892#comment120
(careful when using command line under Android 8: cp -a seems not always to be working, but touch -r will)

5. Which possibilities exist to circumvent the problem?

5.0. do not use Android for writing to filesystem: If you don't use Android for writing the files, setting the timestamp mostly will be fine. As mentioned in 4. you can use any filesharing server (Samba, ftp etc.). Storing your documents there instead of the local device will relocate the write access to the filesystem of the filesharing server, which usually manages timestamps fine. There also exist possibilities like adopted storage mode, where the SD card gets accessed by Linux and Android only is being used like a card reader.

As the files have the owner root, all possibilities to circumvent using Android need a rooted device. All following solutions shown here won't work for devices which are not rooted.

5.1. Afterwards correcting (not tested): In the app store there exists at least one app File Timestamp which can afterwards set the timestamp.

5.2. Samba Filesharing runs under root account. If some file is accessed via samba server, the time stamp and attributes can be set correctly.

5.3. Make use of a file manager which sets the timestamp using the power of root on a rooted device:
X-Plore sets file time after copying if root mode is enabled.
Ghost Commander is said to work fine (additional requirement: Busybox)
Total Commander 2.04 and newer support changing the time stamp under root account. On Android 5 and newer you need to use link /storage/xxxx-xxxx for external SD, not ///_Name, to make it behave correctly.
SManager by devwom also deals fine with timestamp using root
MiXplorer tries calling touch. The standard touch on some Android versions is faulty implemented, MiXplorer then only succeeds when BusyBox (internal download of MiX) is installed. Try if it works on your device with your current setup, and have a second look if the timezone correctly evaluated.

5.4. Manual call via command line: Who opens a terminal (eg Open Android Terminal) on a rooted device preferrably with BusyBox can execute commands as root.

Example 5.4.

Archive (also possible on Unix/Windows/etc)

cd <Quelle>
tar -cf <Pfad_zu_Archiv>/Archiv.tar *


Extract

cd <Ziel>
su
tar -xf <Pfad_zu_Archiv>/Archiv.tar


Copy

su
cp -a <Quelle> <Ziel>


The command su changes to root user, so that write access to time stamps is possible. It is always possible to read them, so that it is not necessary to su before archive.

Careful when calling touch: The standard implementation (toybox) seems to be faulty, it does not set the given time when called using -d or -t switch.
Careful when using Android 8 (root not required), it seems at least some implementation of cp does not set timestamp on cp -a
The Following 25 Users Say Thank You to tag68 For This Useful Post: [ View ] Gift tag68 Ad-Free
 
 
4th December 2014, 06:09 PM |#2  
jbowwow02's Avatar
Senior Member
Flag Colombo
Thanks Meter: 35
 
More
Does this affect F2FS as well?
The Following 2 Users Say Thank You to jbowwow02 For This Useful Post: [ View ] Gift jbowwow02 Ad-Free
4th December 2014, 07:46 PM |#3  
OP Senior Member
Thanks Meter: 346
 
More
As my current device Moto G uses f2fs for internal storage and I didn't root it by now the test was easy to do

Yes f2fs is also affected. Current time is being used for copy of a file. Thanks for the question, I will add this. Guess it also is implemented using fuse. Until someone tells the opposite I will add it to the fuse-managed fs.

There is another information which I want to add: That the default file manager on most os (Finder on Mac, Windows Explorer on Windows, even cp on Unix and copy on DOS iirc) keep time and attributes for files, but not for folders. Please if you test the behavior, watch files not folders. Although I'd like to keep timestamp there also, you can't rely on these anyway.

Keeping date/time of folders usually can be achieved across platforms when using any archiver. tar, zip, anything. Compress and extract keeps the date of folders. Total commander on Android also.
8th December 2014, 05:55 AM |#4  
OP Senior Member
Thanks Meter: 346
 
More
Issue 34691 is now marked as obsolete. Probably someone at Google has read my FAQ, and the bug won't be fixed. I just can ask the same question like the newest comment in the issue: is the issue obsolete, or is it Android?
9th December 2014, 09:42 PM |#5  
Senior Member
/etc/
Thanks Meter: 35
 
More
Quote:
Originally Posted by tag68

As my current device Moto G uses f2fs for internal storage and I didn't root it by now the test was easy to do

Yes f2fs is also affected. Current time is being used for copy of a file. Thanks for the question, I will add this. Guess it also is implemented using fuse. Until someone tells the opposite I will add it to the fuse-managed fs.

There is another information which I want to add: That the default file manager on most os (Finder on Mac, Windows Explorer on Windows, even cp on Unix and copy on DOS iirc) keep time and attributes for files, but not for folders. Please if you test the behavior, watch files not folders. Although I'd like to keep timestamp there also, you can't rely on these anyway.

Keeping date/time of folders usually can be achieved across platforms when using any archiver. tar, zip, anything. Compress and extract keeps the date of folders. Total commander on Android also.

Actually, from my experience:

Windows:
Explorer didn't maintain folder ts, only file. Total Commander has option to do so. Some archivers do maintain while some not, meaning it's possible on Windows.

Linux:
Most Explorer-like eg KDE's Konqueror didn't preserve ts. Midnight Commander can, the option when copying is there. Also cp -a or cp -prv works in Terminal. So its possible on Linux.

OSX:
I'm using MC too solely for this purpose (I'm a timestamp freak) because most file mangers on osx sux just like the os (not the underlying bsd core) Krusader even show wrong ts. Disk Order comes close but can't rival Total Commander on Windows, or Norton Commander, Volkov Commander on DOS or Midnight Commander on Linux/OSX for that matter. So also possible on OSX/HPFS.

Android:
The closest to almost able is Total Commander, and to some extent, later versions of ES File Manager. Most others simply failed even ones with root support. So I have to cp -a in Android if I have to maintain folder ts, so far I'm not able to get even TC to do that (don't know where's the option, is it there? You're implying as if it's there, do tell if so) Used 2.04 and 2.05 beta builds so far.

And also, I never get a single archiver on Android to extract timestampfor folder (files are fine obviously) except 7zip on vfat, but that means no permissions since 7zip is not unix native.

And oh, by that I meant 7za command line, not anything in apps aka shell, not going to use those archiver shells anytime (unless embedded in a file manager)
The Following User Says Thank You to kotey For This Useful Post: [ View ] Gift kotey Ad-Free
10th December 2014, 08:42 AM |#6  
OP Senior Member
Thanks Meter: 346
 
More
Quote:
Originally Posted by kotey

I'm using MC too solely for this purpose (I'm a timestamp freak) because most file mangers on osx sux just like the os (not the underlying bsd core) Krusader even show wrong ts. Disk Order comes close but can't rival Total Commander on Windows, or Norton Commander, Volkov Commander on DOS or Midnight Commander on Linux/OSX for that matter. So also possible on OSX/HPFS.

I'm using muCommander on OSX, it also keeps timestamps of folders.

Quote:
Originally Posted by kotey

Android:

Oh, guess I remembered wrong in this point that TC keeps timestamp of folders. I'll ask the author. Like I did for setting timestamp as root, I gave the authors of TC and ES Explorer the hint. While Christian Ghisler (TC) immediately answered and helped a lot, I did not get any reply from the authors of ES Explorer. Does it keep timestamp if you have root in the meantime?
12th December 2014, 01:16 PM |#7  
Senior Member
/etc/
Thanks Meter: 35
 
More
Quote:
Originally Posted by tag68

I'm using muCommander on OSX, it also keeps timestamps of folders.

Oh, guess I remembered wrong in this point that TC keeps timestamp of folders. I'll ask the author. Like I did for setting timestamp as root, I gave the authors of TC and ES Explorer the hint. While Christian Ghisler (TC) immediately answered and helped a lot, I did not get any reply from the authors of ES Explorer. Does it keep timestamp if you have root in the meantime?

Old ES doesn't keep ts of anything.
ES v3 has the same behaviour as TC, it keeps ts of files but not folders.

AFAIK both ES and TC doesn't actually require root in order to keep ts of files, just like cp -a did in a non-root shell (but cp will throw lots of permission copy error, just ignore those obvious warnings, in fact it does the job perfectly)
14th December 2014, 09:24 AM |#8  
OP Senior Member
Thanks Meter: 346
 
More
Just tested ES File Explorer on my unrooted Moto G: Without root it does not keep ts of files. Of course not. It can't. Like cp -a can not do what the OS does not allow.

On which file system did you test when it worked?
14th December 2014, 12:25 PM |#9  
OP Senior Member
Thanks Meter: 346
 
More
Just did a test on my rooted S3 for a file copy operation:

1. ES Explorer keeps timestamp on external SD card where it can write without root according to FAT32 on Android 4.1.2 where FUSE is not active for FAT32
2. ES does not keep timestamp when writing to internal sdcard where FUSE is active - it does not use the power of the root account to set it.

ES is not capable. For my mail 2013-10-23 to [email protected] there was no reply. Guess it was not read, or just ignored ... and I asked 2014-01-23 if my mail arrived and repeated the question, again without answer ... so I strongly recommend to prefer Total Commander at least for rooted devices.
16th March 2015, 11:07 PM |#10  
OP Senior Member
Thanks Meter: 346
 
More
The author of Total Commander now found out why the timestamp could not be copied under Lollipop. The next version sure will bring a fix.

For interested readers here the link to the German discussion . Cause of the problem was discussed on Stack overflow
15th May 2015, 04:28 PM |#11  
Senior Member
Thanks Meter: 32
 
More
Quote:
Originally Posted by tag68

Just did a test on my rooted S3 for a file copy operation:

1. ES Explorer keeps timestamp on external SD card where it can write without root according to FAT32 on Android 4.1.2 where FUSE is not active for FAT32
2. ES does not keep timestamp when writing to internal sdcard where FUSE is active - it does not use the power of the root account to set it.

ES is not capable. For my mail 2013-10-23 to [email protected] there was no reply. Guess it was not read, or just ignored ... and I asked 2014-01-23 if my mail arrived and repeated the question, again without answer ... so I strongly recommend to prefer Total Commander at least for rooted devices.

I'm dealing with this issue from sometime but only now I'm finding your fantastic thread (THANKS A LOT!!!!).

I have something slightly different about ES Explorer (v 3.2.5) :
- exactly as you say with JB 3.2 on a Sony M and an Asus tf101
- as it should be (preserving timestamps) on a Sony z1c with kitkat 4.4.4

Of course all the devices are rooted.

It's crucial for me to have timestamps preserved and I cannot afford to have on my devices two different file managers; unfortunately I'm forced to take the decision to leave ES Explorer and join Total Commander.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes