Global File System
Global File System
Global File System
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons
Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available
at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this
document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,
Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity
Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
This book provides information about configuring, and maintaining Red Hat GFS (Red Hat Global File
System) for Red Hat Enterprise Linux 5.
Introduction v
1. Audience ........................................................................................................................ v
2. Related Documentation ................................................................................................... v
3. Document Conventions ................................................................................................... vi
3.1. Typographic Conventions ..................................................................................... vi
3.2. Pull-quote Conventions ........................................................................................ vii
3.3. Notes and Warnings ........................................................................................... viii
4. Feedback ..................................................................................................................... viii
1. GFS Overview 1
1.1. New and Changed Features ......................................................................................... 2
1.2. Performance, Scalability, and Economy ......................................................................... 2
1.2.1. Superior Performance and Scalability ................................................................. 2
1.2.2. Economy and Performance ................................................................................ 3
1.3. GFS Software Components .......................................................................................... 4
1.4. Before Setting Up GFS ................................................................................................ 5
2. Getting Started 7
2.1. Prerequisite Tasks ........................................................................................................ 7
2.2. Initial Setup Tasks ........................................................................................................ 7
3. Managing GFS 9
3.1. Creating a File System ................................................................................................. 9
3.2. Mounting a File System .............................................................................................. 12
3.3. Unmounting a File System .......................................................................................... 14
3.4. Special Considerations when Mounting GFS File Systems ............................................ 15
3.5. Displaying GFS Tunable Parameters ........................................................................... 15
3.6. GFS Quota Management ............................................................................................ 17
3.6.1. Setting Quotas ................................................................................................ 17
3.6.2. Displaying Quota Limits and Usage .................................................................. 18
3.6.3. Synchronizing Quotas ...................................................................................... 20
3.6.4. Disabling/Enabling Quota Enforcement ............................................................. 21
3.6.5. Disabling/Enabling Quota Accounting ................................................................ 21
3.7. Growing a File System ............................................................................................... 22
3.8. Adding Journals to a File System ................................................................................ 24
3.9. Direct I/O ................................................................................................................... 27
3.9.1. O_DIRECT ....................................................................................................... 27
3.9.2. GFS File Attribute ............................................................................................ 27
3.9.3. GFS Directory Attribute .................................................................................... 28
3.10. Data Journaling ........................................................................................................ 29
3.11. Configuring atime Updates ...................................................................................... 30
3.11.1. Mount with noatime ..................................................................................... 30
3.11.2. Tune GFS atime Quantum ........................................................................... 31
3.12. Suspending Activity on a File System ........................................................................ 32
3.13. Displaying Extended GFS Information and Statistics ................................................... 32
3.13.1. Displaying GFS Space Usage ........................................................................ 32
3.13.2. Displaying GFS Counters ............................................................................... 33
3.13.3. Displaying Extended Status ............................................................................ 36
3.14. Repairing a File System ............................................................................................ 37
3.15. Context-Dependent Path Names ............................................................................... 39
3.16. The GFS Withdraw Function ..................................................................................... 41
A. Revision History 43
iii
Global File System
Index 45
iv
Introduction
The Global File System Configuration and Administration document provides information about
configuring and maintaining Red Hat GFS (Red Hat Global File System). A GFS file system can be
implemented in a standalone system or as part of a cluster configuration. For information about Red
Hat Cluster Suite refer to Red Hat Cluster Suite Overview and Configuring and Managing a Red Hat
Cluster.
HTML and PDF versions of all the official Red Hat Enterprise Linux manuals and release notes are
available online at http://www.redhat.com/docs/.
1. Audience
This book is intended primarily for Linux system administrators who are familiar with the following
activities:
• Installation and configuration of shared storage networks, such as Fibre Channel SANs
2. Related Documentation
For more information about using Red Hat Enterprise Linux, refer to the following resources:
• Red Hat Enterprise Linux Installation Guide — Provides information regarding installation of Red
Hat Enterprise Linux 5.
• Red Hat Enterprise Linux Deployment Guide — Provides information regarding the deployment,
configuration and administration of Red Hat Enterprise Linux 5.
For more information about Red Hat Cluster Suite for Red Hat Enterprise Linux 5, refer to the following
resources:
• Red Hat Cluster Suite Overview — Provides a high level overview of the Red Hat Cluster Suite.
• Configuring and Managing a Red Hat Cluster — Provides information about installing, configuring
and managing Red Hat Cluster components.
• Logical Volume Manager Administration — Provides a description of the Logical Volume Manager
(LVM), including information on running LVM in a clustered environment.
• Global File System 2: Configuration and Administration — Provides information about installing,
configuring, and maintaining Red Hat GFS2 (Red Hat Global File System 2).
• Using Device-Mapper Multipath — Provides information about using the Device-Mapper Multipath
feature of Red Hat Enterprise Linux 5.
• Using GNBD with Global File System — Provides an overview on using Global Network Block
Device (GNBD) with Red Hat GFS.
v
Introduction
• Red Hat Cluster Suite Release Notes — Provides information about the current release of Red Hat
Cluster Suite.
Red Hat Cluster Suite documentation and other Red Hat documents are available in HTML,
PDF, and RPM versions on the Red Hat Enterprise Linux Documentation CD and online at http://
www.redhat.com/docs/.
3. Document Conventions
This manual uses several conventions to highlight certain words and phrases and draw attention to
specific pieces of information.
1
In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. The
Liberation Fonts set is also used in HTML editions if the set is installed on your system. If not,
alternative but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later includes
the Liberation Fonts set by default.
Mono-spaced Bold
Used to highlight system input, including shell commands, file names and paths. Also used to highlight
keycaps and key combinations. For example:
The above includes a file name, a shell command and a keycap, all presented in mono-spaced bold
and all distinguishable thanks to context.
Key combinations can be distinguished from keycaps by the hyphen connecting each part of a key
combination. For example:
The first paragraph highlights the particular keycap to press. The second highlights two key
combinations (each a set of three keycaps with each set pressed simultaneously).
If source code is discussed, class names, methods, functions, variable names and returned values
mentioned within a paragraph will be presented as above, in mono-spaced bold. For example:
File-related classes include filesystem for file systems, file for files, and dir for
directories. Each class has its own associated set of permissions.
Proportional Bold
1
https://fedorahosted.org/liberation-fonts/
vi
Pull-quote Conventions
This denotes words or phrases encountered on a system, including application names; dialog box text;
labeled buttons; check-box and radio button labels; menu titles and sub-menu titles. For example:
Choose System → Preferences → Mouse from the main menu bar to launch Mouse
Preferences. In the Buttons tab, click the Left-handed mouse check box and click
Close to switch the primary mouse button from the left to the right (making the mouse
suitable for use in the left hand).
The above text includes application names; system-wide menu names and items; application-specific
menu names; and buttons and text found within a GUI interface, all presented in proportional bold and
all distinguishable by context.
Whether mono-spaced bold or proportional bold, the addition of italics indicates replaceable or
variable text. Italics denotes text you do not input literally or displayed text that changes depending on
circumstance. For example:
To see the version of a currently installed package, use the rpm -q package
command. It will return a result as follows: package-version-release.
Note the words in bold italics above — username, domain.name, file-system, package, version and
release. Each word is a placeholder, either for text you enter when issuing a command or for text
displayed by the system.
Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and
important term. For example:
vii
Introduction
Source-code listings are also set in mono-spaced roman but add syntax highlighting as follows:
package org.jboss.book.jca.ex1;
import javax.naming.InitialContext;
System.out.println("Created Echo");
Note
Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note
should have no negative consequences, but you might miss out on a trick that makes your
life easier.
Important
Important boxes detail things that are easily missed: configuration changes that only
apply to the current session, or services that need restarting before an update will apply.
Ignoring a box labeled 'Important' won't cause data loss but may cause irritation and
frustration.
Warning
Warnings should not be ignored. Ignoring warnings will most likely cause data loss.
4. Feedback
If you spot a typo, or if you have thought of a way to make this manual better, we would love to
hear from you. Please submit a report in Bugzilla (http://bugzilla.redhat.com/bugzilla/) against the
component rh-cs.
viii
Feedback
By mentioning this manual's identifier, we know exactly which version of the guide you have.
If you have a suggestion for improving the documentation, try to be as specific as possible. If you have
found an error, please include the section number and some of the surrounding text so we can find it
easily.
ix
x
Chapter 1.
GFS Overview
The Red Hat GFS file system is a native file system that interfaces directly with the Linux kernel file
system interface (VFS layer). A GFS file system can be implemented in a standalone system or as
part of a cluster configuration. When implemented as a cluster file system, GFS employs distributed
metadata and multiple journals.
Note
Red Hat does not support using GFS for cluster file system deployments greater than 16
nodes.
GFS is based on a 64-bit architecture, which can theoretically accommodate an 8 EB file system.
However, the current supported maximum size of a GFS file system is 25 TB. If your system requires
GFS file systems larger than 25 TB, contact your Red Hat service representative.
When determining the size of your file system, you should consider your recovery needs. Running
the fsck 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-subsytem failure, recovery time is limited by the
speed of your backup media.
When configured in a Red Hat Cluster Suite, Red Hat GFS nodes can be configured and managed
with Red Hat Cluster Suite configuration and management tools. Red Hat GFS then provides data
sharing among GFS nodes in a Red Hat cluster, with a single, consistent view of the file system name
space across the GFS nodes. This allows processes on different nodes to share GFS files in the
same way that processes on the same node can share files on a local file system, with no discernible
difference. For information about Red Hat Cluster Suite refer to Configuring and Managing a Red Hat
Cluster.
A GFS file system must be created on an LVM logical volume that is a linear or mirrored volume.
LVM logical volumes in a Red Hat Cluster suite are managed with CLVM, which is a cluster-wide
implementation of LVM, enabled by the CLVM daemon, clvmd, running in a Red Hat Cluster Suite
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
When you configure a GFS2 file system as a cluster file system, you must ensure that
all nodes in the cluster have access to the the shared file system. Asymmmetric cluster
configurations in which some nodes have access to the file system and others do not are
not supported.
This chapter provides some basic, abbreviated information as background to help you understand
GFS. It contains the following sections:
1
Chapter 1. GFS Overview
• GULM (Grand Unified Lock Manager) is not supported in Red Hat Enterprise Linux 5. If your GFS
file systems use the GULM lock manager, you must convert the file systems to use the DLM lock
manager. This is a two-part process.
• While running Red Hat Enterprise Linux 4, convert your GFS file systems to use the DLM lock
manager.
• Upgrade your operating system to Red Hat Enterprise Linux 5, converting the lock manager to
DLM when you do.
For information on upgrading to Red Hat Enterprise Linux 5 and converting GFS file systems to use
the DLM lock manager, see Configuring and Managing a Red Hat Cluster.
• Documentation for Red Hat Cluster Suite for Red Hat Enterprise Linux 5 has been expanded and
reorganized. For information on the available documents, see Section 2, “Related Documentation”.
The following sections provide examples of how GFS can be deployed to suit your needs for
performance, scalability, and economy:
Note
The deployment examples in this chapter reflect basic configurations; your needs might
require a combination of configurations shown in the examples.
2
Economy and Performance
Note
Clients implementing ext2 and ext3 file systems can be configured to access their own
dedicated slice of SAN storage.
3
Chapter 1. GFS Overview
Figure 1.3, “GFS and GNBD with Directly Connected Storage” shows how Linux client applications
can take advantage of an existing Ethernet topology to gain shared access to all block storage
devices. Client data files and file systems can be shared with GFS on each client. Application failover
can be fully automated with Red Hat Cluster Suite.
4
Before Setting Up GFS
GFS nodes
Determine which nodes in the Red Hat Cluster Suite will mount the GFS file systems.
When determining the size of your file system, you should consider your recovery needs. Running
the fsck 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-subsytem failure, recovery time is limited by
the speed of your backup media.
Journals
Determine the number of journals for your GFS file systems. One journal is required for each node
that mounts a GFS file system. Make sure to account for additional journals needed for future
expansion, as you cannot add journals dynamically to a GFS file system.
5
6
Chapter 2.
Getting Started
This chapter describes procedures for initial setup of GFS and contains the following sections:
Note
The system clocks in GFS 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.
1. Using LVM, create a logical volume for each Red Hat GFS file system.
Note
You can use init.d scripts included with Red Hat Cluster Suite to automate
activating and deactivating logical volumes. For more information about init.d
scripts, refer to Configuring and Managing a Red Hat Cluster.
2. Create GFS file systems on logical volumes created in Step 1. Choose a unique name for each file
system. For more information about creating a GFS file system, refer to Section 3.1, “Creating a
File System”.
You can use either of the following formats to create a clustered GFS file system:
7
Chapter 2. Getting Started
You can use either of the following formats to create a local GFS file system:
For more information on creating a GFS file system, see Section 3.1, “Creating a File System”.
3. At each node, mount the GFS file systems. For more information about mounting a GFS file
system, see Section 3.2, “Mounting a File System”.
Command usage:
The -o acl mount option allows manipulating file ACLs. 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).
Note
You can use init.d scripts included with Red Hat Cluster Suite to automate
mounting and unmounting GFS file systems. For more information about init.d
scripts, refer to Configuring and Managing a Red Hat Cluster.
8
Chapter 3.
Managing GFS
This chapter describes the tasks and commands for managing GFS and consists of the following
sections:
• Lock protocol/module name. The lock protocol for a cluster is lock_dlm. The lock protocol when
GFS is acting as a local file system (one node only) is lock_nolock.
• Number of journals (one journal required for each node that may be mounting the file systema.)
Make sure to account for additional journals needed for future expansion, as you cannot add
journals dynamically to a GFS file system.
When creating a GFS file system, you can use the gfs_mkfs directly, or you can use the mkfs
command with the -t parameter specifying a filesystem of type gfs, followed by the gfs file system
options.
9
Chapter 3. Managing GFS
Note
Once you have created a GFS file system with the gfs_mkfs command, you cannot
decrease the size of the file system. You can, however, increase the size of an existing
file system with the gfs_grow command, as described in Section 3.7, “Growing a File
System”.
Usage
When creating a clustered GFS filesystem, you can use either of the following formats:
When creating a local filesystem, you can use either of the following formats:
Warning
Make sure that you are very familiar with using the 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. The
lock protocol when GFS is acting as a local file system (one node only) is lock_nolock.
LockTableName
This parameter is specified for GFS filesystem in a cluster configuration. It has two parts
separated by a colon (no spaces) as follows: ClusterName:FSName
• ClusterName, the name of the Red Hat cluster for which the GFS file system is being created.
• FSName, the file system name, can be 1 to 16 characters long, and the name must be unique
among all file systems in the cluster.
NumberJournals
Specifies the number of journals to be created by the gfs_mkfs command. One journal is
required for each node that mounts the file system. (More journals than are needed can be
specified at creation time to allow for future expansion.)
BlockDevice
Specifies a volume.
10
Examples
Examples
In these 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.
Device: /dev/vg01/lvol0
Blocksize: 4096
Filesystem Size: 136380192
Journals: 8
Resource Groups: 2082
Locking Protocol: lock_dlm
Lock Table: alpha:mydata1
Syncing...
All Done
Device: /dev/vg01/lvol0
Blocksize: 4096
Filesystem Size: 136380192
Journals: 8
Resource Groups: 2082
Locking Protocol: lock_dlm
Lock Table: alpha:mydata1
Syncing...
All Done
In these examples, a second 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.
Complete Options
Table 3.1, “Command Options: gfs_mkfs” describes the gfs_mkfs command options.
11
Chapter 3. Managing GFS
12
Usage
clustering and locking systems must be started (refer to Chapter 2, Getting Started and Configuring
and Managing a Red Hat Cluster. After those requirements have been met, you can mount the GFS
file system as you would any Linux file system.
To manipulate file ACLs, you must mount the file system with the -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
Mounting Without ACL Manipulation
-o acl
GFS-specific option to allow manipulating file ACLs.
BlockDevice
Specifies the block device where the GFS file system resides.
MountPoint
Specifies the directory where the GFS file system should be mounted.
Example
In this example, the GFS file system on /dev/vg01/lvol0 is mounted on the /mydata1 directory.
Complete Usage
The -o option argument consists of GFS-specific options (refer to Table 3.2, “GFS-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
The mount command is a Linux system command. In addition to using GFS-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.
13
Chapter 3. Managing GFS
Table 3.2, “GFS-Specific Mount Options” describes the available GFS-specific -o option values that
can be passed to GFS at mount time.
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).
ignore_local_fs Forces GFS to treat the file system as a multihost file
Caution: This option should not be used system. By default, using lock_nolock automatically
when GFS file systems are shared. turns on the localcaching and localflocks flags.
localcaching Tells GFS that it is running as a local file system. GFS
Caution: This option should not be used can then turn on selected optimization capabilities
when GFS file systems are shared. that are not available when running in cluster mode.
The localcaching flag is automatically turned on by
lock_nolock.
localflocks Tells GFS to let the VFS (virtual file system) layer do all
Caution: This option should not be used flock and fcntl. The localflocks flag is automatically
when GFS file systems are shared. 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 For a clustered file system, allows the user to specify
which locking table to use with the file system.
oopses_ok This option allows a GFS node to not panic when an
oops occurs. (By default, a GFS node panics when
an oops occurs, causing the file system used by that
node to stall for other GFS nodes.) A GFS node not
panicking when an oops occurs minimizes the failure
on other GFS nodes using the file system that the
failed node is using. There may be circumstances
where you do not want to use this option — for
example, when you need more detailed troubleshooting
information. Use this option with care.
14
Usage
Note
The 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 GFS file system should be mounted.
To prevent the system from hanging when the GFS file systems are unmounted, you should do one of
the following:
• Always use an entry in the fstab file to mount the GFS file system.
• If a GFS file system has been mounted manually with the mount command, be sure to unmount the
file system manually with the umount command before rebooting or shutting down the system.
If your file system hangs while it is being unmounted during system shutdown under these
circumstances, perform a hardware reboot. It is unlikely that any data will be lost since the file system
is synced earlier in the shutdown process.
Parameters that you set with the gfs_tool settune command must be set on each node each time
the file system is mounted. These parameters are not persistent across mounts.
Note
The majority of the tunable parameters are internal parameters. They are intended for
development purposes only and should not be changed.
15
Chapter 3. Managing GFS
The gfs_tool gettune command displays a listing of the current values of the GFS tunable
parameters.
Usage
Display Tunable Parameters
MountPoint
Specifies the directory where the GFS file system is mounted.
Examples
In this example, all GFS tunable parameters for the file system on the mount point /mnt/gfs are
displayed.
16
GFS Quota Management
statfs_fast = 0
To prevent a performance slowdown, a GFS node synchronizes updates to the quota file only
periodically. The "fuzzy" quota accounting can allow users or groups to slightly exceed the set limit.
To minimize this, GFS dynamically reduces the synchronization period as a "hard" quota limit is
approached.
GFS uses its gfs_quota command to manage quotas. Other Linux quota facilities cannot be used
with GFS.
A hard limit is the amount of space that can be used. The file system will not let the user or group use
more than that amount of disk space. A hard limit value of zero means that no limit is enforced.
A warn limit is usually a value less than the hard limit. The file system will notify the user or group
when the warn limit is reached to warn them of the amount of space they are using. A warn limit value
of zero means that no limit is enforced.
Limits are set using the gfs_quota command. The command only needs to be run on a single node
where GFS is mounted.
Usage
Setting Quotas, Hard Limit
User
A user ID to limit or warn. It can be either a user name from the password file or the UID number.
17
Chapter 3. Managing GFS
Group
A group ID to limit or warn. It can be either a group name from the group file or the GID number.
Size
Specifies the new value to limit or warn. By default, the value is in units of megabytes. The
additional -k, -s and -b flags change the units to kilobytes, sectors, and file system blocks,
respectively.
MountPoint
Specifies the GFS file system to which the actions apply.
Examples
This example sets the hard limit for user Bert to 1024 megabytes (1 gigabyte) on file system /gfs.
This example sets the warn limit for group ID 21 to 50 kilobytes on file system /gfs.
Usage
Displaying Quota Limits for a User
User
A user ID to display information about a specific user. It can be either a user name from the
password file or the UID number.
Group
A group ID to display information about a specific group. It can be either a group name from the
group file or the GID number.
18
Displaying Quota Limits and Usage
MountPoint
Specifies the GFS file system to which the actions apply.
Command Output
GFS quota information from the gfs_quota command is displayed as follows:
The LimitSize, WarnSize, and Value numbers (values) are in units of megabytes by default.
Adding the -k, -s, or -b flags to the command line change the units to kilobytes, sectors, or file
system blocks, respectively.
User
A user name or ID to which the data is associated.
Group
A group name or ID to which the data is associated.
LimitSize
The hard limit set for the user or group. This value is zero if no limit has been set.
Value
The actual amount of disk space used by the user or group.
Comments
When displaying quota information, the gfs_quota command does not resolve UIDs and GIDs into
names if the -n option is added to the command line.
Space allocated to GFS's hidden files can be left out of displayed values for the root UID and GID
by adding the -d option to the command line. This is useful when trying to match the numbers from
gfs_quota with the results of a du command.
Examples
This example displays quota information for all users and groups that have a limit set or are using any
disk space on file system /gfs.
This example displays quota information in sectors for group users on file system /gfs.
19
Chapter 3. Managing GFS
As a user or group approaches their quota limit, GFS dynamically reduces the time between its
quota-file updates to prevent the limit from being exceeded. The normal time period between quota
synchronizations is a tunable parameter, quota_quantum, and can be changed using the gfs_tool
command. By default, the time period is 60 seconds. Also, 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.)
To see the current values of the GFS tunable parameters, including quota_quantum, you can use
the gfs_tool gettune, as described in Section 3.5, “Displaying GFS Tunable Parameters”.
You can use the gfs_quota sync command to synchronize the quota information from a node to the
on-disk quota file between the automatic updates performed by GFS.
Usage
Synchronizing Quota Information
MountPoint
Specifies the GFS file system to which the actions apply.
MountPoint
Specifies the GFS file system to which the actions apply.
Seconds
Specifies the new time period between regular quota-file synchronizations by GFS. Smaller values
may increase contention and slow down performance.
Examples
This example synchronizes the quota information from the node it is run on to file system /gfs.
This example changes the default time period between regular quota-file updates to one hour (3600
seconds) for file system /gfs on a single node.
20
Disabling/Enabling Quota Enforcement
To see the current values of the GFS tunable parameters, including quota_enforce, you can use
the gfs_tool gettune, as described in Section 3.5, “Displaying GFS Tunable Parameters”.
Usage
MountPoint
Specifies the GFS file system to which the actions apply.
quota_enforce {0|1}
0 = disabled
1 = enabled
Comments
A value of 0 disables enforcement. Enforcement can be enabled by running the command with a value
of 1 (instead of 0) as the final command line parameter. Even when GFS is not enforcing quotas, it still
keeps track of the file system usage for all users and groups so that quota-usage information does not
require rebuilding after re-enabling quotas.
Examples
This example disables quota enforcement on file system /gfs.
21
Chapter 3. Managing GFS
To see the current values of the GFS tunable parameters, including quota_account, you can use
the gfs_tool gettune, as described in Section 3.5, “Displaying GFS Tunable Parameters”.
Usage
MountPoint
Specifies the GFS file system to which the actions apply.
quota_account {0|1}
0 = disabled
1 = enabled
Comments
To enable quota accounting on a file system, the quota_account parameter must be set back
to 1. Afterward, the GFS quota file must be initialized to account for all current disk usage for
users and groups on the file system. The quota file is initialized by running: gfs_quota init -f
MountPoint.
Note
Initializing the quota file requires scanning the entire file system and may take a long time.
To see the current values of the GFS tunable parameters, including quota_account, you can use
the gfs_tool gettune, as described in Section 3.5, “Displaying GFS Tunable Parameters”.
Examples
This example disables quota accounting on file system /gfs on a single node.
This example enables quota accounting on file system /gfs on a single node and initializes the quota
file.
22
Usage
file system is updated. All nodes in the cluster can then use the extra storage space that has been
added.
The gfs_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.
To verify that the changes were successful, use the gfs_grow command with the -T (test) and -v
(verbose) flags. Running the command with those flags displays the current state of the mounted GFS
file system.
Note
Once you have created a GFS file system with the gfs_mkfs command, you cannot
decrease the size of the file system.
Usage
gfs_grow MountPoint
MountPoint
Specifies the GFS file system to which the actions apply.
Comments
Before running the gfs_grow command:
• Display the volume that is used by the file system to be expanded by running a df MountPoint
command.
• Expand the underlying cluster volume with LVM. For information on administering LVM volumes,
see the LVM Administrator's Guide
The gfs_grow command provides a -T (test) option that allows you to see the results of executing
the command without actually expanding the file system. Using this command with the -v provides
additional information.
After running the gfs_grow command, you can run a df MountPoint command on the file system
to check that the new space is now available in the file system.
Examples
In this example, the underlying logical volume for the file system file system on the /mnt/gfs
directory is extended, and then the file system is expanded.
23
Chapter 3. Managing GFS
Complete Usage
MountPoint
Specifies the directory where the GFS file system is mounted.
Device
Specifies the device node of the file system.
Table 3.3, “GFS-specific Options Available While Expanding A File System” describes the GFS-
specific options that can be used while expanding a GFS file system.
Option Description
-h Help. Displays a short usage message.
-q Quiet. Turns down the verbosity level.
-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.
-v Turns up the verbosity of messages.
Table 3.3. GFS-specific Options Available While Expanding A File System
The gfs_jadd command must be run on mounted file system, but it only needs to be run on one
node in the cluster. All the other nodes sense that the expansion has occurred.
To verify that the changes were successful, use the gfs_jadd command with the -T (test) and -v
(verbose) flags. Running the command with those flags displays the current state of the mounted GFS
file system.
Usage
24
Comments
Number
Specifies the number of new journals to be added.
MountPoint
Specifies the directory where the GFS file system is mounted.
Comments
Before running the gfs_jadd command:
• Run a df MountPoint command to display the volume used by the file system where journals will
be added.
• Expand the underlying cluster volume with LVM. For information on administering LVM volumes,
see the LVM Administrator's Guide
You can find out how many journals are currently used by the filesystem with the gfs_tool df
MountPoint command. In the following example, the file system mounted at /mnt/gfs uses 8
journals.
After running the gfs_jadd command, you can run the gfs_tool df MountPoint command
again to check that the new journals have been added to the file system.
Examples
In this example, one journal is added to the file system that is mounted at the /mnt/gfs directory.
The underlying logical volume for this filesystem is extended before the journal can be added.
25
Chapter 3. Managing GFS
In this example, two journals are added to the file system on the /mnt/gfs directory.
Complete Usage
MountPoint
Specifies the directory where the GFS file system is mounted.
Device
Specifies the device node of the file system.
Table 3.4, “GFS-specific Options Available When Adding Journals” describes the GFS-specific options
that can be used when adding journals to a GFS file system.
26
Direct I/O
An application invokes direct I/O by opening a file with the O_DIRECT flag. Alternatively, GFS can
attach a direct I/O attribute to a file, in which case direct I/O is used regardless of how the file is
opened.
When a file is opened with O_DIRECT, or when a GFS direct I/O attribute is attached to a file, all I/O
operations must be done in block-size multiples of 512 bytes. The memory being read from or written
to must also be 512-byte aligned.
One of the following methods can be used to enable direct I/O on a file:
• O_DIRECT
3.9.1. O_DIRECT
If an application uses the O_DIRECT flag on an open() system call, direct I/O is used for the opened
file.
To cause the O_DIRECT flag to be defined with recent glibc libraries, define _GNU_SOURCE at the
beginning of a source file before any includes, or define it on the cc line when compiling.
You can use the gfs_tool stat filename to check what flags have been set for a GFS file. The
output for this command includes a Flags: at the end of the display followed by a listing of the flags
that are set for the indicated file.
Usage
Setting the directio Flag
27
Chapter 3. Managing GFS
File
Specifies the file where the directio flag is assigned.
Example
In this example, the command sets the directio flag on the file named datafile in directory /
mnt/gfs.
The following command checks whether the directio flag is set for /mnt/gfs/datafile. The
output has been elided to show only the relevant information.
Flags:
directio
Usage
Setting the inherit_directio flag
Directory
Specifies the directory where the inherit_directio flag is set.
Example
In this example, the command sets the inherit_directio flag on the directory named /mnt/gfs/
data.
28
Data Journaling
This command displays the flags that have been set for the /mnt/gfs/data directory. The full output
has been truncated.
Data journaling can result in a reduced fsync() time, especially for small files, because the file data
is written to the journal in addition to the metadata. An fsync() returns as soon as the data is written
to the journal, which can be substantially faster than the time it takes to write the file data to the main
file system.
Applications that rely on fsync() to sync file data may see improved performance by using data
journaling. Data journaling can be enabled automatically for any GFS files created in a flagged
directory (and all its subdirectories). Existing files with zero length can also have data journaling turned
on or off.
Using the gfs_tool command, data journaling is enabled on a directory (and all its subdirectories)
or on a zero-length file by setting the inherit_jdata or jdata attribute flags to the directory or file,
respectively. The directory and file attribute flags can also be cleared.
Usage
Setting and Clearing the inherit_jdata Flag
Directory
Specifies the directory where the flag is set or cleared.
File
Specifies the zero-length file where the flag is set or cleared.
29
Chapter 3. Managing GFS
Examples
This example shows setting the inherit_jdata flag on a directory. All files created in the directory
or any of its subdirectories will have the jdata flag assigned automatically. Any data written to the
files will be journaled. This example also shows the gfs_tool stat command you can use to verify
what flags are set for a directory; the output has been elided to show only the relevant information.
This example shows setting the jdata flag on a file. The file must have a size of zero when you set
this flag. Any data written to the file will be journaled. This example also shows the gfs_tool stat
command you can use to verify what flags are set for a file; the output has been elided to show only
the relevant information.
• mtime — The last time the file (or directory) data was modified
• atime — The last time the file (or directory) data was accessed
If atime updates are enabled as they are by default on GFS and other Linux file systems then every
time a file is read, its inode needs to be updated.
Because few applications use the information provided by 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 atime updates.
30
Tune GFS atime Quantum
Usage
BlockDevice
Specifies the block device where the GFS file system resides.
MountPoint
Specifies the directory where the GFS file system should be mounted.
Example
In this example, the GFS file system resides on the /dev/vg01/lvol0 and is mounted on directory /
gfs with atime updates turned off.
Each GFS node updates the access time based on the difference between its system time and
the time recorded in the inode. It is required that system clocks of all GFS nodes in a cluster be
synchronized. If a node's system time is out of synchronization by a significant fraction of the tunable
parameter, atime_quantum, then atime updates are written more frequently. Increasing the
frequency of atime updates may cause performance degradation in clusters with heavy work loads.
To see the current values of the GFS tunable parameters, including atime_quantum, you can use
the gfs_tool gettune, as described in Section 3.5, “Displaying GFS Tunable Parameters”. The
default value for atime_quantum is 3600 seconds.
The gfs_tool settune command is used to change the atime_quantum parameter value. It must
be set on each node and each time the file system is mounted. The setting is not persistent across
unmounts.
Usage
Changing the atime_quantum Parameter Value
MountPoint
Specifies the directory where the GFS file system is mounted.
Seconds
Specifies the update period in seconds.
31
Chapter 3. Managing GFS
Example
In this example, the atime update period is set to once a day (86,400 seconds) for the GFS file
system on mount point /gfs.
Usage
Start Suspension
End Suspension
MountPoint
Specifies the file system.
Examples
This example suspends writes to file system /gfs.
The gfs_tool command provides additional action flags (options) not listed in this section. For more
information about other gfs_tool flags, refer to the gfs_tool man page.
32
Displaying GFS Counters
Usage
gfs_tool df MountPoint
MountPoint
Specifies the file system to which the action applies.
Example
This example reports extended file system usage about file system /mnt/gfs.
Note
The majority of the GFS counters reflect the internal operation of the GFS filesystem and
are for development purposes only.
locks
The number of gfs_glock structures that currently exist in gfs.
locks held
The number of existing gfs_glock structures that are not in the UNLOCKED state.
33
Chapter 3. Managing GFS
freeze count
A freeze count greater than 0 means the file system is frozen. A freeze count of 0 means the file
system is not frozen. Each gfs_tool freeze command increments this count. Each gfs_tool
unfreeze command decrements this count.
incore inodes
The number of gfs_inode structures that currently exist in gfs.
metadata buffers
The number of gfs_bufdata structures that currently exist in gfs.
unlinked inodes
The gfs_inoded daemon links deleted inodes to a global list and cleans them up every 15
seconds (a period that is tunable). This number is the list length. It is related to the number of
gfs_unlinked structures currently in gfs.
quota IDs
The number of gfs_quota_data structures that currently exist in gfs.
glock dependencies
The number of gfs_depend structures that currently exist in gfs.
log wraps
The number of times journal has wrapped around.
outstanding LM calls
obsolete
fh2dentry misses
The number of times an NFS call could not find a dentry structure in the cache.
glocks reclaimed
The number of glocks which have been reclaimed.
glock dq calls
The number of glocks released since the file system was mounted.
34
Displaying GFS Counters
lm_lock calls
The number of times the lock manager has been contacted to obtain a lock.
lm_unlock calls
The number of times the lock manager has been contacted to release a lock.
lm callbacks
The number of times the lock manager has been contacted to change a lock state.
address operations
The number of address space call operations (readpage, writepage, directIO,
prepare_write, and commit_write)
dentry operations
The number of times a seek operation has been performed on the vfs dentry structure.
export operations
The number of times a seek operation has been performed on the nfs dentry structure.
file operations
The number of file operations that have been invoked (read, write, seek, etc).
inode operations
The number of inode operations that have been invoked (create, delete, symlink, etc.).
super operations
The number of super block operations.
vm operations
The number of times the mmap function has been called. mmap call count
Usage
MountPoint
Specifies the file system to which the action applies.
Example
This example reports statistics about the file system mounted at /mnt/gfs.
locks 165
35
Chapter 3. Managing GFS
Note
The information that the gfs_tool stat command displays reflects internal file system
information. This information is intended for development purposes only.
Usage
File
Specifies the file from which to get information.
Example
This example reports extended file status about file /gfs/datafile.
36
Repairing a File System
mh_generation = 3
mh_format = 400
mh_incarn = 1
no_formal_ino = 66
no_addr = 66
di_mode = 0600
di_uid = 0
di_gid = 0
di_nlink = 1
di_size = 503156
di_blocks = 124
di_atime = 1207672023
di_mtime = 1207672023
di_ctime = 1207672023
di_major = 0
di_minor = 0
di_rgrp = 17
di_goal_rgrp = 17
di_goal_dblk = 371
di_goal_mblk = 44
di_flags = 0x00000000
di_payload_format = 0
di_type = 1
di_height = 1
di_incarn = 0
di_pad = 0
di_depth = 0
di_entries = 0
no_formal_ino = 0
no_addr = 0
di_eattr = 0
di_reserved =
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
Warning
The gfs_fsck command must be run only on a file system that is unmounted from all
nodes.
Note
The gfs_fsck command has changed from previous releases of Red Hat GFS in the
following ways:
• You can no longer set the interactive mode with Ctrl+C. Pressing Ctrl+C now
cancels the gfs_fsck command. Do not press Ctrl+C unless you want to cancel the
command.
37
Chapter 3. Managing GFS
• 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 answers no to any queries
automatically. The option provides a way of trying the command to reveal errors without
actually allowing the gfs_fsck command to take effect.
Refer to the gfs_fsck man page, gfs_fsck(8), for additional information about other
command options.
Usage
gfs_fsck -y BlockDevice
-y
The -y flag causes all questions to be answered with yes. With the -y flag specified, the
gfs_fsck command does not prompt you for an answer before making changes.
BlockDevice
Specifies the block device where the GFS file system resides.
Example
In this example, the GFS file system residing on block device /dev/gfsvg/gfslv is repaired. All
queries to repair are automatically answered with yes. Because this example uses the -v (verbose)
option, the sample output is extensive and repetitive lines have been elided.
Journals cleared.
Starting pass1
Checking metadata in Resource Group 0
Checking metadata in Resource Group 1
...
Checking metadata in Resource Group 91
Pass1 complete
38
Context-Dependent Path Names
Starting pass1b
Looking for duplicate blocks...
No duplicate blocks found
Pass1b complete
Starting pass1c
Looking for inodes containing ea blocks...
Pass1c complete
Starting pass2
Checking directory inodes.
Pass2 complete
Starting pass3
Marking root inode connected
Checking directory linkage.
Pass3 complete
Starting pass4
Checking inode reference counts.
Pass4 complete
Starting pass5
...
Updating Resource Group 92
Pass5 complete
Writing changes to disk
Syncing the device.
Freeing buffers.
CDPN variables can be used in any path name, not just with symbolic links. However, the CDPN
variable name cannot be combined with other characters to form an actual directory or file name. The
CDPN variable must be used alone as one segment of a complete path.
Usage
For a Normal Symbolic Link
ln -s Target LinkName
Target
Specifies an existing file or directory on a file system.
LinkName
Specifies a name to represent the real file or directory on the other end of the link.
ln -s Variable LinkName
Variable
Specifies a special reserved name from a list of values (refer to Table 3.5, “CDPN Variable
Values”) to represent one of multiple existing files or directories. This string is not the name of an
39
Chapter 3. Managing GFS
actual file or directory itself. (The real files or directories must be created in a separate step using
names that correlate with the type of variable used.)
LinkName
Specifies a name that will be seen and used by applications and will be followed to get to one of
the multiple real files or directories. When LinkName is followed, the destination depends on the
type of variable and the node or user doing the following.
Variable Description
@hostname This variable resolves to a real file or directory named with the
hostname string produced by the output of the following command:
echo `uname -n`
@mach This variable resolves to a real file or directory name with the machine-
type string produced by the output of the following command: echo
`uname -m`
@os This variable resolves to a real file or directory named with the
operating-system name string produced by the output of the following
command: echo `uname -s`
@sys This variable resolves to a real file or directory named with the
combined machine type and OS release strings produced by the
output of the following command: echo `uname -m`_`uname -s`
@uid This variable resolves to a real file or directory named with the user ID
string produced by the output of the following command: echo `id -
u`
@gid This variable resolves to a real file or directory named with the group
ID string produced by the output of the following command: echo `id
-g`
Table 3.5. CDPN Variable Values
Example
In this example, there are three nodes with hostnames n01, n02 and n03. Applications on each node
uses directory /gfs/log/, but the administrator wants these directories to be separate for each
node. To do this, no actual log directory is created; instead, an @hostname CDPN link is created with
the name log. Individual directories /gfs/n01/, /gfs/n02/, and /gfs/n03/ are created that will
be the actual directories used when each node references /gfs/log/.
n01# cd /gfs
n01# mkdir n01 n02 n03
n01# ln -s @hostname log
n01# ls -l /gfs
lrwxrwxrwx 1 root root 9 Apr 25 14:04 log -> @hostname/
drwxr-xr-x 2 root root 3864 Apr 25 14:05 n01/
drwxr-xr-x 2 root root 3864 Apr 25 14:06 n02/
drwxr-xr-x 2 root root 3864 Apr 25 14:06 n03/
40
The GFS Withdraw Function
n01# ls /gfs/log/
fileA
n02# ls /gfs/log/
fileB
n03# ls /gfs/log/
fileC
An example of an inconsistency that would yield a GFS withdraw is an incorrect block count. When
the GFS kernel deletes a file from a file system, it systematically removes all the data and metadata
blocks associated with that file. When it is done, it checks the block count. If the block count is not
one (meaning all that is left is the disk inode itself), that indicates a file system inconsistency since the
block count did not match the list of blocks found.
41
42
Appendix A. Revision History
Revision 5.4-2 Fri Feb 05 2010 Steven Levine [email protected]
Resolves: #562199
Adds note indicating that GFS is not supported in clusters greater than 16 nodes.
Revision 5.4-1 Tue Aug 18 2009 Steven Levine [email protected]
Resolves: #515807
Adds note clarifying that you cannot reduce the size of an existing file system.
Resolves: #480002
Adds caveat about unmounting a file system manually if you mounted it manually.
Resolves: #458604
Adds section on GFS withdraw function.
Revision 1.0 Thu Jan 29 2009
43
44
Index
displaying quota limits, 18
setting quotas, 17
synchronizing quotas, 20
repairing, 37
A suspending activity, 32
adding journals to a file system, 24 unmounting, 14, 15
atime, configuring updates, 30
mounting with noatime, 30
G
tuning atime quantum, 31
GFS
audience, v
atime, configuring updates, 30
mounting with noatime, 30
C tuning atime quantum, 31
CDPN variable values table, 40 direct I/O, 27
configuration, before, 5 directory attribute, 28
configuration, initial, 7 file attribute, 27
prerequisite tasks, 7 O_DIRECT, 27
creating a file system, 9 displaying counters, 33
displaying extended information and statistics,
D 32
data journaling, 29 displaying extended status, 36
direct I/O, 27 displaying space usage, 32
directory attribute, 28 managing, 9
file attribute, 27 quota management, 17
O_DIRECT, 27 disabling/enabling quota accounting, 21
displaying extended GFS information and disabling/enabling quota enforcement, 21
statistics, 32 displaying quota limits, 18
displaying GFS counters, 33 setting quotas, 17
displaying GFS extended status, 36 synchronizing quotas, 20
displaying GFS space usage, 32 withdraw function, 41
DLM (Distributed Lock Manager), 2 GFS file system maximum size, 1, 5
GFS software components, 4
F GFS software components table, 5
features, new and changed, 2 GFS-specific options for adding journals table, 26
feedback, viii, viii GFS-specific options for expanding file systems
file system table, 24
adding journals, 24 gfs_mkfs command options table, 11
atime, configuring updates, 30 growing a file system, 22
mounting with noatime, 30 GULM (Grand Unified Lock Manager), 2
tuning atime quantum, 31
context-dependent path names (CDPNs), 39 I
creating, 9 initial tasks
data journaling, 29 setup, initial, 7
direct I/O, 27 introduction, v
directory attribute, 28 audience, v
file attribute, 27
O_DIRECT, 27 M
growing, 22
managing GFS, 9
mounting, 12, 15
maximum size, GFS file system, 1, 5
quota management, 17
mount table, 14
disabling/enabling quota accounting, 21
mounting a file system, 12, 15
disabling/enabling quota enforcement, 21
45
Index
O
overview, 1
configuration, before, 5
economy, 2
features, new and changed, 2
GFS software components, 4
performance, 2
scalability, 2
P
parameters, GFS tunable, 15
path names, context-dependent (CDPNs), 39
preface (see introduction)
prerequisite tasks
configuration, initial, 7
Q
quota management, 17
disabling/enabling quota accounting, 21
disabling/enabling quota enforcement, 21
displaying quota limits, 18
setting quotas, 17
synchronizing quotas, 20
R
repairing a file system, 37
S
setup, initial
initial tasks, 7
suspending activity on a file system, 32
system hang at unmount, 15
T
tables
CDPN variable values, 40
GFS software components, 5
GFS-specific options for adding journals, 26
GFS-specific options for expanding file
systems, 24
gfs_mkfs command options, 11
mount options, 14
tunable parameters, GFS, 15
U
unmount, system hang, 15
unmounting a file system, 14, 15
W
withdraw function, GFS, 41
46