Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
Global File System 2
Configuring and managing GFS2 file systems
Abstract
Chapter 1. GFS2 Overview
GETLK
function since, in a clustered environment, the process ID may be for a different node in the cluster. In most cases however, the functionality of a GFS2 file system is identical to that of a local file system.
gfs2.ko
kernel module implements the GFS2 file system and is loaded on GFS2 cluster nodes.
1.1. GFS2 Support Limits
Table 1.1. GFS2 Support Limits
Maximum number of node |
16 (x86, Power8 on PowerVM)
4 (s390x under z/VM)
|
Maximum file system size | 100TB on all supported architectures |
Note
fsck.gfs2
command on a very large file system can take a long time and consume a large amount of memory. Additionally, in the event of a disk or disk subsystem failure, recovery time is limited by the speed of your backup media. For information on the amount of memory the fsck.gfs2
command requires, see Section 3.10, “Repairing a GFS2 File System”.
clvmd
, which manages LVM logical volumes in a cluster. The daemon makes it possible to use LVM2 to manage logical volumes across a cluster, allowing all nodes in the cluster to share the logical volumes. For information on the LVM volume manager, see Logical Volume Manager Administration.
Note
1.2. New and Changed Features
1.2.1. New and Changed Features for Red Hat Enterprise Linux 7.0
- For Red Hat Enterprise Linux 7, a cluster that includes a GFS2 file system requires that you configure your cluster with Pacemaker according to the procedure described in Chapter 5, Configuring a GFS2 File System in a Cluster.
- The
gfs2_tool
command is not supported in Red Hat Enterprise Linux 7. Replacement functions for thegfs2_tool
are summarized in Section 1.5, “Replacement Functions for gfs2_tool in Red Hat Enterprise Linux 7”.
1.2.2. New and Changed Features for Red Hat Enterprise Linux 7.1
1.2.3. New and Changed Features for Red Hat Enterprise Linux 7.2
1.2.4. New and Changed Features for Red Hat Enterprise Linux 7.4
1.3. Before Setting Up GFS2
- GFS2 nodes
- Determine which nodes in the cluster will mount the GFS2 file systems.
- Number of file systems
- Determine how many GFS2 file systems to create initially. (More file systems can be added later.)
- File system name
- Determine a unique name for each file system. The name must be unique for all
lock_dlm
file systems over the cluster. Each file system name is required in the form of a parameter variable. For example, this book uses file system namesmydata1
andmydata2
in some example procedures. - Journals
- Determine the number of journals for your GFS2 file systems. One journal is required for each node that mounts a GFS2 file system. GFS2 allows you to add journals dynamically at a later point as additional servers mount a file system. For information on adding journals to a GFS2 file system, see Section 3.6, “Adding Journals to a GFS2 File System”.
- Storage devices and partitions
- Determine the storage devices and partitions to be used for creating logical volumes (using CLVM) in the file systems.
- Time protocol
- Make sure that the clocks on the GFS2 nodes are synchronized. It is recommended that you use the Precision Time Protocol (PTP) or, if necessary for your configuration, the Network Time Protocol (NTP) software provided with your Red Hat Enterprise Linux distribution.
Note
The system clocks in GFS2 nodes must be within a few minutes of each other to prevent unnecessary inode time stamp updating. Unnecessary inode time stamp updating severely impacts cluster performance.
Note
1.4. Installing GFS2
gfs2-utils
package for GFS2 and the lvm2-cluster
package for the Clustered Logical Volume Manager (CLVM). The lvm2-cluster
and gfs2-utils
packages are part of ResilientStorage
channel, which must be enabled before installing the packages.
yum install
command to install the Red Hat High Availability Add-On software packages:
# yum install lvm2-cluster gfs2-utils
1.5. Replacement Functions for gfs2_tool in Red Hat Enterprise Linux 7
gfs2_tool
command is not supported in Red Hat Enterprise Linux 7. Table 1.2, “gfs2_tool Equivalent Functions in Red Hat Enterprise Linux 7” summarizes the equivalent functionality for the gfs2_tool
command options in Red Hat Enterprise Linux 7.
Table 1.2. gfs2_tool Equivalent Functions in Red Hat Enterprise Linux 7
gfs2_tool option | Replacement Functionality |
---|---|
clearflag Flag File1 File2 ...
Clear an attribute flag on a file
| Linux standard chattr command |
freeze mountpoint
Freeze (quiesce) a GFS2 file system
| Linux standard fsfreeze -f mountpoint command |
gettune mountpoint
Print out current values of tuning parameters
| For many cases, has been replaced by mount (get mount options ). Other tuning parameters may be fetched from the respective sysfs files: /sys/fs/gfs2/dm-3/tune/* . |
journals mountpoint
Print out information on the journals in a GFS2 file system
|
Information about journals can be fetched with
gfs2_edit -p journals device . You can run this command when the file system is mounted.
#
|
lockdump mountpoint
Print out information about the locks this machine holds for a given file system
|
The GFS2 lock information may be obtained by mounting
debugfs , then executing a command like such as the following:
#
|
sb device proto [newvalue]
View (and possibly replace) the locking protocol
|
To fetch the current value of the locking protocol, you can use the following command:
#
To replace the current value of the locking protocol, you can use the following command:
#
|
sb device table [newvalue]
View (and possibly replace) the name of the locking table
|
To fetch the current value of the name of the locking table, you can use the following command:
#
To replace the current value of the name of the locking table, you can use the following command:
#
|
sb device ondisk [newvalue]
View (and possibly replace) the
ondisk format number
| Do not perform this task. |
sb device multihost [newvalue]
View (and possibly replace) the
multihost format number
| Do not perform this task. |
sb device uuid [newvalue]
View (and possibly replace) the
uuid value
|
To fetch the current value of the
uuid , you can use the following command:
#
To replace the current value of the
uuid , you can use the following command:
#
|
sb device all
Print out the GFS2 superblock
|
#
|
setflag Flag File1 File2 ...
Sets an attribute flag on a file
| Linux standard chattr command |
settune mountpoint parameter newvalue
Set the value of a tuning parameter
|
For many cases, has been replaced by
mount (-o remount with options). Other tuning parameters may be set by the respective sysfs files: /sys/fs/gfs2/cluster_name:file_system_name/tune/*
|
unfreeze mountpoint
Unfreeze a GFS2 file system
| Linux standard fsfreeze -unfreeze mountpoint command |
version
Displays version of the gfs2_tool command
| N/A |
withdraw mountpoint
Cause GFS2 to abnormally shutdown a given file system
|
#
|
Chapter 2. GFS2 Configuration and Operational Considerations
Important
2.1. Formatting Considerations
2.1.1. File System Size: Smaller Is Better
- Less time is required to back up each file system.
- Less time is required if you need to check the file system with the
fsck.gfs2
command. - Less memory is required if you need to check the file system with the
fsck.gfs2
command.
2.1.2. Block Size: Default (4K) Blocks Are Preferred
mkfs.gfs2
command attempts to estimate an optimal block size based on device topology. In general, 4K blocks are the preferred block size because 4K is the default page size (memory) for Linux. Unlike some other file systems, GFS2 does most of its operations using 4K kernel buffers. If your block size is 4K, the kernel has to do less work to manipulate the buffers.
2.1.3. Number of Journals: One For Each Node That Mounts
gfs2_jadd
command. With GFS2, you can add journals on the fly.
2.1.4. Journal Size: Default (128MB) Is Usually Optimal
mkfs.gfs2
command to create a GFS2 file system, you may specify the size of the journals. If you do not specify a size, it will default to 128MB, which should be optimal for most applications.
2.1.5. Size and Number of Resource Groups
mkfs.gfs2
command, it divides the storage into uniform slices known as resource groups. It attempts to estimate an optimal resource group size (ranging from 32MB to 2GB). You can override the default with the -r
option of the mkfs.gfs2
command.
- First, when a resource group is completely full, it remembers that and tries to avoid checking it for future allocations (until a block is freed from it). If you never delete files, contention will be less severe. However, if your application is constantly deleting blocks and allocating new blocks on a file system that is mostly full, contention will be very high and this will severely impact performance.
- Second, when new blocks are added to an existing file (for example, appending) GFS2 will attempt to group the new blocks together in the same resource group as the file. This is done to increase performance: on a spinning disk, seeks take less time when they are physically close together.
2.2. File System Fragmentation
filefrag
tool, copying them to temporary files, and renaming the temporary files to replace the originals.
2.3. Block Allocation Issues
2.3.1. Leave Free Space in the File System
2.3.2. Have Each Node Allocate Its Own Files, If Possible
2.3.3. Preallocate, If Possible
fallocate
(1) system call, which you can use to preallocate blocks of data.
2.4. Cluster Considerations
2.5. Usage Considerations
2.5.1. Mount Options: noatime and nodiratime
noatime
and nodiratime
arguments. This allows GFS2 to spend less time updating disk inodes for every access. For more information on the effect of these arguments on GFS2 file system performance, see Section 2.9, “GFS2 Node Locking”.
2.5.2. VFS Tuning Options: Research and Experiment
sysctl
(8) command. For example, the values for dirty_background_ratio
and vfs_cache_pressure
may be adjusted depending on your situation. To fetch the current values, use the following commands:
#sysctl -n vm.dirty_background_ratio
#sysctl -n vm.vfs_cache_pressure
#sysctl -w vm.dirty_background_ratio=20
#sysctl -w vm.vfs_cache_pressure=500
/etc/sysctl.conf
file.
2.5.3. SELinux on GFS2
seclabel
element on each file system object by using one of the context
options as described on the mount
(8) man page; SELinux will assume that all content in the file system is labeled with the seclabel
element provided in the context
mount options. This will also speed up processing as it avoids another disk read of the extended attribute block that could contain seclabel
elements.
mount
command to mount the GFS2 file system if the file system is going to contain Apache content. This label will apply to the entire file system; it remains in memory and is not written to disk.
# mount -t gfs2 -o context=system_u:object_r:httpd_sys_content_t:s0 /dev/mapper/xyz/mnt/gfs2
public_content_rw_t
or public_content_t
, or you could define a new label altogether and define a policy around it.
2.5.4. Setting Up NFS Over GFS2
Warning
localflocks
option. Because utilizing the localflocks
option prevents you from safely accessing the GFS2 filesystem from multiple locations, and it is not viable to export GFS2 from multiple nodes simultaneously, it is a support requirement that the GFS2 file system be mounted on only one node at a time when using this configuration. The intended effect of this is to force POSIX locks from each server to be local: non-clustered, independent of each other. This is because a number of problems exist if GFS2 attempts to implement POSIX locks from NFS across the nodes of a cluster. For applications running on NFS clients, localized POSIX locks means that two clients can hold the same lock concurrently if the two clients are mounting from different servers, which could cause data corruption. If all clients mount NFS from one server, then the problem of separate servers granting the same locks independently goes away. If you are not sure whether to mount your file system with the localflocks
option, you should not use the option. Contact Red Hat support immediately to discuss the appropriate configuration to avoid data loss. Exporting GFS2 via NFS, while technically supported in some circumstances, is not recommended.
localflocks
, so that GFS2 will manage the POSIX locks and flocks between all the nodes in the cluster (on a cluster-wide basis). If you specify localflocks
and do not use NFS, the other nodes in the cluster will not have knowledge of each other's POSIX locks and flocks, thus making them unsafe in a clustered environment
- Red Hat supports only Red Hat High Availability Add-On configurations using NFSv3 with locking in an active/passive configuration with the following characteristics:
- The back-end file system is a GFS2 file system running on a 2 to 16 node cluster.
- An NFSv3 server is defined as a service exporting the entire GFS2 file system from a single cluster node at a time.
- The NFS server can fail over from one cluster node to another (active/passive configuration).
- No access to the GFS2 file system is allowed except through the NFS server. This includes both local GFS2 file system access as well as access through Samba or Clustered Samba. Accessing the file system locally via the cluster node from which it is mounted may result in data corruption.
- There is no NFS quota support on the system.
This configuration provides High Availability (HA) for the file system and reduces system downtime since a failed node does not result in the requirement to execute thefsck
command when failing the NFS server from one node to another. - The
fsid=
NFS option is mandatory for NFS exports of GFS2. - If problems arise with your cluster (for example, the cluster becomes inquorate and fencing is not successful), the clustered logical volumes and the GFS2 file system will be frozen and no access is possible until the cluster is quorate. You should consider this possibility when determining whether a simple failover solution such as the one defined in this procedure is the most appropriate for your system.
2.5.5. Samba (SMB or Windows) File Serving Over GFS2
2.5.6. Configuring Virtual Machines for GFS2
cache
and io
in the libvirt
domain should allow GFS2 to behave as expected.
<driver name='qemu' type='raw' cache='none' io='native'/>
shareable
attribute within the device element. This indicates that the device is expected to be shared between domains (as long as hypervisor and OS support this). If shareable
is used, cache='no'
should be used for that device.
2.6. File System Backups
echo -n 3 > /proc/sys/vm/drop_caches
rsync
command on node-specific directories.
-o lockproto=lock_nolock
since it will not be in a cluster.
2.7. Hardware Considerations
- Use Higher Quality Storage OptionsGFS2 can operate on cheaper shared storage options, such as iSCSI or Fibre Channel over Ethernet (FCoE), but you will get better performance if you buy higher quality storage with larger caching capacity. Red Hat performs most quality, sanity, and performance tests on SAN storage with Fibre Channel interconnect. As a general rule, it is always better to deploy something that has been tested first.
- Test Network Equipment Before DeployingHigher quality, faster network equipment makes cluster communications and GFS2 run faster with better reliability. However, you do not have to purchase the most expensive hardware. Some of the most expensive network switches have problems passing multicast packets, which are used for passing
fcntl
locks (flocks), whereas cheaper commodity network switches are sometimes faster and more reliable. Red Hat recommends trying equipment before deploying it into full production.
2.8. Performance Issues: Check the Red Hat Customer Portal
2.9. GFS2 Node Locking
write
system call).
read
(buffered), stat,
and readdir
only require a shared glock. Operations such as write
(buffered), mkdir
, rmdir
, and unlink
require an exclusive glock. Direct I/O read/write operations require a deferred glock if no allocation is taking place, or an exclusive glock if the write requires an allocation (that is, extending the file, or hole filling).
noatime
and nodiratime
mount options with GFS2 whenever possible. This prevents reads from requiring exclusive locks to update the atime
timestamp.
Note
- An inode is used in a read-only fashion across all nodes.
- An inode is written or modified from a single node only.
mmap
() a file on GFS2 with a read/write mapping, but only read from it, this only counts as a read. On GFS though, it counts as a write, so GFS2 is much more scalable with mmap
() I/O.
noatime
mount
parameter, then reads will also result in writes to update the file timestamps. We recommend that all GFS2 users should mount with noatime
unless they have a specific requirement for atime
.
2.9.1. Issues with Posix Locking
- Use of Flocks will yield faster processing than use of Posix locks.
- Programs using Posix locks in GFS2 should avoid using the
GETLK
function since, in a clustered environment, the process ID may be for a different node in the cluster.
2.9.2. Performance Tuning with GFS2
mbox
), or with a directory for each user containing a file for each message (maildir
). When requests arrive over IMAP, the ideal arrangement is to give each user an affinity to a particular node. That way their requests to view and delete email messages will tend to be served from the cache on that one node. Obviously if that node fails, then the session can be restarted on a different node.
imap
or smtp
.
echo -n 3 >/proc/sys/vm/drop_caches
2.9.3. Troubleshooting GFS2 Performance with the GFS2 Lock Dump
debugfs
file which can be found at the following path name, assuming that debugfs
is mounted on /sys/kernel/debug/
:
/sys/kernel/debug/gfs2/fsname/glocks
debugfs
file is to use the cat
command to take a copy of the complete content of the file (it might take a long time if you have a large amount of RAM and a lot of cached inodes) while the application is experiencing problems, and then looking through the resulting data at a later date.
Note
debugfs
file, one a few seconds or even a minute or two after the other. By comparing the holder information in the two traces relating to the same glock number, you can tell whether the workload is making progress (it is just slow) or whether it has become stuck (which is always a bug and should be reported to Red Hat support immediately).
debugfs
file starting with H: (holders) represent lock requests either granted or waiting to be granted. The flags field on the holders line f: shows which: The 'W' flag refers to a waiting request, the 'H' flag refers to a granted request. The glocks which have large numbers of waiting requests are likely to be those which are experiencing particular contention.
Table 2.1. Glock flags
Flag | Name | Meaning |
---|---|---|
b | Blocking | Valid when the locked flag is set, and indicates that the operation that has been requested from the DLM may block. This flag is cleared for demotion operations and for "try" locks. The purpose of this flag is to allow gathering of stats of the DLM response time independent from the time taken by other nodes to demote locks. |
d | Pending demote | A deferred (remote) demote request |
D | Demote | A demote request (local or remote) |
f | Log flush | The log needs to be committed before releasing this glock |
F | Frozen | Replies from remote nodes ignored - recovery is in progress. This flag is not related to file system freeze, which uses a different mechanism, but is used only in recovery. |
i | Invalidate in progress | In the process of invalidating pages under this glock |
I | Initial | Set when DLM lock is associated with this glock |
l | Locked | The glock is in the process of changing state |
L | LRU | Set when the glock is on the LRU list |
o | Object | Set when the glock is associated with an object (that is, an inode for type 2 glocks, and a resource group for type 3 glocks) |
p | Demote in progress | The glock is in the process of responding to a demote request |
q | Queued | Set when a holder is queued to a glock, and cleared when the glock is held, but there are no remaining holders. Used as part of the algorithm the calculates the minimum hold time for a glock. |
r | Reply pending | Reply received from remote node is awaiting processing |
y | Dirty | Data needs flushing to disk before releasing this glock |
Table 2.2. Glock holder flags
Flag | Name | Meaning |
---|---|---|
a | Async | Do not wait for glock result (will poll for result later) |
A | Any | Any compatible lock mode is acceptable |
c | No cache | When unlocked, demote DLM lock immediately |
e | No expire | Ignore subsequent lock cancel requests |
E | exact | Must have exact lock mode |
F | First | Set when holder is the first to be granted for this lock |
H | Holder | Indicates that requested lock is granted |
p | Priority | Enqueue holder at the head of the queue |
t | Try | A "try" lock |
T | Try 1CB | A "try" lock that sends a callback |
W | Wait | Set while waiting for request to complete |
find -inum number
where number is the inode number converted from the hex format in the glocks file into decimal.
Warning
find
command on a file system when it is experiencing lock contention, you are likely to make the problem worse. It is a good idea to stop the application before running the find
command when you are looking for contended inodes.
Table 2.3. Glock types
Type number | Lock type | Use |
---|---|---|
1 | Trans | Transaction lock |
2 | Inode | Inode metadata and data |
3 | Rgrp | Resource group metadata |
4 | Meta | The superblock |
5 | Iopen | Inode last closer detection |
6 | Flock | flock (2) syscall |
8 | Quota | Quota operations |
9 | Journal | Journal mutex |
gfs2_grow
command to expand the file system.
Chapter 3. Managing GFS2
3.1. Creating a GFS2 File System
mkfs.gfs2
command. You can also use the mkfs
command with the -t gfs2
option specified. A file system is created on an activated LVM volume. The following information is required to run the mkfs.gfs2
command:
- Lock protocol/module name (the lock protocol for a cluster is
lock_dlm
) - Cluster name (needed when specifying the
LockTableName
parameter) - Number of journals (one journal required for each node that may be mounting the file system)
mkfs.gfs2
command directly, or you can use the mkfs
command with the -t
parameter specifying a file system of type gfs2
, followed by the GFS2 file system options.
Note
mkfs.gfs2
command, you cannot decrease the size of the file system. You can, however, increase the size of an existing file system with the gfs2_grow
command, as described in Section 3.5, “Growing a GFS2 File System”.
Usage
mkfs.gfs2 -pLockProtoName
-tLockTableName
-jNumberJournals BlockDevice
mkfs -t gfs2 -pLockProtoName
-tLockTableName
-jNumberJournals BlockDevice
Note
mkfs.gfs2 -pLockProtoName
-jNumberJournals BlockDevice
mkfs -t gfs2 -pLockProtoName
-jNumberJournals BlockDevice
Warning
LockProtoName
and LockTableName
parameters. Improper use of the LockProtoName
and LockTableName
parameters may cause file system or lock space corruption.
LockProtoName
- Specifies the name of the locking protocol to use. The lock protocol for a cluster is
lock_dlm
. LockTableName
- This parameter is specified for a GFS2 file system in a cluster configuration. It has two parts separated by a colon (no spaces) as follows:
ClusterName:FSName
ClusterName
, the name of the cluster for which the GFS2 file system is being created.FSName
, the file system name, can be 1 to 16 characters long. The name must be unique for alllock_dlm
file systems over the cluster, and for all file systems (lock_dlm
andlock_nolock
) on each local node.
Number
- Specifies the number of journals to be created by the
mkfs.gfs2
command. One journal is required for each node that mounts the file system. For GFS2 file systems, more journals can be added later without growing the file system, as described in Section 3.6, “Adding Journals to a GFS2 File System”. BlockDevice
- Specifies a logical or physical volume.
Examples
lock_dlm
is the locking protocol that the file system uses, since this is a clustered file system. The cluster name is alpha
, and the file system name is mydata1
. The file system contains eight journals and is created on /dev/vg01/lvol0
.
# mkfs.gfs2 -p lock_dlm -t alpha:mydata1 -j 8 /dev/vg01/lvol0
# mkfs -t gfs2 -p lock_dlm -t alpha:mydata1 -j 8 /dev/vg01/lvol0
lock_dlm
file system is made, which can be used in cluster alpha
. The file system name is mydata2
. The file system contains eight journals and is created on /dev/vg01/lvol1
.
mkfs.gfs2 -p lock_dlm -t alpha:mydata2 -j 8 /dev/vg01/lvol1
mkfs -t gfs2 -p lock_dlm -t alpha:mydata2 -j 8 /dev/vg01/lvol1
Complete Options
mkfs.gfs2
” describes the mkfs.gfs2
command options (flags and parameters).
Table 3.1. Command Options: mkfs.gfs2
Flag | Parameter | Description | ||||
---|---|---|---|---|---|---|
-c | Megabytes | Sets the initial size of each journal's quota change file to Megabytes . | ||||
-D | Enables debugging output. | |||||
-h | Help. Displays available options. | |||||
-J | Megabytes | Specifies the size of the journal in megabytes. Default journal size is 128 megabytes. The minimum size is 8 megabytes. Larger journals improve performance, although they use more memory than smaller journals. | ||||
-j | Number | Specifies the number of journals to be created by the mkfs.gfs2 command. One journal is required for each node that mounts the file system. If this option is not specified, one journal will be created. For GFS2 file systems, you can add additional journals at a later time without growing the file system. | ||||
-O | Prevents the mkfs.gfs2 command from asking for confirmation before writing the file system. | |||||
-p | LockProtoName |
| ||||
-q | Quiet. Do not display anything. | |||||
-r | Megabytes | Specifies the size of the resource groups in megabytes. The minimum resource group size is 32 megabytes. The maximum resource group size is 2048 megabytes. A large resource group size may increase performance on very large file systems. If this is not specified, mkfs.gfs2 chooses the resource group size based on the size of the file system: average size file systems will have 256 megabyte resource groups, and bigger file systems will have bigger RGs for better performance. | ||||
-t | LockTableName |
| ||||
-u | Megabytes | Specifies the initial size of each journal's unlinked tag file. | ||||
-V | Displays command version information. |
3.2. Mounting a GFS2 File System
Note
gfs2-utils
package must be installed on all nodes that mount a GFS2 file system. The gfs2-utils
package is part of the Resilient Storage channel.
-o acl
mount option. If a file system is mounted without the -o acl
mount option, users are allowed to view ACLs (with getfacl
), but are not allowed to set them (with setfacl
).
Usage
mount BlockDevice MountPoint
mount -o acl BlockDevice MountPoint
-o acl
- GFS2-specific option to allow manipulating file ACLs.
BlockDevice
- Specifies the block device where the GFS2 file system resides.
MountPoint
- Specifies the directory where the GFS2 file system should be mounted.
Example
/dev/vg01/lvol0
is mounted on the /mygfs2
directory.
# mount /dev/vg01/lvol0 /mygfs2
Complete Usage
mountBlockDevice MountPoint
-ooption
-o option
argument consists of GFS2-specific options (see Table 3.2, “GFS2-Specific Mount Options”) or acceptable standard Linux mount -o
options, or a combination of both. Multiple option
parameters are separated by a comma and no spaces.
Note
mount
command is a Linux system command. In addition to using GFS2-specific options described in this section, you can use other, standard, mount
command options (for example, -r
). For information about other Linux mount
command options, see the Linux mount
man page.
-o option
values that can be passed to GFS2 at mount time.
Note
Table 3.2. GFS2-Specific Mount Options
Option | Description | ||
---|---|---|---|
acl | Allows manipulating file ACLs. If a file system is mounted without the acl mount option, users are allowed to view ACLs (with getfacl ), but are not allowed to set them (with setfacl ). | ||
data=[ordered|writeback] | 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 mode 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 value is ordered mode. | ||
| Forces GFS2 to treat the file system as a multi-host file system. By default, using lock_nolock automatically turns on the localflocks flag. | ||
| Tells GFS2 to let the VFS (virtual file system) layer do all flock and fcntl. The localflocks flag is automatically turned on by lock_nolock . | ||
lockproto= LockModuleName | Allows the user to specify which locking protocol to use with the file system. If LockModuleName is not specified, the locking protocol name is read from the file system superblock. | ||
locktable= LockTableName | Allows the user to specify which locking table to use with the file system. | ||
quota=[off/account/on] | Turns quotas on or off for a file system. Setting the quotas to be in the account state causes the per UID/GID usage statistics to be correctly maintained by the file system; limit and warn values are ignored. The default value is off . | ||
errors=panic|withdraw | When errors=panic is specified, file system errors will cause a kernel panic. When errors=withdraw is specified, which is the default behavior, file system errors will cause the system to withdraw from the file system and make it inaccessible until the next reboot; in some cases the system may remain running. | ||
discard/nodiscard | Causes GFS2 to generate "discard" I/O requests for blocks that have been freed. These can be used by suitable hardware to implement thin provisioning and similar schemes. | ||
barrier/nobarrier | Causes GFS2 to send I/O barriers when flushing the journal. The default value is on . This option is automatically turned off if the underlying device does not support I/O barriers. Use of I/O barriers with GFS2 is highly recommended at all times unless the block device is designed so that it cannot lose its write cache content (for example, if it is on a UPS or it does not have a write cache). | ||
quota_quantum=secs | Sets the number of seconds for which a change in the quota information may sit on one node before being written to the quota file. This is the preferred way to set this parameter. The value is an integer number of seconds greater than zero. The default is 60 seconds. Shorter settings result in faster updates of the lazy quota information and less likelihood of someone exceeding their quota. Longer settings make file system operations involving quotas faster and more efficient. | ||
statfs_quantum=secs | Setting statfs_quantum to 0 is the preferred way to set the slow version of statfs . The default value is 30 secs which sets the maximum time period before statfs changes will be synced to the master statfs file. This can be adjusted to allow for faster, less accurate statfs values or slower more accurate values. When this option is set to 0, statfs will always report the true values. | ||
statfs_percent=value | Provides a bound on the maximum percentage change in the statfs information on a local basis before it is synced back to the master statfs file, even if the time period has not expired. If the setting of statfs_quantum is 0, then this setting is ignored. |
3.3. Unmounting a GFS2 File System
- Always use Pacemaker to manage the GFS2 file system. For information on configuring a GFS2 file system in a Pacemaker cluster, see Chapter 5, Configuring a GFS2 File System in a Cluster.
- If a GFS2 file system has been mounted manually with the
mount
command, be sure to unmount the file system manually with theumount
command before rebooting or shutting down the system.
umount
command.
Note
umount
command is a Linux system command. Information about this command can be found in the Linux umount
command man pages.
Usage
umount MountPoint
MountPoint
- Specifies the directory where the GFS2 file system is currently mounted.
3.4. GFS2 Quota Management
quota=on
or quota=account
option, GFS2 keeps track of the space used by each user and group even when there are no limits in place. GFS2 updates quota information in a transactional way so system crashes do not require quota usages to be reconstructed.
Note
3.4.1. Configuring Disk Quotas
- Set up quotas in enforcement or accounting mode.
- Initialize the quota database file with current block usage information.
- Assign quota policies. (In accounting mode, these policies are not enforced.)
3.4.1.1. Setting Up Quotas in Enforcement or Accounting Mode
quota=on
option specified.
quota=account
option specified.
quota=on
for the options
argument when creating the GFS2 file system resource in a cluster. For example, the following command specifies that the GFS2 Filesystem
resource being created will be mounted with quotas enabled.
# pcs resource create gfs2mount Filesystem options="quota=on" device=BLOCKDEVICE
directory=MOUNTPOINT
fstype=gfs2 clone
quota=account
for the options
argument when creating the GFS2 file system resource in a cluster.
quota=off
for the options
argument when creating the GFS2 file system resource in a cluster.
3.4.1.2. Creating the Quota Database Files
quotacheck
command.
quotacheck
command examines quota-enabled file systems and builds a table of the current disk usage per file system. The table is then used to update the operating system's copy of disk usage. In addition, the file system's disk quota files are updated.
-u
and the -g
options of the quotacheck
command; both of these options must be specified for user and group quotas to be initialized. For example, if quotas are enabled for the /home
file system, create the files in the /home
directory:
quotacheck -ug /home
3.4.1.3. Assigning Quotas Per User
edquota
command. Note that if you have mounted your file system in accounting mode (with the quota=account
option specified), the quotas are not enforced.
# edquota username
/home
partition (/dev/VolGroup00/LogVol02
in the example below) and the command edquota testuser
is executed, the following is shown in the editor configured as the default for the system:
Disk quotas for user testuser (uid 501): Filesystem blocks soft hard inodes soft hard /dev/VolGroup00/LogVol02 440436 0 0
Note
EDITOR
environment variable is used by edquota
. To change the editor, set the EDITOR
environment variable in your ~/.bash_profile
file to the full path of the editor of your choice.
Disk quotas for user testuser (uid 501): Filesystem blocks soft hard inodes soft hard /dev/VolGroup00/LogVol02 440436 500000 550000
quota testuser
3.4.1.4. Assigning Quotas Per Group
account=on
option specified), the quotas are not enforced.
devel
group (the group must exist prior to setting the group quota), use the following command:
edquota -g devel
Disk quotas for group devel (gid 505): Filesystem blocks soft hard inodes soft hard /dev/VolGroup00/LogVol02 440400 0 0
$ quota -g devel
3.4.2. Managing Disk Quotas
repquota
utility. For example, the command repquota /home
produces this output:
*** Report for user quotas on device /dev/mapper/VolGroup00-LogVol02 Block grace time: 7days; Inode grace time: 7days Block limits File limits User used soft hard grace used soft hard grace ---------------------------------------------------------------------- root -- 36 0 0 4 0 0 kristin -- 540 0 0 125 0 0 testuser -- 440400 500000 550000 37418 0 0
-a
) quota-enabled file systems, use the command:
# repquota -a
--
displayed after each user is a quick way to determine whether the block limits have been exceeded. If the block soft limit is exceeded, a +
appears in place of the first -
in the output. The second -
indicates the inode limit, but GFS2 file systems do not support inode limits so that character will remain as -
. GFS2 file systems do not support a grace period, so the grace
column will remain blank.
repquota
command is not supported over NFS, irrespective of the underlying file system.
3.4.3. Keeping Quotas Accurate
quotacheck
command to create, check, and repair quota files. Additionally, you may want to run the quotacheck
command if you think your quota files may not be accurate, as may occur when a file system is not unmounted cleanly after a system crash.
quotacheck
command, see the quotacheck
man page.
Note
quotacheck
when the file system is relatively idle on all nodes because disk activity may affect the computed quota values.
3.4.4. Synchronizing Quotas with the quotasync
Command
quota_quantum
. You can change this from its default value of 60 seconds using the quota_quantum=
mount option, as described in Table 3.2, “GFS2-Specific Mount Options”. The quota_quantum
parameter must be set on each node and each time the file system is mounted. Changes to the quota_quantum
parameter are not persistent across unmounts. You can update the quota_quantum
value with the mount -o remount
.
quotasync
command to synchronize the quota information from a node to the on-disk quota file between the automatic updates performed by GFS2.
Usage
quotasync [-ug] -a|mntpnt
...
u
- Sync the user quota files.
g
- Sync the group quota files
a
- Sync all file systems that are currently quota-enabled and support sync. When -a is absent, a file system mountpoint should be specified.
mntpnt
- Specifies the GFS2 file system to which the actions apply.
mount -o quota_quantum=secs,remount BlockDevice MountPoint
MountPoint
- Specifies the GFS2 file system to which the actions apply.
secs
- Specifies the new time period between regular quota-file synchronizations by GFS2. Smaller values may increase contention and slow down performance.
Examples
/mnt/mygfs2
.
# quotasync -ug /mnt/mygfs2
/mnt/mygfs2
when remounting that file system on logical volume /dev/volgroup/logical_volume
.
# mount -o quota_quantum=3600,remount /dev/volgroup/logical_volume /mnt/mygfs2
3.5. Growing a GFS2 File System
gfs2_grow
command is used to expand a GFS2 file system after the device where the file system resides has been expanded. Running the gfs2_grow
command on an existing GFS2 file system fills all spare space between the current end of the file system and the end of the device with a newly initialized GFS2 file system extension. When the fill operation is completed, the resource index for the file system is updated. All nodes in the cluster can then use the extra storage space that has been added.
gfs2_grow
command must be run on a mounted file system, but only needs to be run on one node in a cluster. All the other nodes sense that the expansion has occurred and automatically start using the new space.
Note
mkfs.gfs2
command, you cannot decrease the size of the file system.
Usage
gfs2_grow MountPoint
MountPoint
- Specifies the GFS2 file system to which the actions apply.
Comments
gfs2_grow
command:
- Back up important data on the file system.
- Determine the volume that is used by the file system to be expanded by running the
df
command.MountPoint
- Expand the underlying cluster volume with LVM. For information on administering LVM volumes, see Logical Volume Manager Administration.
gfs2_grow
command, run the df
command to check that the new space is now available in the file system.
Examples
/mygfs2fs
directory is expanded.
# gfs2_grow /mygfs2fs
FS: Mount Point: /mygfs2fs
FS: Device: /dev/mapper/gfs2testvg-gfs2testlv
FS: Size: 524288 (0x80000)
FS: RG size: 65533 (0xfffd)
DEV: Size: 655360 (0xa0000)
The file system grew by 512MB.
gfs2_grow complete.
Complete Usage
gfs2_grow [Options
] {MountPoint
|Device
} [MountPoint
|Device
]
MountPoint
- Specifies the directory where the GFS2 file system is mounted.
Device
- Specifies the device node of the file system.
Table 3.3. GFS2-specific Options Available While Expanding A File System
Option | Description |
---|---|
-h | Help. Displays a short usage message. |
-q | Quiet. Turns down the verbosity level. |
-r Megabytes | Specifies the size of the new resource group. The default size is 256 megabytes. |
-T | Test. Do all calculations, but do not write any data to the disk and do not expand the file system. |
-V | Displays command version information. |
3.6. Adding Journals to a GFS2 File System
gfs2_jadd
command is used to add journals to a GFS2 file system. You can add journals to a GFS2 file system dynamically at any point without expanding the underlying logical volume. The gfs2_jadd
command must be run on a mounted file system, but it needs to be run on only one node in the cluster. All the other nodes sense that the expansion has occurred.
Note
gfs2_jadd
command will fail, even if the logical volume containing the file system has been extended and is larger than the file system. This is because in a GFS2 file system, journals are plain files rather than embedded metadata, so simply extending the underlying logical volume will not provide space for the journals.
gfs2_edit -p jindex
command, as in the following example:
# gfs2_edit -p jindex /dev/sasdrives/scratch|grep journal
3/3 [fc7745eb] 4/25 (0x4/0x19): File journal0
4/4 [8b70757d] 5/32859 (0x5/0x805b): File journal1
5/5 [127924c7] 6/65701 (0x6/0x100a5): File journal2
Usage
gfs2_jadd -j Number MountPoint
Number
- Specifies the number of new journals to be added.
MountPoint
- Specifies the directory where the GFS2 file system is mounted.
Examples
/mygfs2
directory.
gfs2_jadd -j 1 /mygfs2
/mygfs2
directory.
gfs2_jadd -j 2 /mygfs2
Complete Usage
gfs2_jadd [Options
] {MountPoint
|Device
} [MountPoint
|Device
]
MountPoint
- Specifies the directory where the GFS2 file system is mounted.
Device
- Specifies the device node of the file system.
Table 3.4. GFS2-specific Options Available When Adding Journals
Flag | Parameter | Description |
---|---|---|
-h | Help. Displays short usage message. | |
-J | Megabytes | Specifies the size of the new journals in megabytes. Default journal size is 128 megabytes. The minimum size is 32 megabytes. To add journals of different sizes to the file system, the gfs2_jadd command must be run for each size journal. The size specified is rounded down so that it is a multiple of the journal-segment size that was specified when the file system was created. |
-j | Number | Specifies the number of new journals to be added by the gfs2_jadd command. The default value is 1. |
-q | Quiet. Turns down the verbosity level. | |
-V | Displays command version information. |
3.7. Data Journaling
fsync()
call on a file causes the file's data to be written to disk immediately. The call returns when the disk reports that all data is safely written.
fsync()
time for very small files because the file data is written to the journal in addition to the metadata. This advantage rapidly reduces as the file size increases. Writing to medium and larger files will be much slower with data journaling turned on.
fsync()
to sync file data may see improved performance by using data journaling. Data journaling can be enabled automatically for any GFS2 files created in a flagged directory (and all its subdirectories). Existing files with zero length can also have data journaling turned on or off.
chattr
command.
/mnt/gfs2/gfs2_dir/newfile
file and then check whether the flag has been set properly.
#chattr +j /mnt/gfs2/gfs2_dir/newfile
#lsattr /mnt/gfs2/gfs2_dir
---------j--- /mnt/gfs2/gfs2_dir/newfile
/mnt/gfs2/gfs2_dir/newfile
file and then check whether the flag has been set properly.
#chattr -j /mnt/gfs2/gfs2_dir/newfile
#lsattr /mnt/gfs2/gfs2_dir
------------- /mnt/gfs2/gfs2_dir/newfile
chattr
command to set the j
flag on a directory. When you set this flag for a directory, all files and directories subsequently created in that directory are journaled. The following set of commands sets the j
flag on the gfs2_dir
directory, then checks whether the flag has been set properly. After this, the commands create a new file called newfile
in the /mnt/gfs2/gfs2_dir
directory and then check whether the j
flag has been set for the file. Since the j
flag is set for the directory, then newfile
should also have journaling enabled.
#chattr -j /mnt/gfs2/gfs2_dir
#lsattr /mnt/gfs2
---------j--- /mnt/gfs2/gfs2_dir #touch /mnt/gfs2/gfs2_dir/newfile
#lsattr /mnt/gfs2/gfs2_dir
---------j--- /mnt/gfs2/gfs2_dir/newfile
3.8. Configuring atime
Updates
ctime
— The last time the inode status was changedmtime
— The last time the file (or directory) data was modifiedatime
— The last time the file (or directory) data was accessed
atime
updates are enabled as they are by default on GFS2 and other Linux file systems then every time a file is read, its inode needs to be updated.
atime
, those updates can require a significant amount of unnecessary write traffic and file locking traffic. That traffic can degrade performance; therefore, it may be preferable to turn off or reduce the frequency of atime
updates.
atime
updating are available:
- Mount with
relatime
(relative atime), which updates theatime
if the previousatime
update is older than themtime
orctime
update. - Mount with
noatime
, which disablesatime
updates on that file system.
3.8.1. Mount with relatime
relatime
(relative atime) Linux mount option can be specified when the file system is mounted. This specifies that the atime
is updated if the previous atime
update is older than the mtime
or ctime
update.
Usage
mount BlockDevice MountPoint
-o relatime
BlockDevice
- Specifies the block device where the GFS2 file system resides.
MountPoint
- Specifies the directory where the GFS2 file system should be mounted.
Example
/dev/vg01/lvol0
and is mounted on directory /mygfs2
. The atime
updates take place only if the previous atime
update is older than the mtime
or ctime
update.
# mount /dev/vg01/lvol0 /mygfs2 -o relatime
3.8.2. Mount with noatime
noatime
Linux mount option can be specified when the file system is mounted, which disables atime
updates on that file system.
Usage
mount BlockDevice MountPoint
-o noatime
BlockDevice
- Specifies the block device where the GFS2 file system resides.
MountPoint
- Specifies the directory where the GFS2 file system should be mounted.
Example
/dev/vg01/lvol0
and is mounted on directory /mygfs2
with atime
updates turned off.
# mount /dev/vg01/lvol0 /mygfs2 -o noatime
3.9. Suspending Activity on a GFS2 File System
dmsetup suspend
command. Suspending write activity allows hardware-based device snapshots to be used to capture the file system in a consistent state. The dmsetup resume
command ends the suspension.
Usage
dmsetup suspend MountPoint
dmsetup resume MountPoint
MountPoint
- Specifies the file system.
Examples
/mygfs2
.
# dmsetup suspend /mygfs2
/mygfs2
.
# dmsetup resume /mygfs2
3.10. Repairing a GFS2 File System
fsck.gfs2
command.
Important
fsck.gfs2
command must be run only on a file system that is unmounted from all nodes. When the file system is being managed as a Pacemaker cluster resource, you can disable the file system resource, which unmounts the file system. After running the fsck.gfs2
command, you enable the file system resource again. The timeout value specified with the --wait
option of the pcs resource disable
indicates a value in seconds.
# pcs resource disable --wait=timeoutvalue resource_id [fsck.gfs2] # pcs resource enable resource_id
fsck.gfs2
command does not run on a GFS2 file system at boot time, you can set the run_fsck
parameter of the options
argument when creating the GFS2 file system resource in a cluster. Specifying "run_fsck=no"
will indicate that you should not run the fsck
command.
Note
gfs_fsck
command on GFS file systems, note that the fsck.gfs2
command differs from some earlier releases of gfs_fsck
in the following ways:
- Pressing Ctrl+C while running the
fsck.gfs2
command interrupts processing and displays a prompt asking whether you would like to abort the command, skip the rest of the current pass, or continue processing. - You can increase the level of verbosity by using the
-v
flag. Adding a second-v
flag increases the level again. - You can decrease the level of verbosity by using the
-q
flag. Adding a second-q
flag decreases the level again. - The
-n
option opens a file system as read only and answersno
to any queries automatically. The option provides a way of trying the command to reveal errors without actually allowing thefsck.gfs2
command to take effect.
fsck.gfs2
man page for additional information about other command options.
fsck.gfs2
command requires system memory above and beyond the memory used for the operating system and kernel. Each block of memory in the GFS2 file system itself requires approximately five bits of additional memory, or 5/8 of a byte. So to estimate how many bytes of memory you will need to run the fsck.gfs2
command on your file system, determine how many blocks the file system contains and multiply that number by 5/8.
fsck.gfs2
command on a GFS2 file system that is 16TB with a block size of 4K, first determine how many blocks of memory the file system contains by dividing 16TB by 4K:
17592186044416 / 4096 = 4294967296
4294967296 * 5/8 = 2684354560
fsck.gfs2
command. Note that if the block size was 1K, running the fsck.gfs2
command would require four times the memory, or approximately 11GB.
Usage
fsck.gfs2 -y BlockDevice
-y
- The
-y
flag causes all questions to be answered withyes
. With the-y
flag specified, thefsck.gfs2
command does not prompt you for an answer before making changes. BlockDevice
- Specifies the block device where the GFS2 file system resides.
Example
/dev/testvg/testlv
is repaired. All queries to repair are automatically answered with yes
.
# fsck.gfs2 -y /dev/testvg/testlv
Initializing fsck
Validating Resource Group index.
Level 1 RG check.
(level 1 passed)
Clearing journals (this may take a while)...
Journals cleared.
Starting pass1
Pass1 complete
Starting pass1b
Pass1b complete
Starting pass1c
Pass1c complete
Starting pass2
Pass2 complete
Starting pass3
Pass3 complete
Starting pass4
Pass4 complete
Starting pass5
Pass5 complete
Writing changes to disk
fsck.gfs2 complete
3.11. The GFS2 Withdraw Function
- Inode consistency error
- Resource group consistency error
- Journal consistency error
- Magic number metadata consistency error
- Metadata type consistency error
#pcs resource disable --wait=100 mydata_fs_clone
#/sbin/reboot
Warning
umount
and mount
commands. You must use the pcs
command, otherwise Pacemaker will detect the file system service has disappeared and fence the node.
- Reboot the affected node.
- Disable the non-clone file system service in Pacemaker to unmount the file system from every node in the cluster.
#
pcs resource disable --wait=100 mydata_fs
- From one node of the cluster, run the
fsck.gfs2
command on the file system device to check for and repair any file system damage.#
fsck.gfs2 -y /dev/vg_mydata/mydata > /tmp/fsck.out
- Remount the GFS2 file system from all nodes by re-enabling the file system service:
#
pcs resource enable --wait=100 mydata_fs
-o errors=panic
option specified in the file system service.
# pcs resource update mydata_fs “options=noatime,errors=panic”
Chapter 4. Diagnosing and Correcting Problems with GFS2 File Systems
4.1. GFS2 File System Shows Slow Performance
4.2. GFS2 File System Hangs and Requires Reboot of One Node
- The GFS2 lock dump for the file system on each node:
cat /sys/kernel/debug/gfs2/fsname/glocks >glocks.fsname.nodename
- The DLM lock dump for the file system on each node: You can get this information with the
dlm_tool
:dlm_tool lockdebug -sv lsname.
In this command, lsname is the lockspace name used by DLM for the file system in question. You can find this value in the output from thegroup_tool
command. - The output from the
sysrq -t
command. - The contents of the
/var/log/messages
file.
4.3. GFS2 File System Hangs and Requires Reboot of All Nodes
- You may have had a failed fence. GFS2 file systems will freeze to ensure data integrity in the event of a failed fence. Check the messages logs to see if there are any failed fences at the time of the hang. Ensure that fencing is configured correctly.
- The GFS2 file system may have withdrawn. Check through the messages logs for the word
withdraw
and check for any messages and call traces from GFS2 indicating that the file system has been withdrawn. A withdraw is indicative of file system corruption, a storage failure, or a bug. At the earliest time when it is convenient to unmount the file system, you should perform the following procedure:- Reboot the node on which the withdraw occurred.
#
/sbin/reboot
- Stop the file system resource to unmount the GFS2 file system on all nodes.
#
pcs resource disable --wait=100 mydata_fs
- Capture the metadata with the
gfs2_edit savemeta...
command. You should ensure that there is sufficient space for the file, which in some cases may be large. In this example, the metadata is saved to a file in the/root
directory.#
gfs2_edit savemeta /dev/vg_mydata/mydata /root/gfs2metadata.gz
- Update the
gfs2-utils
package.#
sudo yum update gfs2-utils
- On one node, run the
fsck.gfs2
command on the file system to ensure file system integrity and repair any damage.#
fsck.gfs2 -y /dev/vg_mydata/mydata > /tmp/fsck.out
- After the
fsck.gfs2
command has completed, re-enable the file system resource to return it to service:#
pcs resource enable --wait=100 mydata_fs
- Open a support ticket with Red Hat Support. Inform them you experienced a GFS2 withdraw and provide logs and the debugging information generated by the
sosreports
andgfs2_edit savemeta
commands.
In some instances of a GFS2 withdraw, commands can hang that are trying to access the file system or its block device. In these cases a hard reboot is required to reboot the cluster.For information on the GFS2 withdraw function, see Section 3.11, “The GFS2 Withdraw Function”. - This error may be indicative of a locking problem or bug. Gather data during one of these occurrences and open a support ticket with Red Hat Support, as described in Section 4.2, “GFS2 File System Hangs and Requires Reboot of One Node”.
4.4. GFS2 File System Does Not Mount on Newly Added Cluster Node
spectator
mount option set, since these do not require a journal). You can add journals to a GFS2 file system with the gfs2_jadd
command, as described in Section 3.6, “Adding Journals to a GFS2 File System”.
4.5. Space Indicated as Used in Empty File System
df
command will show that there is space being taken up. This is because GFS2 file system journals consume space (number of journals * journal size) on disk. If you created a GFS2 file system with a large number of journals or specified a large journal size then you will be see (number of journals * journal size) as already in use when you execute the df
command. Even if you did not specify a large number of journals or large journals, small GFS2 file systems (in the 1GB or less range) will show a large amount of space as being in use with the default GFS2 journal size.
Chapter 5. Configuring a GFS2 File System in a Cluster
- On all nodes of the cluster, install the
lvm2-cluster
andgfs2-utils
packages, which are part of the Resilient Storage channel.#
yum install lvm2-cluster gfs2-utils
- Set the global Pacemaker parameter
no_quorum_policy
tofreeze
.Note
By default, the value ofno-quorum-policy
is set tostop
, indicating that once quorum is lost, all the resources on the remaining partition will immediately be stopped. Typically this default is the safest and most optimal option, but unlike most resources, GFS2 requires quorum to function. When quorum is lost both the applications using the GFS2 mounts and the GFS2 mount itself cannot be correctly stopped. Any attempts to stop these resources without quorum will fail which will ultimately result in the entire cluster being fenced every time quorum is lost.To address this situation, setno-quorum-policy
tofreeze
when GFS2 is in use. This means that when quorum is lost, the remaining partition will do nothing until quorum is regained.#
pcs property set no-quorum-policy=freeze
- Set up a
dlm
resource. This is a required dependency forclvmd
and GFS2.#
pcs resource create dlm ocf:pacemaker:controld op monitor interval=30s on-fail=fence clone interleave=true ordered=true
- Execute the following command in each node of the cluster to enable clustered locking. This command sets the
locking_type
parameter in the/etc/lvm/lvm.conf
file to 3.#
/sbin/lvmconf --enable-cluster
- Set up
clvmd
as a cluster resource.#
pcs resource create clvmd ocf:heartbeat:clvm op monitor interval=30s on-fail=fence clone interleave=true ordered=true
Note that theclvmd
andcmirrord
deamons are started and managed by Pacemaker using theocf:heartbeat:clvm
resource agent and do not need to be started during boot withsystemd
. Additionally, theocf:heartbeat:clvm
resource agent, as part of the start procedure, sets thelocking_type
parameter in the/etc/lvm/lvm.conf
file to 3 and disables thelvmetad
daemon. - Set up
clvmd
anddlm
dependency and start up order.clvmd
must start afterdlm
and must run on the same node asdlm
.#
pcs constraint order start dlm-clone then clvmd-clone
#pcs constraint colocation add clvmd-clone with dlm-clone
- Create the clustered logical volume.
#
pvcreate /dev/vdb
#vgcreate -Ay -cy sasbin_vg /dev/vdb
#lvcreate -L5G -n sasbin_lv sasbin_vg
Warning
When you create volume groups with CLVM on shared storage, you must ensure that all nodes in the cluster have access to the physical volumes that constitute the volume group. Asymmetric cluster configurations in which some nodes have access to the storage and others do not are not supported.When managing volume groups using CLVMD to allow for concurrent activation of volumes across multiple nodes, the volume groups must have the clustered flag enabled. This flag allows CLVMD to identify the volumes it must manage, which is what enables CLVMD to maintain LVM metadata continuity. Failure to adhere to this configuration renders the configuration unsupported by Red Hat and may result in storage corruption and loss of data. - Format the logical volume with a GFS2 file system. One journal is required for each node that mounts the file system. Ensure that you create enough journals for each of the nodes in your cluster.
#
mkfs.gfs2 -j2 -p lock_dlm -t rhel7-demo:sasbin /dev/sasbin_vg/sasbin_lv
Warning
When you create the GFS2 filesystem, it is important to specify a correct value for the-t LockTableName
option. The correct format is ClusterName:FSName. Failure to specify a correct value will prevent the filesystem from mounting. Additionally, the file system name must be unique. For more information on the options for themkfs.gfs2
command, see Section 3.1, “Creating a GFS2 File System”. - Configure a
clusterfs
resource.You should not add the file system to the/etc/fstab
file because it will be managed as a Pacemaker cluster resource. Mount options can be specified as part of the resource configuration withoptions=options
. Run thepcs resource describe Filesystem
command for full configuration options.This cluster resource creation command specifies thenoatime
mount option, which is recommended for GFS2 file systems where the application allows it.In this example, the file system has the same name as the mount point. This is not a requirement, but it is recommended that the file system name relate to its actual use or mount point to help with troubleshooting should the file system encounter a problem.#
# pcs resource create clusterfs Filesystem device="/dev/sasbin_vg/sasbin_lv" directory="/usr/local/sasbin" fstype="gfs2" options="noatime" op monitor interval=10s on-fail=fence clone interleave=true
- Set up GFS2 and
clvmd
dependency and startup order. GFS2 must start afterclvmd
and must run on the same node asclvmd
.#
pcs constraint order start clvmd-clone then clusterfs-clone
#pcs constraint colocation add clusterfs-clone with clvmd-clone
- Verify that GFS2 is mounted as expected.
#
mount |grep sas
/dev/mapper/sasbin_vg-sasbin_lv on /usr/local/sasbin type gfs2 (rw,noatime,seclabel)
Appendix A. GFS2 Performance Analysis with Performance Co-Pilot
A.1. Overview of Performance Co-Pilot
PCPIntro
(1) man page and the additional PCP man pages.
Table A.1. PCP Tools
Tool | Use |
---|---|
pmcd | Performance Metric Collector Service: collects the metric data from the PMDA and makes the metric data available for the other components in PCP |
pmlogger | Allows the creation of archive logs of performance metric values which may be played back by other PCP tools |
pmproxy | A protocol proxy for pmcd which allows PCP monitoring clients to connect to one or more instances of pmcd by means of pmproxy |
pminfo | Displays information about performance metrics on the command line |
pmstore | Allows the modification of performance metric values (re-initialize counters or assign new values) |
pmdumptext | Exports performance metric data either live or from performance archives to an ASCII table |
pmchart | Graphical utility that plots performance metric values into charts (pcp-gui package) |
A.2. PCP Deployment
pcp-gui
package to allow graphical representation of trace data through the pmchart
tool
pcp-doc
package, which is installed to /usr/share/doc/pcp-doc
by default. PCP also provides a man page for every tool.
A.3. PCP Installation
debugfs
file system must be mounted in order for the GFS2 PMDA to operate correctly. If the debugfs
file system is not mounted, run the following commands commands before installing the GFS2 PMDA.
#mkdir /sys/kernel/debug
#mount -t debugfs none /sys/kernel/debug
#yum install pcp pcp-gui pcp-pmda-gfs2
#cd /var/lib/pcp/pmdas/gfs2
#./Install
collector
allows the collection of performance metrics on the current systemmonitor
only allows the system to monitor local system or remote systems or both local and remote systemboth
enables both thecollector
andmonitor
configurations
#./Install
You will need to choose an appropriate configuration for installation of the "gfs2" Performance Metrics Domain Agent (PMDA). collector collect performance statistics on this system monitor allow this system to monitor local and/or remote systems both collector and monitor configuration for this system Please enter c(ollector) or m(onitor) or b(oth) [b
] Updating the Performance Metrics Name Space (PMNS) ... Terminate PMDA if already installed ... Updating the PMCD control file, and notifying PMCD ... Waiting for pmcd to terminate ... Starting pmcd ... Starting pmlogger ... Check gfs2 metrics have appeared ... 316 metrics and 205 values
debugfs
is mounted (there may be warnings in the event that there is not at least one GFS2 file system loaded on the system).
Note
A.4. Tracing GFS2 Performance Data
pminfo
tool. The pminfo
command line tool displays information about available performance metrics. Normally pminfo
operates using the local metric namespace but you can change this to view the metrics on a remote host by using the -h
flag, For further information on the pminfo
tool, see the pminfo
(1) man page.
# pminfo gfs2
-T
flag order to obtain help information and descriptions for each metric along with the -f
flag to obtain a current reading of the performance value that corresponds to each metric. You can do this for a group of metrics or an individual metric. Most metric data is provided for each mounted GFS2 file system on the system at time of probing.
#pminfo -t gfs2.glocks
gfs2.glocks.total [Count of total observed incore GFS2 global locks] gfs2.glocks.shared [GFS2 global locks in shared state] gfs2.glocks.unlocked [GFS2 global locks in unlocked state] gfs2.glocks.deferred [GFS2 global locks in deferred state] gfs2.glocks.exclusive [GFS2 global locks in exclusive state] #pminfo -T gfs2.glocks.total
gfs2.glocks.total Help: Count of total incore GFS2 glock data structures based on parsing the contents of the /sys/kernel/debug/gfs2/bdev/glocks files. #pminfo -f gfs2.glocks.total
gfs2.glocks.total inst [0 or "testcluster:clvmd_gfs2"] value 74
pminfo
tool with the -T
flag.
Table A.2. PCP Metric Groups for GFS2
Metric Group | Metric Provided |
---|---|
gfs2.sbstats.* | Timing metrics regarding the information collected from the superblock stats file (sbstats ) for each GFS2 file system currently mounted on the system. |
gfs2.glocks.* | Metrics regarding the information collected from the glock stats file (glocks ) which count the number of glocks in each state that currently exists for each GFS2 file system currently mounted on the system. |
gfs2.glstats.* | Metrics regarding the information collected from the glock stats file (glstats ) which count the number of each type of glock that currently exists for each GFS2 file system currently mounted on the system. |
gfs2.tracepoints.* | Metrics regarding the output from the GFS2 debugfs tracepoints for each file system currently mounted on the system. Each sub-type of these metrics (one of each GFS2 tracepoint) can be individually controlled whether on or off using the control metrics. |
gfs2.worst_glock.* | A computed metric making use of the data from the gfs2_glock_lock_time tracepoint to calculate a perceived “current worst glock” for each mounted file system. This metric is useful for discovering potential lock contention and file system slows down if the same lock is suggested multiple times. |
gfs2.latency.grant.* | A computed metric making use of the data from both the gfs2_glock_queue and gfs2_glock_state_change tracepoints to calculate an average latency in microseconds for glock grant requests to be completed for each mounted file system. This metric is useful for discovering potential slowdowns on the file system when the grant latency increases. |
gfs2.latency.demote.* | A computed metric making use of the data from both the gfs2_glock_state_change and gfs2_demote_rq tracepoints to calculate an average latency in microseconds for glock demote requests to be completed for each mounted file system. This metric is useful for discovering potential slowdowns on the file system when the demote latency increases. |
gfs2.latency.queue.* | A computed metric making use of the data from the gfs2_glock_queue tracepoint to calculate an average latency in microseconds for glock queue requests to be completed for each mounted file system. |
gfs2.control.* | Configuration metrics which are used to control what tracepoint metrics are currently enabled or disabled and are toggled by means of the pmstore tool. These configuration metrics are described in Section A.5, “Metric Configuration (using pmstore )”. |
A.5. Metric Configuration (using pmstore
)
gsf2.control.*
metrics with the GFS2 PMDA. This is achieved through the use of the pmstore
command line tool. As with most of the other PCP tools, the pmstore
tool normally changes the current value for the specified metric on the local system, but you can use the -h
switch to allow the change of metric values on specified remote systems. For further information, see the pmstore
(3) man page.
debugfs
file system.
# pmstore gfs2.control.tracepoints.all 1
gfs2.control.tracepoints.all old value=0 new value=1
pminfo
tool.
Table A.3. Control Tracepoints
Control Metric | Use and Available Options |
---|---|
gfs2.contol.tracepoints.all | The GFS2 tracepoint statistics can be manually controlled using 0 [off] or 1 [on]. Setting the value of the metric controls the behavior of the PMDA to whether it tries to collect from tracepoint metrics or not. |
gfs2.control.tracepoints.* | The GFS2 tracepoint statistics can be manually controlled using 0 [off] or 1 [on]. Setting the value of the metric controls the behavior of the PMDA to whether it tries to collect from each specified tracepoint metric or not. |
gfs2.control.global_tracing | The global tracing can be controlled using 0 [off] or 1 [on]. This is required to be on for most of the GFS2 metrics to function. |
gfs2.control.worst_glock | Can be individually controlled whether on or off using the control metrics.0 [off] or 1 [on]. Setting the value of the metric controls the behavior of the PMDA to whether it tries to collect the lock_time metrics or not. The machine must have the GFS2 tracepoints available for the glock_lock_time based metrics to function. |
gfs2.control.latency | The gfs2.latency statistics can be manually controlled using pmstore gfs2.control.latency 0 [off] or 1 [on]. Setting the value of the metric controls the behavior of the PMDA to whether it tries to collect the latency metrics or not. The machine must have the gfs2 tracepoints available for the latency metrics to function. |
gfs2.control.glock_threshold | The number of glocks that will be processed and accepted over all ftrace statistics. This number can be manually altered using the pmstore tool in order to tailor the number of glocks processed. This value must be positive. |
A.6. Logging Performance Data (using pmlogger
)
pmlogger
tool. These metric archives may be played back at a later date to give retrospective performance analysis.
pmlogger
tool provides flexibility and control over the logged metrics by allowing you to specify which metrics are recorded on the system and at what frequency. By default, the configuration file for pmlogger
is stored at /var/lib/pcp/config/pmlogger/config.default
; the configuration file outlines which metrics are logged by the primary logging instance.
pmlogger
to log metric values on the local machine, a primary logging instance must be started. You can use systemctl
to ensure that pmlogger
is started as a service when the machine starts.
pmlogger
configuration file which enables the recording of GFS2 performance metrics. This extract shows that pmlogger
will log the performance metric values for the PCP GFS2 latency metrics every 10 seconds, the top 10 worst glock metric every 30 seconds, the tracepoint data every minute, and it will log the data from the glock
, glstats
and sbstats
metrics every 10 minutes.
# It is safe to make additions from here on ... # log mandatory on every 5 seconds { gfs2.latency.grant gfs2.latency.queue gfs2.latency.demote gfs2.glocks } log mandatory on every 10 seconds { gfs2.worst_glock } log mandatory on every 30 seconds { gfs2.tracepoints } log mandatory on every 5 minutes { gfs2.glstats gfs2.sbstats } [access] disallow * : all; allow localhost : enquire;
Note
pmlogger
is enabled. However, no logging of GFS2 metrics occur with this default configuration.
pmdumptext
. This tool allows the user to parse the selected PCP log archive and export the values into an ASCII table. pmdumptext
can be used to dump the entire archive log or only select metric values from the log by specifying individual metrics through the command line. For more information on using pmdumptext
, see the pmdumptext
(1) man page.
A.7. Visual Tracing (using PCP-GUI
and pmchart
)
pmchart
graphical utility to plot performance metric values into graphs. The pmchart
utility allows multiple charts to be displayed simultaneously, with metrics being sourced from one or more live hosts with alternative options to use metric data from PCP log archives as a source of historical data.
pmchart
, the PCP charts GUI displays. On the bottom of the display is the pmtime
VCR-like controls. The start/pause button allows you to control the interval in which the metric data is polled and in the event that you are using historical data, the date and time for the metrics.
File -> New Chart
option in the toolbar, you can select a metric from both the local machine and remote machines by specifying their host name or address and then selecting performance metrics from the remote hosts. Advanced configuration options include the ability to manually set the axis values for the chart and to manually choose the color of the plots.
pmchart
. You can save an image of the current view through the File -> Export
option in the toolbar. Recording is made available by the Record -> Start
option in the toolbar and these recordings can be stopped at a later time using Record -> Stop
. After the recording has been terminated, the recorded metrics are archived to be viewed at a later date.
pmchart
interface to display the data from performance metrics in multiple ways, including line plot, bar graphs and utilization graphs. In pmchart
, the main configuration file known as the “view” allows the metadata associated with one or more charts to be saved. This metadata describes all of the chart's aspects including the metrics used and the chart columns. You can create a custom “view” configuration which can be saved using File -> Save View
and then loaded again at a later time. For more information about view configuration files and their syntax, see the pmchart
(1) man page.
pmchart
view configuration describes a stacking chart graph showing the total number of glocks for the mounted GFS2 file system loop1
using the gfs2.glocks
metric. We also have a plot graph underneath which plots the average latency for the glock grant, demote and queue requests for the same file system instance “loop1”.
#kmchart
version 1
chart title "Total number of Glocks /loop1" style stacking antialiasing off
plot legend "Shared" metric gfs2.glocks.shared instance "loop1"
plot legend "Unlocked" metric gfs2.glocks.unlocked instance "loop1"
plot legend "Deferred" metric gfs2.glocks.deferred instance "loop1"
plot legend "Exclusive"metric gfs2.glocks.exclusive instance "loop1"
chart title "Average Glock Latency (usecs) /loop1" style plot antialiasing off
plot legend "Demote" metric gfs2.latency.demote.all instance "loop1"
plot legend "Grant" metric gfs2.latency.grant.all instance "loop1"
plot legend "Queue" metric gfs2.latency.queue.all instance "loop1"
Appendix B. GFS2 Tracepoints and the debugfs glocks File
debugfs
interface and the GFS2 tracepoints. It is intended for advanced users who are familiar with file system internals who would like to learn more about the design of GFS2 and how to debug GFS2-specific issues.
B.1. GFS2 Tracepoint Types
blktrace
infrastructure and the blktrace
tracepoints can be used in combination with those of GFS2 to gain a fuller picture of the system performance. Due to the level at which the tracepoints operate, they can produce large volumes of data in a very short period of time. They are designed to put a minimum load on the system when they are enabled, but it is inevitable that they will have some effect. Filtering events by a variety of means can help reduce the volume of data and help focus on obtaining just the information which is useful for understanding any particular situation.
B.2. Tracepoints
/sys/kernel/debug/tracing/
directory assuming that debugfs
is mounted in the standard place at the /sys/kernel/debug
directory. The events
subdirectory contains all the tracing events that may be specified and, provided the gfs2
module is loaded, there will be a gfs2
subdirectory containing further subdirectories, one for each GFS2 event. The contents of the /sys/kernel/debug/tracing/events/gfs2
directory should look roughly like the following:
[root@chywoon gfs2]# ls
enable gfs2_bmap gfs2_glock_queue gfs2_log_flush
filter gfs2_demote_rq gfs2_glock_state_change gfs2_pin
gfs2_block_alloc gfs2_glock_put gfs2_log_blocks gfs2_promote
[root@chywoon gfs2]# echo -n 1 >/sys/kernel/debug/tracing/events/gfs2/enable
enable
file in each of the individual event subdirectories. The same is true of the filter
file which can be used to set an event filter for each event or set of events. The meaning of the individual events is explained in more detail below.
[root@chywoon gfs2]# cat /sys/kernel/debug/tracing/trace
/sys/kernel/debug/tracing/trace_pipe
, can be used when all the output is required. Events are read from this file as they occur; there is no historical information available through this interface. The format of the output is the same from both interfaces and is described for each of the GFS2 events in the later sections of this appendix.
trace-cmd
is available for reading tracepoint data. For more information on this utility, see the link in Section B.10, “References”. The trace-cmd
utility can be used in a similar way to the strace
utility, for example to run a command while gathering trace data from various sources.
B.3. Glocks
Table B.1. Glock Modes and DLM Lock Modes
Glock mode | DLM lock mode | Notes |
---|---|---|
UN | IV/NL | Unlocked (no DLM lock associated with glock or NL lock depending on I flag) |
SH | PR | Shared (protected read) lock |
EX | EX | Exclusive lock |
DF | CW | Deferred (concurrent write) used for Direct I/O and file system freeze |
Note
Table B.2. Glock Modes and Data Types
Glock mode | Cache Data | Cache Metadata | Dirty Data | Dirty Metadata |
---|---|---|---|---|
UN | No | No | No | No |
SH | Yes | Yes | No | No |
DF | No | Yes | No | No |
EX | Yes | Yes | Yes | Yes |
B.4. The glock debugfs Interface
debugfs
interface allows the visualization of the internal state of the glocks and the holders and it also includes some summary details of the objects being locked in some cases. Each line of the file either begins G: with no indentation (which refers to the glock itself) or it begins with a different letter, indented with a single space, and refers to the structures associated with the glock immediately above it in the file (H: is a holder, I: an inode, and R: a resource group) . Here is an example of what the content of this file might look like:
G: s:SH n:5/75320 f:I t:SH d:EX/0 a:0 r:3 H: s:SH f:EH e:0 p:4466 [postmark] gfs2_inode_lookup+0x14e/0x260 [gfs2] G: s:EX n:3/258028 f:yI t:EX d:EX/0 a:3 r:4 H: s:EX f:tH e:0 p:4466 [postmark] gfs2_inplace_reserve_i+0x177/0x780 [gfs2] R: n:258028 f:05 b:22256/22256 i:16800 G: s:EX n:2/219916 f:yfI t:EX d:EX/0 a:0 r:3 I: n:75661/219916 t:8 f:0x10 d:0x00000000 s:7522/7522 G: s:SH n:5/127205 f:I t:SH d:EX/0 a:0 r:3 H: s:SH f:EH e:0 p:4466 [postmark] gfs2_inode_lookup+0x14e/0x260 [gfs2] G: s:EX n:2/50382 f:yfI t:EX d:EX/0 a:0 r:2 G: s:SH n:5/302519 f:I t:SH d:EX/0 a:0 r:3 H: s:SH f:EH e:0 p:4466 [postmark] gfs2_inode_lookup+0x14e/0x260 [gfs2] G: s:SH n:5/313874 f:I t:SH d:EX/0 a:0 r:3 H: s:SH f:EH e:0 p:4466 [postmark] gfs2_inode_lookup+0x14e/0x260 [gfs2] G: s:SH n:5/271916 f:I t:SH d:EX/0 a:0 r:3 H: s:SH f:EH e:0 p:4466 [postmark] gfs2_inode_lookup+0x14e/0x260 [gfs2] G: s:SH n:5/312732 f:I t:SH d:EX/0 a:0 r:3 H: s:SH f:EH e:0 p:4466 [postmark] gfs2_inode_lookup+0x14e/0x260 [gfs2]
cat /sys/kernel/debug/gfs2/unity:myfs/glocks >my.lock
during a run of the postmark benchmark on a single node GFS2 file system. The glocks in the figure have been selected in order to show some of the more interesting features of the glock dumps.
iopen
glock which relates to inode 75320. In the case of inode and iopen
glocks, the glock number is always identical to the inode's disk block number.
Note
blktrace
for example) and with output from stat
(1).
debugfs
interface.
Table B.3. Glock Types
Type number | Lock type | Use |
---|---|---|
1 | trans | Transaction lock |
2 | inode | Inode metadata and data |
3 | rgrp | Resource group metadata |
4 | meta | The superblock |
5 | iopen | Inode last closer detection |
6 | flock | flock (2) syscall |
8 | quota | Quota operations |
9 | journal | Journal mutex |
Table B.4. Glock flags
Flag | Name | Meaning |
---|---|---|
d | Pending demote | A deferred (remote) demote request |
D | Demote | A demote request (local or remote) |
f | Log flush | The log needs to be committed before releasing this glock |
F | Frozen | Replies from remote nodes ignored - recovery is in progress. |
i | Invalidate in progress | In the process of invalidating pages under this glock |
I | Initial | Set when DLM lock is associated with this glock |
l | Locked | The glock is in the process of changing state |
L | LRU | Set when the glock is on the LRU list` |
o | Object | Set when the glock is associated with an object (that is, an inode for type 2 glocks, and a resource group for type 3 glocks) |
p | Demote in progress | The glock is in the process of responding to a demote request |
q | Queued | Set when a holder is queued to a glock, and cleared when the glock is held, but there are no remaining holders. Used as part of the algorithm the calculates the minimum hold time for a glock. |
r | Reply pending | Reply received from remote node is awaiting processing |
y | Dirty | Data needs flushing to disk before releasing this glock |
B.5. Glock Holders
Table B.5. Glock holder flags
Flag | Name | Meaning |
---|---|---|
a | Async | Do not wait for glock result (will poll for result later) |
A | Any | Any compatible lock mode is acceptable |
c | No cache | When unlocked, demote DLM lock immediately |
e | No expire | Ignore subsequent lock cancel requests |
E | Exact | Must have exact lock mode |
F | First | Set when holder is the first to be granted for this lock |
H | Holder | Indicates that requested lock is granted |
p | Priority | Enqueue holder at the head of the queue |
t | Try | A "try" lock |
T | Try 1CB | A "try" lock that sends a callback |
W | Wait | Set while waiting for request to complete |
try 1CB
) lock, on the other hand, is identical to the t lock except that the DLM will send a single callback to current incompatible lock holders. One use of the T (try 1CB
) lock is with the iopen
locks, which are used to arbitrate among the nodes when an inode's i_nlink
count is zero, and determine which of the nodes will be responsible for deallocating the inode. The iopen
glock is normally held in the shared state, but when the i_nlink
count becomes zero and ->evict_inode
() is called, it will request an exclusive lock with T (try 1CB
) set. It will continue to deallocate the inode if the lock is granted. If the lock is not granted it will result in the node(s) which were preventing the grant of the lock marking their glock(s) with the D (demote) flag, which is checked at ->drop_inode
() time in order to ensure that the deallocation is not forgotten.
close
() occurs. Also, at the same time as the inode's link count is decremented to zero the inode is marked as being in the special state of having zero link count but still in use in the resource group bitmap. This functions like the ext3 file system3's orphan list in that it allows any subsequent reader of the bitmap to know that there is potentially space that might be reclaimed, and to attempt to reclaim it.
B.6. Glock Tracepoints
blktrace
output and with knowledge of the on-disk layout. It is then possible to check that any given I/O has been issued and completed under the correct lock, and that no races are present.
gfs2_glock_state_change
tracepoint is the most important one to understand. It tracks every state change of the glock from initial creation right through to the final demotion which ends with gfs2_glock_put
and the final NL to unlocked transition. The l (locked) glock flag is always set before a state change occurs and will not be cleared until after it has finished. There are never any granted holders (the H glock holder flag) during a state change. If there are any queued holders, they will always be in the W (waiting) state. When the state change is complete then the holders may be granted which is the final operation before the l glock flag is cleared.
gfs2_demote_rq
tracepoint keeps track of demote requests, both local and remote. Assuming that there is enough memory on the node, the local demote requests will rarely be seen, and most often they will be created by umount
or by occasional memory reclaim. The number of remote demote requests is a measure of the contention between nodes for a particular inode or resource group.
gfs2_glock_lock_time
tracepoint provides information on the time taken by requests to the DLM. The blocking (b
) flag was introduced into the glock specifically to be used in combination with this tracepoint.
gfs2_promote
is called, this occurs as the final stages of a state change or when a lock is requested which can be granted immediately due to the glock state already caching a lock of a suitable mode. If the holder is the first one to be granted for this glock, then the f (first) flag is set on that holder. This is currently used only by resource groups.
B.7. Bmap Tracepoints
gfs2_bmap
tracepoint is called twice for each bmap operation: once at the start to display the bmap request, and once at the end to display the result. This makes it easy to match the requests and results together and measure the time taken to map blocks in different parts of the file system, different file offsets, or even of different files. It is also possible to see what the average extent sizes being returned are in comparison to those being requested.
gfs2_rs
tracepoint traces block reservations as they are created, used, and destroyed in the block allocator.
gfs2_block_alloc
is called not only on allocations, but also on freeing of blocks. Since the allocations are all referenced according to the inode for which the block is intended, this can be used to track which physical blocks belong to which files in a live file system. This is particularly useful when combined with blktrace
, which will show problematic I/O patterns that may then be referred back to the relevant inodes using the mapping gained by means this tracepoint.
B.8. Log tracepoints
gfs2_pin
), as well as the time taken to commit the transactions to the log (gfs2_log_flush
). This can be very useful when trying to debug journaling performance issues.
gfs2_log_blocks
tracepoint keeps track of the reserved blocks in the log, which can help show if the log is too small for the workload, for example.
gfs2_ail_flush
tracepoint is similar to the gfs2_log_flush
tracepoint in that it keeps track of the start and end of flushes of the AIL list. The AIL list contains buffers which have been through the log, but have not yet been written back in place and this is periodically flushed in order to release more log space for use by the file system, or when a process requests a sync
or fsync
.
B.9. Glock Statistics
dcount
, which counts the number of DLM operations requested. This shows how much data has gone into the mean/variance calculations.qcount
, which counts the number ofsyscall
level operations requested. Generallyqcount
will be equal to or greater thandcount
.
- srtt/srttvar: Smoothed round trip time for non-blocking operations
- srttb/srttvarb: Smoothed round trip time for blocking operations
- irtt/irttvar: Inter-request time (for example, time between DLM requests)
sysfs
files:
- The
glstats
file. This file is similar to theglocks
file, except that it contains statistics, with one glock per line. The data is initialized from "per cpu" data for that glock type for which the glock is created (aside from counters, which are zeroed). This file may be very large. - The
lkstats
file. This contains "per cpu" stats for each glock type. It contains one statistic per line, in which each column is a cpu core. There are eight lines per glock type, with types following on from each other.
B.10. References
glocks
file, see the following resources:
- For information on glock internal locking rules, see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/gfs2-glocks.rst.
- For information on event tracing, see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/trace/events.rst.`
- For information on the
trace-cmd
utility, see http://lwn.net/Articles/341902/.
Appendix C. Revision History
Revision History | |||
---|---|---|---|
Revision 4.1-1 | Wed Aug 7 2019 | Steven Levine | |
| |||
Revision 3.1-1 | Thu Oct 4 2018 | Steven Levine | |
| |||
Revision 2.1-1 | Thu Mar 15 2018 | Steven Levine | |
| |||
Revision 2.1-0 | Thu Dec 14 2017 | Steven Levine | |
| |||
Revision 1.3-6 | Wed Nov 8 2017 | Steven Levine | |
| |||
Revision 1.3-3 | Thu Jul 27 2017 | Steven Levine | |
| |||
Revision 1.3-1 | Wed May 10 2017 | Steven Levine | |
| |||
Revision 1.2-5 | Thu Mar 23 2017 | Steven Levine | |
| |||
Revision 1.2-4 | Mon Oct 17 2016 | Steven Levine | |
| |||
Revision 1.2-3 | Wed Aug 17 2016 | Steven Levine | |
| |||
Revision 0.3-5 | Mon Nov 9 2015 | steven levine | |
| |||
Revision 0.3-2 | Wed Aug 19 2015 | Steven Levine | |
| |||
Revision 0.2-13 | Wed Feb 18 2015 | Steven Levine | |
| |||
Revision 0.2-8 | Thu Dec 11 2014 | Steven Levine | |
| |||
Revision 0.1-29 | Wed Jun 11 2014 | Steven Levine | |
| |||
Revision 0.1-11 | Mon Dec 9 2013 | Steven Levine | |
| |||
Revision 0.1-1 | Wed Jan 16 2013 | Steven Levine | |
|
Index
A
- acl mount option, Mounting a GFS2 File System
- adding journals to a file system, Adding Journals to a GFS2 File System
- atime, configuring updates, Configuring atime Updates
- mounting with noatime , Mount with noatime
- mounting with relatime , Mount with relatime
C
- Configuration considerations, GFS2 Configuration and Operational Considerations
- configuration, before, Before Setting Up GFS2
D
- data journaling, Data Journaling
- debugfs, GFS2 Tracepoints and the debugfs glocks File
- debugfs file, Troubleshooting GFS2 Performance with the GFS2 Lock Dump
- disk quotas
- additional resources, References
- assigning per group, Assigning Quotas Per Group
- assigning per user, Assigning Quotas Per User
- enabling, Configuring Disk Quotas
- creating quota files, Creating the Quota Database Files
- quotacheck, running, Creating the Quota Database Files
- hard limit, Assigning Quotas Per User
- management of, Managing Disk Quotas
- quotacheck command, using to check, Keeping Quotas Accurate
- reporting, Managing Disk Quotas
- soft limit, Assigning Quotas Per User
F
- features, new and changed, New and Changed Features
- file system
- adding journals, Adding Journals to a GFS2 File System
- atime, configuring updates, Configuring atime Updates
- mounting with noatime , Mount with noatime
- mounting with relatime , Mount with relatime
- data journaling, Data Journaling
- growing, Growing a GFS2 File System
- making, Creating a GFS2 File System
- mounting, Mounting a GFS2 File System
- quota management, GFS2 Quota Management, Setting Up Quotas in Enforcement or Accounting Mode
- synchronizing quotas, Synchronizing Quotas with the quotasync Command
- repairing, Repairing a GFS2 File System
- suspending activity, Suspending Activity on a GFS2 File System
- unmounting, Unmounting a GFS2 File System
- fsck.gfs2 command, Repairing a GFS2 File System
G
- GFS2
- atime, configuring updates, Configuring atime Updates
- mounting with noatime , Mount with noatime
- mounting with relatime , Mount with relatime
- Configuration considerations, GFS2 Configuration and Operational Considerations
- managing, Managing GFS2
- Operation, GFS2 Configuration and Operational Considerations
- quota management, GFS2 Quota Management, Setting Up Quotas in Enforcement or Accounting Mode
- synchronizing quotas, Synchronizing Quotas with the quotasync Command
- withdraw function, The GFS2 Withdraw Function
- GFS2 file system maximum size, GFS2 Support Limits
- GFS2-specific options for adding journals table, Complete Usage
- GFS2-specific options for expanding file systems table, Complete Usage
- gfs2_grow command, Growing a GFS2 File System
- gfs2_jadd command, Adding Journals to a GFS2 File System
- glock, GFS2 Tracepoints and the debugfs glocks File
- glock flags, Troubleshooting GFS2 Performance with the GFS2 Lock Dump, The glock debugfs Interface
- glock holder flags, Troubleshooting GFS2 Performance with the GFS2 Lock Dump, Glock Holders
- glock types, Troubleshooting GFS2 Performance with the GFS2 Lock Dump, The glock debugfs Interface
- growing a file system, Growing a GFS2 File System
M
- making a file system, Creating a GFS2 File System
- managing GFS2, Managing GFS2
- maximum size, GFS2 file system, GFS2 Support Limits
- mkfs command, Creating a GFS2 File System
- mkfs.gfs2 command options table, Complete Options
- mount command, Mounting a GFS2 File System
- mount table, Complete Usage
- mounting a file system, Mounting a GFS2 File System
N
- node locking, GFS2 Node Locking
O
- overview, GFS2 Overview
- configuration, before, Before Setting Up GFS2
- features, new and changed, New and Changed Features
P
- performance tuning, Performance Tuning with GFS2
- Posix locking, Issues with Posix Locking
Q
- quota management, GFS2 Quota Management, Setting Up Quotas in Enforcement or Accounting Mode
- synchronizing quotas, Synchronizing Quotas with the quotasync Command
- quotacheck , Creating the Quota Database Files
- quotacheck command
- checking quota accuracy with, Keeping Quotas Accurate
- quota_quantum tunable parameter, Synchronizing Quotas with the quotasync Command
R
- repairing a file system, Repairing a GFS2 File System
S
- suspending activity on a file system, Suspending Activity on a GFS2 File System
- system hang at unmount, Unmounting a GFS2 File System
T
- tables
- GFS2-specific options for adding journals, Complete Usage
- GFS2-specific options for expanding file systems, Complete Usage
- mkfs.gfs2 command options, Complete Options
- mount options, Complete Usage
- tracepoints, GFS2 Tracepoints and the debugfs glocks File
- tuning, performance, Performance Tuning with GFS2
U
- umount command, Unmounting a GFS2 File System
- unmount, system hang, Unmounting a GFS2 File System
- unmounting a file system, Unmounting a GFS2 File System
W
- withdraw function, GFS2, The GFS2 Withdraw Function