A.23 noatime and nodiratime Support for Linux open, mount, nfsmount, and /etc/fstab

NSS on OES 2 Linux supports the O_NOATIME option for the Linux open(2) command, and the noatime and nodiratime options for the mount and nfsmount command and the /etc/fstab file. These options have the same objective—that is, to prevent the access time from being updated unless the access involves a modification of a file’s or directory’s metadata or content.

These options are useful for backup, news servers, and mail servers where the extra disk activity associated with updating the access time is not desired. Avoiding the writes associated with updating the access time can result in measurable performance gains.

IMPORTANT:Typically, you need to use only the noatime option so that atime is not updated for the accessed file and its directory when the file is accessed. To determine if the noatime and nodiratime options can help the performance of a particular application, refer to the documentation and best practices for that application.

For information about applying these options, see the following:

A.23.1 Linux open(2) Command

By default, the open command updates the access time whenever a file is opened or a directory is accessed. The O_NOATIME option disables the updating of access time, so that reading a file does not update its access time. Using this option allows you to back up a volume without modifying the access times (ATIME) of its files.

The man page for the open(2) command defines the O_NOATIME option as follows:

O_NOATIME

(Since Linux 2.6.8) Do not update the file last access time when the file is read. This flag is intended for use by indexing or backup programs, where its use can significantly reduce the amount of disk activity.

For information about how to use the O_NOATIME option, see the man page for the Linux open(2) command by entering man 2 open at a terminal console prompt.

A.23.2 Linux mount Command

The noatime and nodiratime options for the mount command are available for all Linux file systems, including NSS.

IMPORTANT:Typically, you need to use only the noatime option so that atime is not updated for the accessed file and its directory when the file is accessed. To determine if the noatime and nodiratime options can help the performance of a particular application, refer to the documentation and best practices for that application.

To enable noatime or nodiratime options when mounting an NSS volume:

  1. Open a terminal console on the server, then log in as the root user.

  2. At the terminal console prompt, enter (all on the same line, of course):

    mount -t nssvol VOL vol_mountpoint -o name=volname,noatime 
    

    or

    mount -t nssvol VOL vol_mountpoint -o name=volname,nodiratime 
    

    Replace vol_mountpoint with the mount point for the volume, such as /media/nss/NSSV1. Replace volname with the name of the volume, such as NSSV1.

    For example, enter:

    mount -t nssvol VOL /media/nss/NSSV1 -o name=NSSV1,noatime
    

    This command mounts the volume NSSV1 with the noatime option so that the file and directory access times are not updated when a file is accessed but not modified.

A.23.3 Linux nfsmount Command

  1. In YaST, click Network Services > NFS Server > NFS Mount.

  2. Specify the volume, then enter

    rw,no_root_squash,sync,fsid=value,noatime
    

    For information about the other nfsmount options used here, see Section 18.16, Exporting and Importing NSS Volumes for NFS Access.

  3. Click OK.

A.23.4 Linux /etc/fstab File

The noatime and nodiratime options are available as mount options in the /etc/fstab file for all Linux file systems, including NSS. To enable the noatime and nodiratime options as default mounting options for a volume so they are in effect at boot time, modify the entry for the NSS volume in the /etc/fstab file.

  1. Open the /etc/fstab file in a text editor.

  2. Modify the entry for the NSS volume by adding noatime or nodiratime as options.

    For example, type

    volname vol_mountpoint nssvol noauto,rw,name=volname,noatime 0 0
    

    Replace volname with the name of the volume, such as NSSV1. Replace vol_mountpoint with the mount location of the NSS volume, such as /media/nss/NSSV1.

    For example (all on the same line, of course):

    NSSV1 /media/nss/NSSV1 nssvol noauto,rw,name=NSSV1,noatime 0 0
    
  3. Save the file.

  4. Reboot the server to apply the changes.

A.23.5 Patches for km_nss

NSS support for access time options is delivered in the km_nss RPM in the Linux kernel. For the latest patches for the km_nss module in SUSE Linux Enterprise Server 10, visit the Novell Support Patches & Security Web site.