Rate This Document
Findability
Accuracy
Completeness
Readability

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 change time, modify time, and access 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).

    Generally, files are read more often than written, and the access time is a metric of the least importance. The noatime option prevents the access time from being updated when a program accesses a file or folder. The system resources can be saved as the file system does not record the access time.

  1. To prevent data loss, many file systems have the underlying devices forcibly refresh their caches when data is submitted. This is called write barriers. 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. Therefore, it is secure to mount the file system without barrier.
    • For the ext3, ext4, and reiserfs file systems, set barrier to 0 when mounting the file system.
    • For the XFS, specify the nobarrier option.

    openEuler does not support the nobarrier option.