5

Is there a way to disable the mtime of an filesystem?

There is an Filesystem independend noatime Option, but no "nomtime". Also in the Filesystem specific documentation for ext4 and/or btrfs i couldn't find this.

Does this exist?

  • Why do you need this? – Sven Jul 05 '16 at 07:45
  • Testcase. Windows Software on SAMBA Share is reacting on the mtime not the way we want it to. For testing purposes we want to disable mtime to further debug this issue. – 白川 マセル Jul 05 '16 at 07:52
  • 2
    Check that you don't have a time synchronisation problem, I would not be surprised if things react strangely to "things modified in the future". – Vatine Jul 05 '16 at 08:21

2 Answers2

6

There is no such option in the kernel.

include/linux/statfs.h:

#define ST_NOATIME  0x0400  /* do not update access times */
#define ST_NODIRATIME   0x0800  /* do not update directory access times */
#define ST_RELATIME 0x1000  /* update atime relative to mtime/ctime */

I cannot think of any functional purpose for this option other than for testing purposes (your use case).

Your options are:

  • Patch the kernel to add this option
  • Patch the client software to not react to modify time.
Joshua Griffiths
  • 2,202
  • 15
  • 19
4

I found that there is the S_NOCMTIME flag in include/linux/fs.h:

#define S_NOCMTIME    128     /* Do not update file c/mtime */

which seems to do what's needed. Apparently it's not exposed to users though, but there are examples of using it (just grep for it), so one should be able to hack a little patch for the according file system.

An actual use case would be avoiding inode updates when writing small chunks of data to a fixed-size circular buffer (e.g. to avoid needless erase cycles on NAND-based storage).

Superlexx
  • 41
  • 2