Rate This Document
Findability
Accuracy
Completeness
Readability

Tuning File System

Modify file system parameters to improve server performance.

Method

This section 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 (replace the data drive and data directory with the actual ones):

1
mount -o /dev/sdb /data
  • 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 indicates the last time when the inode of a file (such as location, user attribute, and group attribute) was changed.

    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.

  • 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 either 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 using nobarrier.
    • 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.