Operating System - Linux
1827286 Members
2984 Online
109717 Solutions
New Discussion

Re: Disabling file access time

 
Danny Fang
Frequent Advisor

Disabling file access time

Hi,

I'm trying to disable the access time for a frequently accessed files in the /var/spool area by doing:
$ chattr -A
$date
Wed May 18 21:27:18 MYT 2005
/var/spool/ >>ls -l --time=atime tstgrep
-rw-r--r-- 1 root dasadm1 40 May 18 21:11 tstgrep
/root >>chattr -A tstgrep
/root >>vi tstgrep
/root >>ls -l --time=atime tstgrep
-rw-r--r-- 1 root dasadm1 40 May 18 21:27 tstgrep

From the output above, chattr -A option did not seem to take effect by ignoring the new access time for the file tstgrep (21:27).

May what is the method of disabling the access time to the files on a Linux Red Hat 8?

Thanks
Danny
2 REPLIES 2
Stuart Browne
Honored Contributor

Re: Disabling file access time

Access time (atime) and modification time (mtime) are different parts of the inode structure.

chattr -A

will only disable the updating of 'atime'.

There is no way to disable updating of a modification time. I can't think of any possible reason you'd want to, that doesn't involve hiding the fact that you've been playing around with things.

If you despratly need to change a modification time, look at the 'touch' command.
One long-haired git at your service...
Gopi Sekar
Honored Contributor

Re: Disabling file access time


I believe you should try with +A option of chattr.

eg: chatr +A tstgrep

A is for 'no atime updates' so you should enable it with +A.

Regards,
Gopi
Never Never Never Giveup