Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

2.2. Differences between GFS and GFS2

This section lists the improvements and changes that GFS2 offers over GFS.
Migrating from GFS to GFS2 requires that you convert your GFS file systems to GFS2 with the gfs2_convert utility. For information on the gfs2_convert utility, see Appendix A, Converting a File System from GFS to GFS2.

2.2.1. GFS2 Command Names

In general, the functionality of GFS2 is identical to GFS. The names of the file system commands, however, specify GFS2 instead of GFS. Table 2.1, “GFS and GFS2 Commands” shows the equivalent GFS and GFS2 commands.

Table 2.1. GFS and GFS2 Commands

GFS CommandGFS2 CommandDescription
mountmountMount a file system. The system can determine whether the file system is a GFS or GFS2 file system type. For information on the GFS2 mount options see the gfs2_mount(8) man page.
umountumountUnmount a file system.
Check and repair an unmounted file system.
gfs_growgfs2_growGrow a mounted file system.
gfs_jaddgfs2_jaddAdd a journal to a mounted file system.
mkfs -t gfs
mkfs -t gfs2
Create a file system on a storage device.
gfs_quotagfs2_quotaManage quotas on a mounted file system.
gfs_toolgfs2_toolConfigure, tune, or gather information about a file system.
gfs_editgfs2_editDisplay, print, or edit file system internal structures. The gfs2_edit command can be used for GFS file systems as well as GFS2 file system.
gfs_tool setflag jdata/inherit_jdatachattr +j (preferred)Enable journaling on a file or directory.
setfacl/getfaclsetfacl/getfacl Set or get file access control list for a file or directory.
setfattr/getfattrsetfattr/getfattr set or get the extended attributes of a file.
For a full listing of the supported options for the GFS2 file system commands, see the man pages for those commands.

2.2.2. Additional Differences Between GFS and GFS2

This section summarizes the additional differences in GFS and GFS2 administration that are not described in Section 2.2.1, “GFS2 Command Names”.

Context-Dependent Path Names

GFS2 file systems do not provide support for context-dependent path names, which allow you to create symbolic links that point to variable destination files or directories. For this functionality in GFS2, you can use the bind option of the mount command. For information on managing pathnames in GFS2, see Section 4.12, “Bind Mounts and Context-Dependent Path Names”.

gfs2.ko Module

The kernel module that implements the GFS file system is gfs.ko. The kernel module that implements the GFS2 file system is gfs2.ko.

Enabling Quota Enforcement in GFS2

In GFS2 file systems, quota enforcement is disabled by default and must be explicitly enabled. To enable and disable quotas for GFS2 file systems, you use the quota=on|off|account option for the mount command. For information on enabling and disabling quota enforcement, see Section 4.5.4, “Enabling/Disabling Quota Enforcement”.

Data Journaling

GFS2 file systems support the use of the chattr command to set and clear the j flag on a file or directory. Setting the +j flag on a file enables data journaling on that file. Setting the +j flag on a directory means "inherit jdata", which indicates that all files and directories subsequently created in that directory are journaled. Using the chattr command is the preferred way to enable and disable data journaling on a file.

Adding Journals Dynamically

In GFS file systems, journals are embedded metadata that exists outside of the file system, making it necessary to extend the size of the logical volume that contains the file system before adding journals. In GFS2 file systems, journals are plain (though hidden) files. This means that for GFS2 file systems, journals can be dynamically added as additional servers mount a file system, as long as space remains on the file system for the additional journals. For information on adding journals to a GFS2 file system, see Section 4.7, “Adding Journals to a File System”.

atime_quantum parameter removed

The GFS2 file system does not support the atime_quantum tunable parameter, which can be used by the GFS file system to specify how often atime updates occur. In its place GFS2 supports the relatime and noatime mount options. The relatime mount option is recommended to achieve similar behavior to setting the atime_quantum parameter in GFS.

The data= option of the mount command

When mounting GFS2 file systems, you can specify the data=ordered or data=writeback option of the mount. When data=ordered is set, the user data modified by a transaction is flushed to the disk before the transaction is committed to disk. This should prevent the user from seeing uninitialized blocks in a file after a crash. When data=writeback is set, the user data is written to the disk at any time after it is dirtied. This does not provide the same consistency guarantee as ordered mode, but it should be slightly faster for some workloads. The default is ordered mode.

The gfs2_tool command

The gfs2_tool command supports a different set of options for GFS2 than the gfs_tool command supports for GFS:
  • The gfs2_tool command supports a journals parameter that prints out information about the currently configured journals, including how many journals the file system contains.
  • The gfs2_tool command does not support the counters flag, which the gfs_tool command uses to display GFS statistics.
  • The gfs2_tool command does not support the inherit_jdata flag. To flag a directory as "inherit jdata", you can set the jdata flag on the directory or you can use the chattr command to set the +j flag on the directory. Using the chattr command is the preferred way to enable and disable data journaling on a file.

The gfs2_edit command

The gfs2_edit command supports a different set of options for GFS2 than the gfs_edit command supports for GFS. For information on the specific options each version of the command supports, see the gfs2_edit and gfs_edit man pages.

2.2.3. GFS2 Performance Improvements

There are many features of GFS2 file systems that do not result in a difference in the user interface from GFS file systems but which improve file system performance.
A GFS2 file system provides improved file system performance in the following ways:
  • Better performance for heavy usage in a single directory
  • Faster synchronous I/O operations
  • Faster cached reads (no locking overhead)
  • Faster direct I/O with preallocated files (provided I/O size is reasonably large, such as 4M blocks)
  • Faster I/O operations in general
  • Faster Execution of the df command, because of faster statfs calls
  • Improved atime mode to reduce the number of write I/O operations generated by atime when compared with GFS
GFS2 file systems provide broader and more mainstream support in the following ways:
  • GFS2 is part of the upstream kernel (integrated into 2.6.19).
  • GFS2 supports the following features.
    • extended file attributes (xattr)
    • the lsattr() and chattr() attribute settings via standard ioctl() calls
    • nanosecond timestamps
A GFS2 file system provides the following improvements to the internal efficiency of the file system:
  • GFS2 uses less kernel memory.
  • GFS2 requires no metadata generation numbers.
    Allocating GFS2 metadata does not require reads. Copies of metadata blocks in multiple journals are managed by revoking blocks from the journal before lock release.
  • GFS2 includes a much simpler log manager that knows nothing about unlinked inodes or quota changes.
  • The gfs2_grow and gfs2_jadd commands use locking to prevent multiple instances running at the same time.
  • The ACL code has been simplified for calls like creat() and mkdir().
  • Unlinked inodes, quota changes, and statfs changes are recovered without remounting the journal.