Is it possible to skip writing to cache for a GFS2 Filesystems?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux Server 6, 7, 8, and 9
  • High Availability Add On
  • Resilient Storage Add Ons
  • A Global Filesystem 2(gfs2)

Issue

While it is possible for processes writing to a gfs2 filesystem to skip caching or flush every write immediately, this is generally not advised:

The default behavior of writing to cache first and then flushing ( async ) is the recommend behavior. Red Hat does not advise skipping cache as this will severely reduce system performance and potentially reduce the lifetime of your storage devices.

Resolution

Mounting a gfs2 filesystem with the sync option will ensure that every new write is immediately flushed to disk. This solution is rarely needed though and not recommended. If it is required to use this option it is highly recommended to test the option thoroughly in a lower environment prior to placing this in production:

$ man mount
-----------------------------------------8<----------------------------------------- 
       sync
           All I/O to the filesystem should be done synchronously. In the case of media with a limited
           number of write cycles (e.g. some flash drives), sync may cause life-cycle shortening.

The above solution is rarely required and in most cases will cause a negative impact to system performance and possibly the storage as well. It is strongly advised to avoid using this option, and seek another solution where possible.

Possible Alternative Solutions:
SBR
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.