Linux Mount mount parameter optimization

Source: Internet
Author: User

One

1) Blue : Indicates optimized XFS

Parameters at Mount
defaults,noatime,nodiratime,nobarrier,discard,allocsize=256m,logbufs=8,attr2,logbsize=256k

2) Gray : Indicates the default XFS

Parameters at Mount
Defaults,noatime,nodiratime,nobarrier

3) yellow : Indicates EXT4.

Parameters for Mount:
Defaults,noatime,nodiratime,nobarrier

Two

Noatime
Do not update inode access times on this filesystem (e.g., for faster access on the news spool to speed up news
servers).

Nodiratime
Do not update the directory inode access times on the this filesystem.

Nobarrier
Enable/disable the use of Block-layer write barriers. Write barriers ensure that certain IOs make it through the
Device cache and is on persistent storage. If disabled on a device with a volatile (non-battery-backed) Write-back
Cache, the Nobarrier option would lead to filesystem corruption on a system crash or power loss.

Three

 /proc/mounts              //View detailed mount parameters (file system), including important mounted items that are not displayed. For example:/dev/pts 

c121 Admin # cat/proc/mounts
/DEV/MD2/EXT4 rw,noatime,data=ordered 0 0
PROC/PROC proc Rw,nosuid,nodev,noexec,relatime 0 0
Tmpfs/run Tmpfs rw,nodev,relatime,size=1623100k,mode=755 0 0
Dev/dev Devtmpfs rw,nosuid,relatime,size=10240k,nr_inodes=2028409,mode=755 0 0
devpts/dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620 0 0
Shm/dev/shm Tmpfs rw,nosuid,nodev,noexec,relatime 0 0
Sysfs/sys Sysfs rw,nosuid,nodev,noexec,relatime 0 0
Cgroup_root/sys/fs/cgroup Tmpfs rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755 0 0
Selinuxfs/sys/fs/selinux selinuxfs rw,relatime 0 0
OPENRC/SYS/FS/CGROUP/OPENRC Cgroup rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/ CGROUP-RELEASE-AGENT.SH,NAME=OPENRC 0 0
/dev/md1/boot ext3 rw,noatime,data=ordered 0 0
/dev/md3/app ext4 rw,noatime,data=ordered 0 0

D. Need to set noatime and Nodiratime at the same time?

April 1, 2010

Friends who are interested in performance and optimizing these keywords know that setting up Noatime can significantly improve file system performance when mounting file systems under Linux. by default, the Linux ext2/ext3 file system records some timestamp of the file when it is accessed, created, modified, and so on, such as the file creation time, the last modification time, and the last access time. Because the system is running to access a large number of files, if you can reduce some of the actions (such as reducing the number of time-stamp records, etc.) will significantly improve the efficiency of disk IO, improve the performance of the file system. Linux provides noatime This parameter to prohibit logging of the most recent access timestamp.

Adding the Noatime parameter to file system mounts can significantly improve file system performance:

# vi/etc/fstab/dev/sda1        /             ext3     defaults,noatime,errors=remount-ro 0 0devpts           /dev/pts      devpts   gid=5,mode=620             0 0proc             /proc         proc     defaults                   0 0/dev/sda2        swap          swap     Defaults,noatime           0 0

After you modify the settings, you only need to mount the file system again, and you can 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/d Ev/pts type devpts (rw,gid=5,mode=620) None On/proc/sys/fs/binfmt_misc type Binfmt_misc (rw)

Online A lot of information are mentioned to set Noatime and Nodiratime at the same time, do not know where this conclusion came from, in fact, do not need to set Noatime as the setting nodiratime, the most reliable information should be the source code, vpsee Check the source code, found in the kernel source code LINUX-2.6.33/FS/INODE.C file has a touch_atime function, you can see if the Inode's mark bit is NOATIME, and then return directly, simply can't go to nodiratime there, so only set NOATIME can , you don't have to set the Nodiratime again.

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}

Linux Mount mount parameter optimization

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.