Noatime and nodiratime settings I believe that anyone interested in the performance and optimization keywords knows that setting noatime when mounting a file system under Linux can significantly improve the performance of the file system. By default, the Linuxext2/ext3 file system is accessed in the file... noatime and nodiratime settings I believe that anyone interested in the performance and optimization keywords knows that setting noatime when mounting a file system under Linux can significantly improve the performance of the file system. By default, the Linux ext2/ext3 file system records the timestamp of the file when the file is accessed, created, or modified. for example: file creation time, last modification time, and last access time. Because the system needs to access a large number of files during operation, if it can reduce some actions (such as reducing the number of timestamp records, etc.), it will significantly improve the disk IO efficiency and file system performance. Linux provides the noatime parameter to prohibit the recording of the last access timestamp. Adding the noatime parameter to the file system at www.2cto.com can greatly improve the file system performance: # vi/etc/fstab/dev/sda1/ext3 defaults, noatime, errors = remount-ro 0 0 devpts/dev/pts devpts gid = 5, mode = 620 0 0 proc/proc defaults 0 0 0/dev/sda2 swap defaults, after noatime 0 is changed, you only need to re-mount the file system and apply the new settings without restarting: # mount-o remount/# mount/dev/sda1 on/type ext3 (rw, noatime, errors = remount-ro) proc on/proc type proc (rw) devpts on/dev/pts type devpts (rw, gid = 5, mode = 620) none on/proc/sys/fs/binfmt_misc type binfmt_misc (rw) many materials on the Internet mentioned that noatime and nodiratime should be set at the same time. I don't know where this conclusion comes from. In fact, I don't need to set nodiratime as I set noatime. the most reliable information should be the source code, VPSee looked at the source code, found in the kernel source code linux-2.6.33/fs/inode. there is a touch_atime function in the c file. it can be seen that if the inode tag bit is NOATIME, it will be returned directly, and it will not go to NODIRATIME at all, so you can set noatime only, no need to set nodiratime. www.2cto.com void touch_atime (struct vfsmount * mnt, struct dentry * dentry) 1405 {1406 struct inode * inode = dentry-> d_inode; 1407 struct timespec now; 14081409 if (inode-> I _flags & S_NOATIME) 1410 return; 1411 if (IS_NOATIME (inode) 1412 return; 1413 if (inode-> I _sb-> s_flags & MS_NODIRATIME) & S_ISDIR (inode-> I _mode) 1414 return; 14151416 if (mnt-> mnt_flags & MNT_NOATIME) 1417 return; 1418 if (mnt-> mnt_flags & MNT_NODIRATIME) & S_ISDIR (inode-> I _mode) 1419 return ;... 1435}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service