Understanding What Is Global File System Under LINUX
Understanding What Is Global File System Under LINUX
1801 Varsity Drive Raleigh, NC 27606-2072 USA Phone: +1 919 754 3700 Phone: 888 733 4281 Fax: +1 919 754 3701 PO Box 13588 Research Triangle Park, NC 27709 USA Documentation-Deployment Copyright 2007 by Red Hat, Inc. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, V1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. Distribution of the work or derivative of the work in any standard (paper) book form for commercial purposes is prohibited unless prior permission is obtained from the copyright holder. Red Hat and the Red Hat "Shadow Man" logo are registered trademarks of Red Hat, Inc. in the United States and other countries. All other trademarks referenced herein are the property of their respective owners. The GPG fingerprint of the [email protected] key is: CA 20 86 86 2B D6 9D FC 65 F6 EC C4 21 91 80 CD DB 42 A6 0E
Table of Contents
Introduction ............................................................................................................... vi 1. Audience ....................................................................................................... vi 2. Related Documentation .................................................................................. vi 3. Document Conventions ................................................................................. vii 4. Send in Your Feedback ................................................................................ viii 5. Recommended References .......................................................................... viii 1. GFS Overview ....................................................................................................... 1 1. New and Changed Features ........................................................................... 1 2. Performance, Scalability, and Economy ........................................................... 2 2.1. Superior Performance and Scalability ................................................... 2 2.2. Performance, Scalability, Moderate Price .............................................. 3 2.3. Economy and Performance .................................................................. 3 3. GFS Functions ............................................................................................... 4 4. GFS Software Subsystems ............................................................................. 5 5. Before Setting Up GFS ................................................................................... 6 2. System Requirements ............................................................................................ 8 1. Platform Requirements ................................................................................... 8 2. Red Hat Cluster Suite ..................................................................................... 8 3. Fencing ......................................................................................................... 8 4. Fibre Channel Storage Network ...................................................................... 9 5. Fibre Channel Storage Devices ....................................................................... 9 6. Network Power Switches ................................................................................ 9 7. Console Access ............................................................................................10 8. Installing GFS ...............................................................................................10 3. Getting Started .....................................................................................................11 1. Prerequisite Tasks ........................................................................................11 2. Initial Setup Tasks .........................................................................................11 4. Managing GFS .....................................................................................................13 1. Making a File System ....................................................................................13 2. Mounting a File System .................................................................................16 3. Unmounting a File System .............................................................................18 4. GFS Quota Management ...............................................................................18 4.1. Setting Quotas ...................................................................................19 4.2. Displaying Quota Limits and Usage .....................................................20 4.3. Synchronizing Quotas ........................................................................21 4.4. Disabling/Enabling Quota Enforcement ................................................22 4.5. Disabling/Enabling Quota Accounting ..................................................23 5. Growing a File System ..................................................................................24 6. Adding Journals to a File System ...................................................................26 7. Direct I/O ......................................................................................................28 7.1. O_DIRECT ........................................................................................28 7.2. GFS File Attribute ...............................................................................28 7.3. GFS Directory Attribute .......................................................................29 8. Data Journaling .............................................................................................29 9. Configuring atime Updates ............................................................................30 iv
Global File System 9.1. Mount with noatime ............................................................................31 9.2. Tune GFS atime Quantum ..................................................................31 10. Suspending Activity on a File System ...........................................................32 11. Displaying Extended GFS Information and Statistics ......................................33 12. Repairing a File System ...............................................................................34 13. Context-Dependent Path Names ..................................................................35 Index .......................................................................................................................38
Introduction
Welcome to the Global File System Configuration and Administration document. This book provides information about installing, configuring, and maintaining Red Hat GFS (Red Hat Global File System). Red Hat GFS depends on the cluster infrastructure of Red Hat Cluster Suite. 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: Linux system administration procedures, including kernel configuration 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. LVM Administrator's Guide: Configuration and Administration Provides a description of the Logical Volume Manager (LVM), including information on running LVM in a clustered environment. Using GNBD with Global File System Provides an overview on using Global Network Block Device (GNBD) with Red Hat GFS. Linux Virtual Server Administration Provides information on configuring high-performance systems and services with the Linux Virtual Server (LVS). Red Hat Cluster Suite Release Notes Provides information about the current release of
vi
3. Document Conventions
3. Document Conventions
Certain words in this manual are represented in different fonts, styles, and weights. This highlighting indicates that the word is part of a specific category. The categories include the following:
Courier font
and prompts .
Bold Courier font represents text that you are to type, such as: service
jonas start
If you have to run a command as root, the root prompt (#) precedes the command:
# gconftool-2
Italic Courier font represents a variable, such as an installation directory: install_dir/bin/ bold font Bold font represents application programs and text found on a graphical interface. When shown like this: OK , it indicates a button on a graphical application interface. Additionally, the manual uses different strategies to draw your attention to pieces of information. In order of how critical the information is to you, these items are marked as follows:
Note
A note is typically information that you need to understand the behavior of the system.
Tip
A tip is typically an alternative way of performing a task.
vii
Important
Important information is necessary, but possibly unexpected, such as a configuration change that will not persist after a reboot.
Caution
A caution indicates an act that would violate your support agreement, such as recompiling the kernel.
Warning
A warning indicates potential data loss, as may happen when tuning hardware for maximum performance.
If you mention this manual's identifier, we will 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.
5. Recommended References
For additional references about related topics, refer to the following table: Topic Shared Data Clustering and File Systems Reference Shared Data Clusters by Dilip M. Ranade. Wiley, 2002. Comment Provides detailed technical information on cluster file system and cluster volumemanager design.
viii
5. Recommended References
Reference
Comment
Designing Storage Area Net- Provides a concise summary works: A Practical Reference of Fibre Channel and IP SAN for Implementing Fibre Chan- Technology. nel and IP SANs, Second Edition by Tom Clark. AddisonWesley, 2003. Building SANs with Brocade Fabric Switches by C. Beauchamp, J. Judd, and B. Keo. Syngress, 2001. Best practices for building Fibre Channel SANs based on the Brocade family of switches, including core-edge topology for large SAN fabrics. Provides a comprehensive overview reference on storage networking technologies.
Building Storage Networks, Second Edition by Marc Farley. Osborne/McGraw-Hill, 2001. Applications and High Availability Blueprints for High Availability: Designing Resilient Distributed Systems by E. Marcus and H. Stern. Wiley, 2000.
ix
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.
Note
The deployment examples in this chapter reflect basic configurations; your needs might require a combination of configurations shown in the examples.
Note
Clients implementing ext2 and ext3 file systems can be configured to access their own dedicated slice of SAN storage.
3. GFS Functions
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.
3. GFS Functions
GFS is a native file system that interfaces directly with the VFS layer of the Linux kernel filesystem interface. GFS is a cluster file system that employs distributed metadata and multiple journals for optimal operation in a cluster. Cluster management of GFS nodes is managed through Red Hat Cluster Suite. Volume management is managed through CLVM (Cluster Logical Volume Manager). For information about Red Hat Cluster Suite refer to Configuring and Managing a Red Hat Cluster. For information about using CLVM, refer to LVM Administrator's Guide.
Note
CLVM 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.
GFS provides the following main functions: Making a File System Mounting a File System Unmounting a File System GFS Quota Management Growing a File System Adding Journals to a File System Direct I/O Data Journaling Configuring atime Updates Suspending Activity on a File System Displaying Extended GFS Information and Statistics Repairing a File System Context-Dependent Path Names (CDPN)
Description Kernel module that implements the GFS file system and is loaded on GFS cluster nodes. Command that repairs an unmounted GFS file system. Command that grows a mounted GFS file system. Command that adds journals to a mounted GFS file system. Command that creates a GFS file system on a storage device. Command that manages quotas on a mounted GFS file system. Command that configures or tunes a GFS 5
gfs_fsck
gfs_grow
gfs_jadd
gfs_mkfs
gfs_quota
gfs_tool
Software Subsystem
Components
Description file system. This command can also gather a variety of information about the file system.
lock_harness.ko
Implements a pluggable lock module interface for GFS that allows for a variety of locking mechanisms to be used (for example, the DLM lock module, lock_dlm.ko). A lock module that implements DLM locking for GFS. It plugs into the lock harness, lock_harness.ko and communicates with the DLM lock manager in Red Hat Cluster Suite. A lock module for use when GFS is used as a local file system only. It plugs into the lock harness, lock_harness.ko and provides local locking.
lock_dlm.ko
lock_nolock.ko
5. Before Setting Up GFS hostname and IP address of each GNBD server node for setting up GNBD clients later. For information on using GNBD with GFS, see the Using GNBD with Global File System document. Storage devices and partitions Determine the storage devices and partitions to be used for creating logical volumes (via CLVM) in the file systems.
1. Platform Requirements
Table 2.1, Platform Requirements shows the platform requirements for GFS. Operating System Red Hat Enterprise Linux AS, ES, or WS, Version 4 or later Hardware Architecture ia64, x86-64, x86 SMP supported RAM 256 MB, minimum
Note
Red Hat Cluster Suite 4.0 and later provides the infrastructure for application failover in the cluster and network communication among GFS nodes (and other Red Hat Cluster Suite nodes).
3. Fencing
You must configure each GFS node in your Red Hat cluster for at least one form of fencing. 8
Fencing is configured and managed in Red Hat Cluster Suite. For more information about fencing options, refer to Configuring and Managing a Red Hat Cluster.
7. Console Access
You can fence GFS nodes with power switches and fencing agents available with Red Hat Cluster Suite. For more information about fencing with network power switches, refer to Configuring and Managing a Red Hat Cluster.
7. Console Access
Make sure that you have console access to each GFS node. Console access to each node ensures that you can monitor nodes and troubleshoot problems.
8. Installing GFS
Installing GFS consists of installing Red Hat GFS RPMs on nodes in a Red Hat cluster. Before installing the RPMs, make sure of the following: The cluster nodes meet the system requirements described in this chapter. You have noted the key characteristics of your GFS configuration (refer to Section 5, Before Setting Up GFS). The correct Red Hat Cluster Suite software is installed in the cluster.
For information on insalling RPMS for Red Hat Cluster Suite and Red Hat GFS, see Configuring and Managing a Red Hat Cluster. If you have already installed the appropriate Red Hat Cluster Suite RPMs, follow the procedures that pertain to installing the Red Hat GFS RPMs.
10
1. Prerequisite Tasks
Before setting up Red Hat GFS, make sure that you have noted the key characteristics of the GFS nodes (refer to Section 5, Before Setting Up GFS) and have loaded the GFS modules into each GFS node.Also, make sure that the clocks on the GFS nodes are synchronized. It is recommended that you use the Network Time Protocol (NTP) software provided with your Red Hat Enterprise Linux distribution. In addition, if you are using GNBD multipath, make sure that you understand GNBD multipath considerations. For information on GNBD multipath, see the document Using GNBD with Global Filesystem.
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.
Follow these steps to set up GFS initially. 1. Using CLVM (Cluster Logical Volume Manager), 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
11
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 1, Making a File System. Command usage:
gfs_mkfs -p lock_dlm -t ClusterName:FSName -j NumberJournals BlockDevice
3.
At each node, mount the GFS file systems. For more information about mounting a GFS file system, refer to Section 2, Mounting a File System. Command usage:
mount -t gfs BlockDevice MountPoint mount -t gfs -o acl BlockDevice MountPoint
The -o aclmount 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.
12
Usage
gfs_mkfs -p LockProtoName -t LockTableName -j Number BlockDevice
13
Examples
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 (for example, lock_dlm) to use.
LockTableName
This parameter 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 cre-
ated.
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.
Number
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.
Examples
In this example, lock_dlm is the locking protocol that the file system uses. The cluster name is alpha, and the file-system name is gfs1. The file system contains eight journals and is created on /dev/vg01/lvol0.
gfs_mkfs -p lock_dlm -t alpha:gfs1 -j 8 /dev/vg01/lvol0
In this example, a second lock_dlm file system is made, which can be used in cluster alpha. The file-system name is gfs2. The file system contains eight journals and is created on / dev/vg01/lvol1.
gfs_mkfs -p lock_dlm -t alpha:gfs2 -j 8 /dev/vg01/lvol1
Complete Options
Table 4.1, Command Options: gfs_mkfs describes the gfs_mkfs command options (flags and parameters).
14
Complete Options
Flag
-b
Parameter
BlockSize
Description Sets the file-system block size to BlockSize. Default block size is 4096 bytes. Enables debugging output. Help. Displays available options.
-D -h -J MegaBytes
Specifies the size of the journal in megabytes. Default journal size is 128 megabytes. The minimum size is 32 megabytes. 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. Note: More journals than are needed can be specified at creation time to allow for future expansion.
-j
Number
-p
LockProtoName
Specifies the name of the locking protocol to use. Recognized cluster-locking protocols include: lock_dlm The standard locking module. lock_nolock May be used when GFS is acting as a local file system (one node only).
-O
Prevents the gfs_mkfs command from asking for confirmation before writing the file system. Quiet. Do not display anything.
MegaBytes
-q -r
Specifies the size of the resource groups in megabytes. Default resource group size is 256 megabytes. Specifies the journal-segment size in file-system blocks. This parameter has two parts separated by a colon (no spaces) as follows: ClusterName:FSName. ClusterName is the name of the Red Hat cluster for which the GFS file system is being created. The cluster name is set in the / etc/cluster/cluster.conf file via the Cluster Configuration Tool and displayed at the Cluster Status Tool in the Red Hat Cluster Suite cluster management GUI. FSName, the file-system name, can be 1 to 16 characters in length, and the name must be unique among all file systems in the cluster.
-s
Blocks
-t
LockTableName
-V
15
Usage
Mounting Without ACL Manipulation
mount -t gfs BlockDevice MountPoint
-o acl
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 /gfs1 directory.
mount -t gfs /dev/vg01/lvol0 /gfs1
Complete Usage
mount -t gfs BlockDevice MountPoint -o option
The -o option argument consists of GFS-specific options (refer to Table 4.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. 16
Complete Usage
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.
Table 4.2, GFS-Specific Mount Options describes the available GFS-specific -o that can be passed to GFS at mount time. Option
acl
option
values
Description 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).
Forces GFS to treat the file system as a multihost file system. By default, using lock_nolock automatCaution: This option should not be used ically turns on the localcaching and localflocks when GFS file systems are shared. flags.
ignore_local_fs
Tells GFS that it is running as a local file system. GFS can then turn on selected optimization capabCaution: This option should not be used ilities that are not available when running in cluster when GFS file systems are shared. mode. The localcaching flag is automatically turned on by lock_nolock.
localcaching
Tells GFS to let the VFS (virtual file system) layer do all flock and fcntl. The localflocks flag is autoCaution: This option should not be used matically turned on by lock_nolock. when GFS file systems are shared.
localflocks 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. Allows the user to specify which locking table to use with the file system. 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 de17
locktable=LockTableName
oopses_ok
Option
Description tailed troubleshooting information. Use this option with care. Note: This option is turned on automatically if lock_nolock locking is specified; however, you can override it by using the ignore_local_fs option.
upgrade
Upgrade the on-disk format of the file system so that it can be used by newer versions of GFS.
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.
18
Usage
Setting Quotas, Hard Limit
gfs_quota limit -u User -l Size -f MountPoint
User
A user ID to limit or warn. It can be either a user name from the password file or the UID number.
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
Examples
This example sets the hard limit for user Bert to 1024 megabytes (1 gigabyte) on file system /
19
This example sets the warn limit for group ID 21 to 50 kilobytes on file system /gfs.
gfs_quota warn -g 21 -l 50 -k -f /gfs
Usage
Displaying Quota Limits for a User
gfs_quota get -u User -f MountPoint
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.
MountPoint
Command Output
GFS quota information from the gfs_quota command is displayed as follows:
user User: limit:LimitSize warn:WarnSize value:Value group Group: limit:LimitSize warn:WarnSize value:Value
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-
20
User
The hard limit set for the user or group. This value is zero if no limit has been set.
Value
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.
gfs_quota list -f /gfs
This example displays quota information in sectors for group users on file system /gfs.
gfs_quota get -g users -f /gfs -s
21
Usage
Synchronizing Quota Information
gfs_quota sync -f MountPoint
MountPoint
Specifies the GFS file system to which the actions apply. Tuning the Time Between Synchronizations
gfs_tool settune MountPoint quota_quantum Seconds
MountPoint
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.
gfs_quota sync -f /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.
gfs_tool settune /gfs quota_quantum 3600
Usage
gfs_tool settune MountPoint quota_enforce {0|1}
MountPoint
22
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 quotausage information does not require rebuilding after re-enabling quotas.
Examples
This example disables quota enforcement on file system /gfs.
gfs_tool settune /gfs quota_enforce 0
Usage
fs_tool settune MountPoint quota_account {0|1}
MountPoint
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.
23
Note
Initializing the quota file requires scanning the entire file system and may take a long time.
Examples
This example disables quota accounting on file system /gfs on a single node.
gfs_tool settune /gfs quota_account 0
This example enables quota accounting on file system /gfs on a single node and initializes the quota file.
# gfs_tool settune /gfs quota_account 1 # gfs_quota init -f /gfs
Usage
gfs_grow MountPoint
MountPoint
Comments
Before running the gfs_grow command:
24
Examples
Back up important data on the file system. Display the volume that is used by the file system to be expanded by running a gfs_tool MountPoint command. Expand the underlying cluster volume with LVM. For information on administering LVM volumes, see the LVM Administrator's Guide
df
After running the gfs_grow command, run a df command to check that the new space is now available in the file system.
Examples
In this example, the file system on the /gfs1 directory is expanded.
gfs_grow /gfs1
Complete Usage
gfs_grow [Options] {MountPoint | Device} [MountPoint | Device]
MountPoint
Specifies the device node of the file system. Table 4.3, GFS-specific Options Available While Expanding A File System describes the GFSspecific options that can be used while expanding a GFS file system. Option
-h -q -T
Description Help. Displays a short usage message. Quiet. Turns down the verbosity level. Test. Do all calculations, but do not write any data to the disk and do not expand the file system. Displays command version information. Turns up the verbosity of messages.
-V -v
25
Usage
Usage
gfs_jadd -j Number MountPoint
Number
Comments
Before running the gfs_jadd command: Back up important data on the file system. Run a gfs_tool 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
After running the gfs_jadd command, run a gfs_jadd command with the -T and -v flags enabled 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 on the /gfs1 directory.
gfs_jadd -j1 /gfs1
In this example, two journals are added to the file system on the /gfs1 directory.
gfs_jadd -j2 /gfs1
26
Complete Usage
In this example, the current state of the file system on the /gfs1 directory is checked for the new journals.
gfs_jadd -Tv /gfs1
Complete Usage
gfs_jadd [Options] {MountPoint | Device} [MountPoint | Device]
MountPoint
Specifies the device node of the file system. Table 4.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. Flag
-h -J MegaBytes
Parameter
Description Help. Displays short usage message. 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 gfs_jadd command must be run for each size journal. The size specified is rounded down so that it is a multiple of the journalsegment size that was specified when the file system was created. Specifies the number of new journals to be added by the gfs_jadd command. The default value is 1. Test. Do all calculations, but do not write any data to the disk and do not add journals to the file system. Enabling this flag helps discover what the gfs_jadd command would have done if it were run without this flag. Using the -v flag with the -T flag turns up the verbosity level to display more information. Quiet. Turns down the verbosity level. Displays command version information. Turns up the verbosity of messages.
-j
Number
-T
-q -V -v
27
7.1. O_DIRECT
7. Direct I/O
Direct I/O is a feature of the file system whereby file reads and writes go directly from the applications to the storage device, bypassing the operating system read and write caches. Direct I/O is used only by applications (such as databases) that manage their own caches. 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
7.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.
Usage
Setting the directio Flag
gfs_tool setflag directio File
File
Example
28
In this example, the command sets the directio flag on the file named datafile in directory / gfs1.
gfs_tool setflag directio /gfs1/datafile
Usage
Setting the inherit_directio flag
gfs_tool setflag inherit_directio Directory
Directory
Example
In this example, the command sets the inherit_directio flag on the directory named / gfs1/data/.
gfs_tool setflag inherit_directio /gfs1/data/
8. Data Journaling
Ordinarily, GFS writes only metadata to its journal. File contents are subsequently written to disk by the kernel's periodic sync that flushes file-system buffers. An 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. 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
29
Usage 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
gfs_tool setflag inherit_jdata Directory gfs_tool clearflag inherit_jdata Directory
Directory
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.
gfs_tool setflag inherit_jdata /gfs1/data/
This example shows setting the jdata flag on a file. The file must be zero size. Any data written to the file will be journaled.
gfs_tool setflag jdata /gfs1/datafile
9. Configuring
atime
Updates
Each file inode and directory inode has three time stamps associated with it: The last time the inode status was changed The last time the file (or directory) data was modified 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
30
9.1. Mount with noatime 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. Two methods of reducing the effects of atime updating are available: Mount with noatime Tune GFS atime quantum
Usage
mount -t gfs BlockDevice MountPoint -o noatime
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 /gfs1 with atime updates turned off.
mount -t gfs /dev/vg01/lvol0 /gfs1 -o noatime
31
10. Suspending Activity on a File System be set on each node and each time the file system is mounted. (The setting is not persistent across unmounts.)
Usage
Displaying Tunable Parameters
gfs_tool gettune MountPoint
MountPoint
Specifies the directory where the GFS file system is mounted. Changing the atime_quantum Parameter Value
gfs_tool settune MountPoint atime_quantum Seconds
MountPoint
Examples
In this example, all GFS tunable parameters for the file system on the mount point /gfs1 are displayed.
gfs_tool gettune /gfs1
In this example, the atime update period is set to once a day (86,400 seconds) for the GFS file system on mount point /gfs1.
gfs_tool settune /gfs1 atime_quantum 86400
Usage
Start Suspension
gfs_tool freeze MountPoint
End Suspension
32
Examples
MountPoint
Examples
This example suspends writes to file system /gfs.
gfs_tool freeze /gfs
Usage
Displaying Statistics
gfs_tool counters MountPoint
The counters flag displays statistics about a file system. If -c is used, the gfs_tool command continues to run, displaying statistics once per second. Displaying Space Usage
gfs_tool df MountPoint
The df flag displays a space-usage summary of a given file system. The information is more detailed than a standard df. Displaying Extended Status
gfs_tool stat File
MountPoint
33
Examples
File
Specifies the file from which to get information. 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.
Examples
This example reports extended file system usage about file system /gfs.
gfs_tool df /gfs
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. 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.
34
Example
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/vg01/lvol0 is repaired. All queries to repair are automatically answered with yes.
gfs_fsck -y /dev/vg01/lvol0
Usage
For a Normal Symbolic Link
ln -s TargetLinkName
Target
Specifies a name to represent the real file or directory on the other end of the link. For a Variable Symbolic Link
ln -s VariableLinkName
Variable
Specifies a special reserved name from a list of values (refer to Table 4.5, CDPN Variable
35
Example Values) to represent one of multiple existing files or directories. This string is not the name of an 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
@hostname
Description 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` 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` 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` 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`
@os
@sys
@uid
@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`
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 lrwxrwxrwx drwxr-xr-x drwxr-xr-x /gfs 1 root root 9 Apr 25 14:04 log -> @hostname/ 2 root root 3864 Apr 25 14:05 n01/ 2 root root 3864 Apr 25 14:06 n02/
36
Example
drwxr-xr-x 2 root root 3864 Apr 25 14:06 n03/ n01# touch /gfs/log/fileA n02# touch /gfs/log/fileB n03# touch /gfs/log/fileC n01# ls /gfs/log/ fileA n02# ls /gfs/log/ fileB n03# ls /gfs/log/ fileC
37
Index
A
adding journals to a file system, 26 atime, configuring updates, 30 mounting with noatime, 31 tuning atime quantum, 31 audience, vi
C
CDPN variable values table, 36 configuration, before, 6 configuration, initial, 11 prerequisite tasks, 11 console access system requirements, 10
direct I/O, 28 directory attribute, 29 file attribute, 28 O_DIRECT, 28 growing, 24 making, 13 mounting, 16 quota management, 18 disabling/enabling quota accounting, 23 disabling/enabling quota enforcement, 22 displaying quota limits, 20 setting quotas, 19 synchronizing quotas, 21 repairing, 34 suspending activity, 32 unmounting, 18
G
GFS atime, configuring updates, 30 mounting with noatime, 31 tuning atime quantum, 31 direct I/O, 28 directory attribute, 29 file attribute, 28 O_DIRECT, 28 displaying extended information and statistics, 33 managing, 13 quota management, 18 disabling/enabling quota accounting, 23 disabling/enabling quota enforcement, 22 displaying quota limits, 20 setting quotas, 19 synchronizing quotas, 21 GFS functions, 4 GFS software subsystem components table, 5 GFS software subsystems, 5 GFS-specific options for adding journals table, 27 GFS-specific options for expanding file systems table, 25 gfs_mkfs command options table, 14 growing a file system, 24 GULM (Grand Unified Lock Manager), 1
D
data journaling, 29 direct I/O, 28 directory attribute, 29 file attribute, 28 O_DIRECT, 28 displaying extended GFS information and statistics, 33 DLM (Distributed Lock Manager), 1
F
features, new and changed, 1 feedback, viii fencing system requirements, 8 fibre channel network requirements table, 9 fibre channel storage device requirements table, 9 fibre channel storage devices system requirements, 9 fibre channel storage network system requirements, 9 file system adding journals, 26 atime, configuring updates, 30 mounting with noatime, 31 tuning atime quantum, 31 context-dependent path names (CDPNs), 35 data journaling, 29 38
S
setup, initial initial tasks, 11 suspending activity on a file system, 32 system requirements, 8 console access, 10 fencing, 8 fibre channel storage devices, 9 fibre channel storage network, 9 network power switches, 9 platform, 8 Red Hat Cluster Suite, 8
M
making a file system, 13 managing GFS, 13 mount table, 17 mounting a file system, 16
N
network power switches system requirements, 9
T
tables CDPN variable values, 36 fibre channel network requirements, 9 fibre channel storage device requirements, 9 GFS software subsystem components, 5 GFS-specific options for adding journals, 27 GFS-specific options for expanding file systems, 25 gfs_mkfs command options, 14 mount options, 17 platform requirements, 8 recommended references, viii
O
overview, 1 configuration, before, 6 economy, 2 features, new and changed, 1 GFS functions, 4 GFS software subsystems, 5 performance, 2 scalability, 2
P
path names, context-dependent (CDPNs), 35 platform system requirements, 8 platform requirements table, 8 preface (see introduction) prerequisite tasks configuration, initial, 11
U
unmounting a file system, 18
Q
quota management, 18 disabling/enabling quota accounting, 23 disabling/enabling quota enforcement, 22 displaying quota limits, 20 setting quotas, 19 synchronizing quotas, 21
R
recommended references table, viii Red Hat Cluster Suite system requirements, 8 references, recommended, viii repairing a file system, 34 39