HowTo Disable The "relatime" Method For File "atime" Updates

From NST Wiki
Jump to: navigation, search


Warning.png This Artical Applies to Kernels Prior to v2.6.30

  • For Kernel v2.6.30 or greater, use the mount command with a combination of the "remount", "relatime", "atime" and/or the "strictatime" option for the desired "access" time update method.

This "HowTo" explains various ways to disable the "relatime" method in the Linux Kernel for updating the "atime" field for a file when a process "read" occurs. One should consider only disabling the "relatime" method for audit or debugging purposes. A significant disk I/O performance hit may occur for an active Linux server if this method is disabled.

NST has the "relatime" Kernel update "atime" method enabled by default.


The "Access time" field for a file within a given file system is know as: "atime". When a process reads a file, the "atime" field is updated with the current date/time for this access. Completely disabling "atime" updates using the "noatime" mount flag is probably one of the biggest performance tweaks that a Linux administrator can make. An active Linux server is continually reading files which generates a significant number of "atime" updates. This translates to numerous metadata updates made to the file system by writes to the physical disk which can lead to poor I/O performance.


The Linux Kernel supports the "Relative atime" (relatime) update method. A "relatime" update will only write the "atime" field if the previous "atime" is older than the "mtime" (modify time) or "ctime" (change status time) for the file. Therefore, only "One" "atime" field update will occur after either a "mtime" or "ctime" change regardless of the number of subsequent file read access attempts that occur. The "relatime" method for updating the "atime" field indicates that at least one or more process read attempts have been made on the file.

This technique can avoid a significant number of metadata "atime" updates. It's similar to the "noatime" mount option, but useful for applications like "mutt" that need to know when a file has been read since it was last modified.

relatime Method: Interval Adjustment

The interval update period for the "atime" field using the "relatime" last access time stamp method for a file can be adjusted using the Kernel parameter: "relatime_interval". This value is in "seconds" and is defaulted to: "86400 secs" (Number of seconds in a day). This makes the "relatime" update method a compatible solution for HSM, mailer-notification and tmpwatch applications.

The example below uses the "sysctl" command to adjust the "relatime_interval" parameter to: "10 minutes" for the "/" (root) file system. One needs to also use the "mount" command to "remount" the file system for the change to take effect.

[root@probe ~]# /sbin/sysctl -w fs.relatime_interval=600
fs.relatime_interval = 600
[root@probe ~]# /bin/mount -v -o remount /dev/sda1
/dev/sda1 on / type ext3 (rw)
[root@probe ~]#

relatime Method: Disable Online

The Kernel parameter: "default_relatime" controls whether the "relatime" method for "atime" updates is enabled or not. Set the value to: "1" (Default for NST) to enable the method or set it to: "0" to disable.

The example below uses the "sysctl" command to disable the "relatime" method for "atime" updates for the "/" (root) file system. One needs to also use the "mount" command to "remount" the file system for the change to take effect.

[root@probe ~]# /sbin/sysctl -w fs.default_relatime=0
fs.default_relatime = 0
[root@probe ~]# /bin/mount -v -o remount /dev/sda1
/dev/sda1 on / type ext3 (rw)
[root@probe ~]#

relatime Method: Disable At Boot Time

Use the following boot option to disable the "relatime" method for "atime" updates: "default_relatime=0".