我要评分
获取效率
正确性
完整性
易理解

Tuning the File System

Purpose

Modify file system parameters to improve server performance.

Procedure

The following uses the XFS file system as an example.

Add the noatime and nobarrier options to the mount parameter of the file system. Run the following command (use the actual data drive and data directory in your own project):

1
mount -o noatime,nobarrier /dev/sdb /data
  1. Generally, Linux records the access time, modify time and change time for files.
    • The access time indicates the last time when a file was read.
    • The modify time indicates the last time when a file was modified.
    • The change time refers to the last time when the inode of a file was changed (such as the change in location, user attribute, and group attribute).

    In most circumstances, operations on a file are more reads than writes, and users rarely pay attention to the time when a file was recently accessed. Therefore, you are advised to use the noatime option so that the file system does not update the access time when a program accesses a file or folder. Selecting the noatime option avoids unnecessary resource waste.

  2. To avoid data loss, many file systems use write barriers to forcibly flush the cache during data submission. However, the underlying storage devices of database servers use RAID controller cards, whose batteries provide power-off data protection, or flash cards, which also have data protection mechanisms, to prevent data loss. In this case, you can use nobarrier to mount the file system to avoid performance loss caused by write barriers.
    • For the ext3, ext4, and ReiserFS file systems, set barrier to 0 when mounting the file system.
    • For the XFS file system, specify the nobarrier option.

      openEuler does not support the nobarrier option.