Este conteúdo não está disponível no idioma selecionado.
Global File System 2
Red Hat Enterprise Linux 5
Red Hat Global File System 2
Edition 7
Abstract
This book provides information about configuring and maintaining Red Hat GFS2 (Red Hat Global File System 2) for Red Hat Enterprise Linux 5.
Chapter 1. Introduction Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
This book provides information about configuring and maintaining Red Hat GFS2 (Red Hat Global File System 2). Red Hat GFS2 can be run in Red Hat Enterprise Linux 5.3 and later. For the Red Hat Enterprise Linux 5.5 release and later, Red Hat does not support the use of GFS2 as a single-node file system. For information about Red Hat Cluster Suite see 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 https://access.redhat.com/site/documentation/en-US/.
1.1. Audience Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
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
1.2. Related Documentation Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
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.
- 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, 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: Configuration and Administration — Provides information about installing, configuring, and maintaining Red Hat GFS (Red Hat Global File System).
- Using Device-Mapper Multipath — Provides information about using the Device-Mapper Multipath feature of Red Hat Enterprise Linux.
- 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 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 https://access.redhat.com/site/documentation/en-US/.
Chapter 2. GFS2 Overview Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
The Red Hat GFS2 file system is a native file system that interfaces directly with the Linux kernel file system interface (VFS layer). When implemented as a cluster file system, GFS2 employs distributed metadata and multiple journals. Red Hat supports the use of GFS2 file systems only as implemented in Red Hat Cluster Suite.
Note
Although a GFS2 file system can be implemented in a standalone system or as part of a cluster configuration, for the Red Hat Enterprise Linux 5.5 release and later Red Hat does not support the use of GFS2 as a single-node file system. Red Hat does support a number of high-performance single node file systems which are optimized for single node and thus have generally lower overhead than a cluster file system. Red Hat recommends using these file systems in preference to GFS2 in cases where only a single node needs to mount the file system.
Red Hat will continue to support single-node GFS2 file systems for existing customers.
Note
Red Hat does not support using GFS2 for cluster file system deployments greater than 16 nodes.
GFS2 is based on a 64-bit architecture, which can theoretically accommodate an 8 EB file system. However, the current supported maximum size of a GFS2 file system for 64-bit hardware is 100 TB. The current supported maximum size of a GFS2 file system for 32-bit hardware for Red Hat Enterprise Linux Release 5.3 and later is 16 TB. If your system requires larger GFS2 file systems, contact your Red Hat service representative.
When determining the size of your file system, you should consider your recovery needs. Running the
fsck.gfs2 command on a very large file system can take a long time and consume a large amount of memory. Additionally, in the event of a disk or disk-subsytem failure, recovery time is limited by the speed of your backup media. For information on the amount of memory the fsck.gfs2 command requires, see Section 4.11, “Repairing a File System”.
When configured in a Red Hat Cluster Suite, Red Hat GFS2 nodes can be configured and managed with Red Hat Cluster Suite configuration and management tools. Red Hat GFS2 then provides data sharing among GFS2 nodes in a Red Hat cluster, with a single, consistent view of the file system name space across the GFS2 nodes. This allows processes on different nodes to share GFS2 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.
While a GFS2 file system may be used outside of LVM, Red Hats supports only GFS2 file systems that are created on a CLVM logical volume. CLVM is a cluster-wide implementation of LVM, enabled by the CLVM daemon
clvmd, which manages LVM logical volumes 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
The
gfs2.ko kernel module implements the GFS2 file system and is loaded on GFS2 cluster nodes.
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 shared storage. Asymmetric cluster configurations in which some nodes have access to the shared storage and others do not are not supported. This does not require that all nodes actually mount the GFS2 file system itself.
This chapter provides some basic, abbreviated information as background to help you understand GFS2. It contains the following sections:
2.1. Before Setting Up GFS2 Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Before you install and set up GFS2, note the following key characteristics of your GFS2 file systems:
- GFS2 nodes
- Determine which nodes in the Red Hat Cluster Suite will mount the GFS2 file systems.
- Number of file systems
- Determine how many GFS2 file systems to create initially. (More file systems can be added later.)
- File system name
- Determine a unique name for each file system. The name must be unique for all
lock_dlmfile systems over the cluster, and for all file systems (lock_dlmandlock_nolock) on each local node. Each file system name is required in the form of a parameter variable. For example, this book uses file system namesmydata1andmydata2in some example procedures. - Journals
- Determine the number of journals for your GFS2 file systems. One journal is required for each node that mounts a GFS2 file system. GFS2 allows you to add journals dynamically at a later point as additional servers mount a file system. For information on adding journals to a GFS2 file system, see Section 4.7, “Adding Journals to a File System”.
- GNBD server nodes
- If you are using GNBD, determine how many GNBD server nodes are needed. Note the hostname and IP address of each GNBD server node for setting up GNBD clients later. For information on using GNBD with GFS2, 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.
Note
You may see performance problems with GFS2 when many create and delete operations are issued from more than one node in the same directory at the same time. If this causes performance problems in your system, you should localize file creation and deletions by a node to directories specific to that node as much as possible.
2.2. Differences between GFS and GFS2 Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
This section lists the improvements and changes that GFS2 offers over GFS.
Migrating from GFS to GFS2 requires that you convert your GFS file systems to GFS2 with the
gfs2_convert utility. For information on the gfs2_convert utility, see Appendix A, Converting a File System from GFS to GFS2.
2.2.1. GFS2 Command Names Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
In general, the functionality of GFS2 is identical to GFS. The names of the file system commands, however, specify GFS2 instead of GFS. Table 2.1, “GFS and GFS2 Commands” shows the equivalent GFS and GFS2 commands.
| GFS Command | GFS2 Command | Description | ||||
|---|---|---|---|---|---|---|
mount | mount | Mount a file system. The system can determine whether the file system is a GFS or GFS2 file system type. For information on the GFS2 mount options see the gfs2_mount(8) man page. | ||||
umount | umount | Unmount a file system. | ||||
|
| Check and repair an unmounted file system. | ||||
gfs_grow | gfs2_grow | Grow a mounted file system. | ||||
gfs_jadd | gfs2_jadd | Add a journal to a mounted file system. | ||||
|
| Create a file system on a storage device. | ||||
gfs_quota | gfs2_quota | Manage quotas on a mounted file system. | ||||
gfs_tool | gfs2_tool | Configure, tune, or gather information about a file system. | ||||
gfs_edit | gfs2_edit | Display, print, or edit file system internal structures. The gfs2_edit command can be used for GFS file systems as well as GFS2 file system. | ||||
gfs_tool setflag jdata/inherit_jdata | chattr +j (preferred) | Enable journaling on a file or directory. | ||||
setfacl/getfacl | setfacl/getfacl | Set or get file access control list for a file or directory. | ||||
setfattr/getfattr | setfattr/getfattr | set or get the extended attributes of a file. |
For a full listing of the supported options for the GFS2 file system commands, see the man pages for those commands.
2.2.2. Additional Differences Between GFS and GFS2 Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
This section summarizes the additional differences in GFS and GFS2 administration that are not described in Section 2.2.1, “GFS2 Command Names”.
Context-Dependent Path Names Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
GFS2 file systems do not provide support for context-dependent path names, which allow you to create symbolic links that point to variable destination files or directories. For this functionality in GFS2, you can use the
bind option of the mount command. For information on managing pathnames in GFS2, see Section 4.12, “Bind Mounts and Context-Dependent Path Names”.
gfs2.ko Module Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
The kernel module that implements the GFS file system is
gfs.ko. The kernel module that implements the GFS2 file system is gfs2.ko.
Enabling Quota Enforcement in GFS2 Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
In GFS2 file systems, quota enforcement is disabled by default and must be explicitly enabled. To enable and disable quotas for GFS2 file systems, you use the
quota=on|off|account option for the mount command. For information on enabling and disabling quota enforcement, see Section 4.5.4, “Enabling/Disabling Quota Enforcement”.
Data Journaling Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
GFS2 file systems support the use of the
chattr command to set and clear the j flag on a file or directory. Setting the +j flag on a file enables data journaling on that file. Setting the +j flag on a directory means "inherit jdata", which indicates that all files and directories subsequently created in that directory are journaled. Using the chattr command is the preferred way to enable and disable data journaling on a file.
Adding Journals Dynamically Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
In GFS file systems, journals are embedded metadata that exists outside of the file system, making it necessary to extend the size of the logical volume that contains the file system before adding journals. In GFS2 file systems, journals are plain (though hidden) files. This means that for GFS2 file systems, journals can be dynamically added as additional servers mount a file system, as long as space remains on the file system for the additional journals. For information on adding journals to a GFS2 file system, see Section 4.7, “Adding Journals to a File System”.
atime_quantum parameter removed Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
The GFS2 file system does not support the
atime_quantum tunable parameter, which can be used by the GFS file system to specify how often atime updates occur. In its place GFS2 supports the relatime and noatime mount options. The relatime mount option is recommended to achieve similar behavior to setting the atime_quantum parameter in GFS.
The data= option of the mount command Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
When mounting GFS2 file systems, you can specify the
data=ordered or data=writeback option of the mount. When data=ordered is set, the user data modified by a transaction is flushed to the disk before the transaction is committed to disk. This should prevent the user from seeing uninitialized blocks in a file after a crash. When data=writeback is set, the user data is written to the disk at any time after it is dirtied. This does not provide the same consistency guarantee as ordered mode, but it should be slightly faster for some workloads. The default is ordered mode.
The gfs2_tool command Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
The
gfs2_tool command supports a different set of options for GFS2 than the gfs_tool command supports for GFS:
- The
gfs2_toolcommand supports ajournalsparameter that prints out information about the currently configured journals, including how many journals the file system contains. - The
gfs2_toolcommand does not support thecountersflag, which thegfs_toolcommand uses to display GFS statistics. - The
gfs2_toolcommand does not support theinherit_jdataflag. To flag a directory as "inherit jdata", you can set thejdataflag on the directory or you can use thechattrcommand to set the+jflag on the directory. Using thechattrcommand is the preferred way to enable and disable data journaling on a file.
The gfs2_edit command Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
The
gfs2_edit command supports a different set of options for GFS2 than the gfs_edit command supports for GFS. For information on the specific options each version of the command supports, see the gfs2_edit and gfs_edit man pages.
2.2.3. GFS2 Performance Improvements Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
There are many features of GFS2 file systems that do not result in a difference in the user interface from GFS file systems but which improve file system performance.
A GFS2 file system provides improved file system performance in the following ways:
- Better performance for heavy usage in a single directory
- Faster synchronous I/O operations
- Faster cached reads (no locking overhead)
- Faster direct I/O with preallocated files (provided I/O size is reasonably large, such as 4M blocks)
- Faster I/O operations in general
- Faster Execution of the
dfcommand, because of fasterstatfscalls - Improved
atimemode to reduce the number of write I/O operations generated byatimewhen compared with GFS
GFS2 file systems provide broader and more mainstream support in the following ways:
- GFS2 is part of the upstream kernel (integrated into 2.6.19).
- GFS2 supports the following features.
- extended file attributes (
xattr) - the
lsattr() andchattr() attribute settings via standardioctl() calls - nanosecond timestamps
A GFS2 file system provides the following improvements to the internal efficiency of the file system:
- GFS2 uses less kernel memory.
- GFS2 requires no metadata generation numbers.Allocating GFS2 metadata does not require reads. Copies of metadata blocks in multiple journals are managed by revoking blocks from the journal before lock release.
- GFS2 includes a much simpler log manager that knows nothing about unlinked inodes or quota changes.
- The
gfs2_growandgfs2_jaddcommands use locking to prevent multiple instances running at the same time. - The ACL code has been simplified for calls like
creat() andmkdir(). - Unlinked inodes, quota changes, and
statfschanges are recovered without remounting the journal.
Chapter 3. Getting Started Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
This chapter describes procedures for initial setup of GFS2 and contains the following sections:
3.1. Prerequisite Tasks Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
You should complete the following tasks before setting up Red Hat GFS2:
- Make sure that you have noted the key characteristics of the GFS2 nodes (refer to Section 2.1, “Before Setting Up GFS2”).
- Make sure that the clocks on the GFS2 nodes are synchronized. It is recommended that you use the Network Time Protocol (NTP) software provided with your Red Hat Enterprise Linux distribution.
Note
The system clocks in GFS2 nodes must be within a few minutes of each other to prevent unnecessary inode time-stamp updating. Unnecessary inode time-stamp updating severely impacts cluster performance. - In order to use GFS2 in a clustered environment, you must configure your system to use the Clustered Logical Volume Manager (CLVM), a set of clustering extensions to the LVM Logical Volume Manager. In order to use CLVM, the Red Hat Cluster Suite software, including the
clvmddaemon, must be running. For information on using CLVM, see Logical Volume Manager Administration. For information on installing and administering Red Hat Cluster Suite, see Cluster Administration.
3.2. Initial Setup Tasks Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Initial GFS2 setup consists of the following tasks:
- Setting up logical volumes.
- Making a GFS2 files system.
- Mounting file systems.
Follow these steps to set up GFS2 initially.
- Using LVM, create a logical volume for each Red Hat GFS2 file system.
Note
You can useinit.dscripts included with Red Hat Cluster Suite to automate activating and deactivating logical volumes. For more information aboutinit.dscripts, refer to Configuring and Managing a Red Hat Cluster. - Create GFS2 file systems on logical volumes created in Step 1. Choose a unique name for each file system. For more information about creating a GFS2 file system, refer to Section 4.1, “Making a File System”.You can use either of the following formats to create a clustered GFS2 file system:
mkfs.gfs2 -p lock_dlm -t ClusterName:FSName -j NumberJournals BlockDevice
mkfs.gfs2 -p lock_dlm -t ClusterName:FSName -j NumberJournals BlockDeviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow mkfs -t gfs2 -p lock_dlm -t LockTableName -j NumberJournals BlockDevice
mkfs -t gfs2 -p lock_dlm -t LockTableName -j NumberJournals BlockDeviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow You can use either of the following formats to create a local GFS2 file system:mkfs.gfs2 -p lock_nolock -j NumberJournals BlockDevice
mkfs.gfs2 -p lock_nolock -j NumberJournals BlockDeviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow mkfs -t gfs2 -p lock_nolock -j NumberJournals BlockDevice
mkfs -t gfs2 -p lock_nolock -j NumberJournals BlockDeviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow For more information on creating a GFS2 file system, see Section 4.1, “Making a File System”. - At each node, mount the GFS2 file systems. For more information about mounting a GFS2 file system, see Section 4.2, “Mounting a File System”.Command usage:
mount BlockDevice MountPointmount -o acl BlockDevice MountPointThemount option allows manipulating file ACLs. If a file system is mounted without the-oaclmount option, users are allowed to view ACLs (with-oaclgetfacl), but are not allowed to set them (withsetfacl).Note
You can useinit.dscripts included with Red Hat Cluster Suite to automate mounting and unmounting GFS2 file systems. For more information aboutinit.dscripts, refer to Configuring and Managing a Red Hat Cluster.
Chapter 4. Managing GFS2 Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
This chapter describes the tasks and commands for managing GFS2 and consists of the following sections:
4.1. Making a File System Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
You create a GFS2 file system with the
mkfs.gfs2 command. You can also use the mkfs command with the -t gfs2 option specified. A file system is created on an activated LVM volume. The following information is required to run the mkfs.gfs2 command:
- Lock protocol/module name (the lock protocol for a cluster is
lock_dlm) - Cluster name (when running as part of a cluster configuration)
- Number of journals (one journal required for each node that may be mounting the file system)
When creating a GFS2 file system, you can use the
mkfs.gfs2 command directly, or you can use the mkfs command with the -t parameter specifying a file system of type gfs2, followed by the gfs2 file system options.
Note
Once you have created a GFS2 file system with the
mkfs.gfs2 command, you cannot decrease the size of the file system. You can, however, increase the size of an existing file system with the gfs2_grow command, as described in Section 4.6, “Growing a File System”.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
When creating a clustered GFS2 file system, you can use either of the following formats:
mkfs.gfs2 -p LockProtoName -t LockTableName -j NumberJournals BlockDevice
mkfs.gfs2 -p LockProtoName -t LockTableName -j NumberJournals BlockDevice
mkfs -t gfs2 -p LockProtoName -t LockTableName -j NumberJournals BlockDevice
mkfs -t gfs2 -p LockProtoName -t LockTableName -j NumberJournals BlockDevice
When creating a local GFS2 file system, you can use either of the following formats:
Note
For the Red Hat Enterprise Linux 5.5 release and later Red Hat does not support the use of GFS2 as a single-node file system. Red Hat will continue to support single-node GFS2 file systems for existing customers.
mkfs.gfs2 -p LockProtoName -j NumberJournals BlockDevice
mkfs.gfs2 -p LockProtoName -j NumberJournals BlockDevice
mkfs -t gfs2 -p LockProtoName -j NumberJournals BlockDevice
mkfs -t gfs2 -p LockProtoName -j NumberJournals BlockDevice
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. LockTableName- This parameter is specified for GFS2 file system in a cluster configuration. It has two parts separated by a colon (no spaces) as follows:
ClusterName:FSNameClusterName, the name of the Red Hat cluster for which the GFS2 file system is being created.FSName, the file system name, can be 1 to 16 characters long. The name must be unique for alllock_dlmfile systems over the cluster, and for all file systems (lock_dlmandlock_nolock) on each local node.
Number- Specifies the number of journals to be created by the
mkfs.gfs2command. One journal is required for each node that mounts the file system. For GFS2 file systems, more journals can be added later without growing the file system, as described in Section 4.7, “Adding Journals to a File System”. BlockDevice- Specifies a logical or physical volume.
Examples Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
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.
mkfs.gfs2 -p lock_dlm -t alpha:mydata1 -j 8 /dev/vg01/lvol0
mkfs.gfs2 -p lock_dlm -t alpha:mydata1 -j 8 /dev/vg01/lvol0
mkfs -t gfs2 -p lock_dlm -t alpha:mydata1 -j 8 /dev/vg01/lvol0
mkfs -t gfs2 -p lock_dlm -t alpha:mydata1 -j 8 /dev/vg01/lvol0
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.
mkfs.gfs2 -p lock_dlm -t alpha:mydata2 -j 8 /dev/vg01/lvol1
mkfs.gfs2 -p lock_dlm -t alpha:mydata2 -j 8 /dev/vg01/lvol1
mkfs -t gfs2 -p lock_dlm -t alpha:mydata2 -j 8 /dev/vg01/lvol1
mkfs -t gfs2 -p lock_dlm -t alpha:mydata2 -j 8 /dev/vg01/lvol1
Complete Options Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Table 4.1, “Command Options:
mkfs.gfs2” describes the mkfs.gfs2 command options (flags and parameters).
| Flag | Parameter | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|
-c | Megabytes | Sets the initial size of each journal's quota change file to Megabytes. | |||||||
-D | Enables debugging output. | ||||||||
-h | Help. Displays available options. | ||||||||
-J | MegaBytes | Specifies the size of the journal in megabytes. Default journal size is 128 megabytes. The minimum size is 8 megabytes. Larger journals improve performance, although they use more memory than smaller journals. | |||||||
-j | Number | Specifies the number of journals to be created by the mkfs.gfs2 command. One journal is required for each node that mounts the file system. If this option is not specified, one journal will be created. For GFS2 file systems, you can add additional journals at a later time without growing the file system. | |||||||
-O | Prevents the mkfs.gfs2 command from asking for confirmation before writing the file system. | ||||||||
-p | LockProtoName |
| |||||||
-q | Quiet. Do not display anything. | ||||||||
-r | MegaBytes | Specifies the size of the resource groups in megabytes. The minimum resource group size is 32 MB. The maximum resource group size is 2048 MB. A large resource group size may increase performance on very large file systems. If this is not specified, mkfs.gfs2 chooses the resource group size based on the size of the file system: average size file systems will have 256 MB resource groups, and bigger file systems will have bigger RGs for better performance. | |||||||
-t | LockTableName |
| |||||||
-u | MegaBytes | Specifies the initial size of each journal's unlinked tag file. | |||||||
-V | Displays command version information. |
4.2. Mounting a File System Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Before you can mount a GFS2 file system, the file system must exist (refer to Section 4.1, “Making a File System”), the volume where the file system exists must be activated, and the supporting clustering and locking systems must be started (refer to Configuring and Managing a Red Hat Cluster). After those requirements have been met, you can mount the GFS2 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 Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Mounting Without ACL Manipulation
mount BlockDevice MountPoint
mount BlockDevice MountPoint
Mounting With ACL Manipulation
mount -o acl BlockDevice MountPoint
mount -o acl BlockDevice MountPoint
-o acl- GFS2-specific option to allow manipulating file ACLs.
BlockDevice- Specifies the block device where the GFS2 file system resides.
MountPoint- Specifies the directory where the GFS2 file system should be mounted.
Example Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
In this example, the GFS2 file system on
/dev/vg01/lvol0 is mounted on the /mygfs2 directory.
mount /dev/vg01/lvol0 /mygfs2
mount /dev/vg01/lvol0 /mygfs2
Complete Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
mount BlockDevice MountPoint -o option
mount BlockDevice MountPoint -o option
The
-o option argument consists of GFS2-specific options (refer to Table 4.2, “GFS2-Specific Mount Options”) or acceptable standard Linux mount -o options, or a combination of both. Multiple option parameters are separated by a comma and no spaces.
Note
The
mount command is a Linux system command. In addition to using GFS2-specific options described in this section, you can use other, standard, mount command options (for example, -r). For information about other Linux mount command options, see the Linux mount man page.
Table 4.2, “GFS2-Specific Mount Options” describes the available GFS2-specific
-o option values that can be passed to GFS2 at mount time.
Note
This table includes descriptions of options that are used with local file systems only For the Red Hat Enterprise Linux 5.5 release and later Red Hat does not support the use of GFS2 as a single-node file system. Red Hat will continue to support single-node GFS2 file systems for existing customers.
| Option | Description | ||||||
|---|---|---|---|---|---|---|---|
acl | Allows manipulating file ACLs. If a file system is mounted without the acl mount option, users are allowed to view ACLs (with getfacl), but are not allowed to set them (with setfacl). | ||||||
data=[ordered|writeback] | When data=ordered is set, the user data modified by a transaction is flushed to the disk before the transaction is committed to disk. This should prevent the user from seeing uninitialized blocks in a file after a crash. When data=writeback mode is set, the user data is written to the disk at any time after it is dirtied; this does not provide the same consistency guarantee as ordered mode, but it should be slightly faster for some workloads. The default value is ordered mode. | ||||||
| Forces GFS2 to treat the file system as a multihost file system. By default, using lock_nolock automatically turns on the localflocks flags. | ||||||
|
| ||||||
lockproto=LockModuleName | Allows the user to specify which locking protocol to use with the file system. If LockModuleName is not specified, the locking protocol name is read from the file system superblock. | ||||||
locktable=LockTableName | Allows the user to specify which locking table to use with the file system. | ||||||
quota=[off/account/on] | Turns quotas on or off for a file system. Setting the quotas to be in the account state causes the per UID/GID usage statistics to be correctly maintained by the file system; limit and warn values are ignored. The default value is off. | ||||||
errors=panic|withdraw | When errors=panic is specified, file system errors will cause a kernel panic. The default behavior, which is the same as specifying errors=withdraw, is for the system to withdraw from the file system and make it inaccessible until the next reboot; in some cases the system may remain running. For information on the GFS2 withdraw function, see Section 4.14, “The GFS2 Withdraw Function”. |
4.3. Unmounting a File System Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
The GFS2 file system can be unmounted the same way as any Linux file system — by using the
umount command.
Note
The
umount command is a Linux system command. Information about this command can be found in the Linux umount command man pages.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
umount MountPoint
umount MountPoint
MountPoint- Specifies the directory where the GFS2 file system is currently mounted.
4.4. Special Considerations when Mounting GFS2 File Systems Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
GFS2 file systems that have been mounted manually rather than automatically through an entry in the
fstab file will not be known to the system when file systems are unmounted at system shutdown. As a result, the GFS2 script will not unmount the GFS2 file system. After the GFS2 shutdown script is run, the standard shutdown process kills off all remaining user processes, including the cluster infrastructure, and tries to unmount the file system. This unmount will fail without the cluster infrastructure and the system will hang.
To prevent the system from hanging when the GFS2 file systems are unmounted, you should do one of the following:
- Always use an entry in the
fstabfile to mount the GFS2 file system. - If a GFS2 file system has been mounted manually with the
mountcommand, be sure to unmount the file system manually with theumountcommand 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.
4.5. GFS2 Quota Management Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
File-system quotas are used to limit the amount of file system space a user or group can use. A user or group does not have a quota limit until one is set. GFS2 keeps track of the space used by each user and group even when there are no limits in place. GFS2 updates quota information in a transactional way so system crashes do not require quota usages to be reconstructed.
To prevent a performance slowdown, a GFS2 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, GFS2 dynamically reduces the synchronization period as a "hard" quota limit is approached.
GFS2 uses its
gfs2_quota command to manage quotas. Other Linux quota facilities cannot be used with GFS2.
4.5.1. Setting Quotas Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Two quota settings are available for each user ID (UID) or group ID (GID): a hard limit and a warn limit.
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
gfs2_quota command. The command only needs to be run on a single node where GFS2 is mounted.
By default, quota enforcement is not set on GFS2 file systems. To enable quota accounting, use the
quota= of the mount command when mounting the GFS2 file system, as described in Section 4.5.4, “Enabling/Disabling Quota Enforcement”.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Setting Quotas, Hard Limit
gfs2_quota limit -u User -l Size -f MountPoint
gfs2_quota limit -u User -l Size -f MountPoint
gfs2_quota limit -g Group -l Size -f MountPoint
gfs2_quota limit -g Group -l Size -f MountPoint
Setting Quotas, Warn Limit
gfs2_quota warn -u User -l Size -f MountPoint
gfs2_quota warn -u User -l Size -f MountPoint
gfs2_quota warn -g Group -l Size -f MountPoint
gfs2_quota warn -g Group -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,-sand-bflags change the units to kilobytes, sectors, and file system blocks, respectively. MountPoint- Specifies the GFS2 file system to which the actions apply.
Examples Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
This example sets the hard limit for user Bert to 1024 megabytes (1 gigabyte) on file system
/mygfs2.
gfs2_quota limit -u Bert -l 1024 -f /mygfs2
gfs2_quota limit -u Bert -l 1024 -f /mygfs2
This example sets the warn limit for group ID 21 to 50 kilobytes on file system
/mygfs2.
gfs2_quota warn -g 21 -l 50 -k -f /mygfs2
gfs2_quota warn -g 21 -l 50 -k -f /mygfs2
4.5.2. Displaying Quota Limits and Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Quota limits and current usage can be displayed for a specific user or group using the
gfs2_quota get command. The entire contents of the quota file can also be displayed using the gfs2_quota list command, in which case all IDs with a non-zero hard limit, warn limit, or value are listed.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Displaying Quota Limits for a User
gfs2_quota get -u User -f MountPoint
gfs2_quota get -u User -f MountPoint
Displaying Quota Limits for a Group
gfs2_quota get -g Group -f MountPoint
gfs2_quota get -g Group -f MountPoint
Displaying Entire Quota File
gfs2_quota list -f MountPoint
gfs2_quota list -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- Specifies the GFS2 file system to which the actions apply.
Command Output Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
GFS2 quota information from the
gfs2_quota command is displayed as follows:
user User: limit:LimitSize warn:WarnSize value:Value group Group: limit:LimitSize warn:WarnSize value:Value
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 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 Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
When displaying quota information, the
gfs2_quota command does not resolve UIDs and GIDs into names if the -n option is added to the command line.
Space allocated to GFS2'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 gfs2_quota with the results of a du command.
Examples Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
This example displays quota information for all users and groups that have a limit set or are using any disk space on file system
/mygfs2.
gfs2_quota list -f /mygfs2
gfs2_quota list -f /mygfs2
This example displays quota information in sectors for group
users on file system /mygfs2.
gfs2_quota get -g users -f /mygfs2 -s
gfs2_quota get -g users -f /mygfs2 -s
4.5.3. Synchronizing Quotas Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
GFS2 stores all quota information in its own internal file on disk. A GFS2 node does not update this quota file for every file system write; rather, it updates the quota file once every 60 seconds. This is necessary to avoid contention among nodes writing to the quota file, which would cause a slowdown in performance.
As a user or group approaches their quota limit, GFS2 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 gfs2_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.)
You can use the
gfs2_quota sync command to synchronize the quota information from a node to the on-disk quota file between the automatic updates performed by GFS2.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Synchronizing Quota Information
gfs2_quota sync -f MountPoint
gfs2_quota sync -f MountPoint
MountPoint- Specifies the GFS2 file system to which the actions apply.
Tuning the Time Between Synchronizations
gfs2_tool settune MountPoint quota_quantum Seconds
gfs2_tool settune MountPoint quota_quantum Seconds
MountPoint- Specifies the GFS2 file system to which the actions apply.
Seconds- Specifies the new time period between regular quota-file synchronizations by GFS2. Smaller values may increase contention and slow down performance.
Examples Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
This example synchronizes the quota information from the node it is run on to file system
/mygfs2.
gfs2_quota sync -f /mygfs2
gfs2_quota sync -f /mygfs2
This example changes the default time period between regular quota-file updates to one hour (3600 seconds) for file system
/mygfs2 on a single node.
gfs2_tool settune /mygfs2 quota_quantum 3600
gfs2_tool settune /mygfs2 quota_quantum 3600
4.5.4. Enabling/Disabling Quota Enforcement Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
In GFS2 file systems, quota enforcement is disabled by default. To enable quota enforcement for a file system, mount the file system with the
quota=on option specified.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
mount -o quota=on BlockDevice MountPoint
mount -o quota=on BlockDevice MountPoint
To mount a file system with quota enforcement disabled, mount the file system with the
quota=off option specified. This is the default setting.
mount -o quota=off BlockDevice MountPoint
mount -o quota=off BlockDevice MountPoint
-o quota={on|off}- Specifies that quota enforcement is enabled or disabled when the file system is mounted.
BlockDevice- Specifies the block device where the GFS2 file system resides.
MountPoint- Specifies the directory where the GFS2 file system should be mounted.
Examples Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
In this example, the GFS2 file system on
/dev/vg01/lvol0 is mounted on the /mygfs2 directory with quota enforcement enabled.
mount -o quota=on /dev/vg01/lvol0 /mygfs2
mount -o quota=on /dev/vg01/lvol0 /mygfs2
4.5.5. Enabling Quota Accounting Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
It is possible to keep track of disk usage and maintain quota accounting for every user and group without enforcing the limit and warn values. To do this, mount the file system with the
quota=account option specified.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
mount -o quota=account BlockDevice MountPoint
mount -o quota=account BlockDevice MountPoint
-o quota=account- Specifies that user and group usage statistics are maintained by the file system, even though the quota limits are not enforced.
BlockDevice- Specifies the block device where the GFS2 file system resides.
MountPoint- Specifies the directory where the GFS2 file system should be mounted.
Example Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
In this example, the GFS2 file system on
/dev/vg01/lvol0 is mounted on the /mygfs2 directory with quota accounting enabled.
mount -o quota=account /dev/vg01/lvol0 /mygfs2
mount -o quota=account /dev/vg01/lvol0 /mygfs2
4.6. Growing a File System Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
The
gfs2_grow command is used to expand a GFS2 file system after the device where the file system resides has been expanded. Running a gfs2_grow command on an existing GFS2 file system fills all spare space between the current end of the file system and the end of the device with a newly initialized GFS2 file system extension. When the fill operation is completed, the resource index for the file system is updated. All nodes in the cluster can then use the extra storage space that has been added.
The
gfs2_grow command must be run on a mounted file system, but only needs to be run on one node in a cluster. All the other nodes sense that the expansion has occurred and automatically start using the new space.
Note
Once you have created a GFS2 file system with the
mkfs.gfs2 command, you cannot decrease the size of the file system.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
gfs2_grow MountPoint
gfs2_grow MountPoint
MountPoint- Specifies the GFS2 file system to which the actions apply.
Comments Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Before running the
gfs2_grow command:
- Back up important data on the file system.
- Determine the volume that is used by the file system to be expanded by running a
dfcommand.MountPoint - Expand the underlying cluster volume with LVM. For information on administering LVM volumes, see Logical Volume Manager Administration.
After running the
gfs2_grow command, run a df command to check that the new space is now available in the file system.
Examples Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
In this example, the file system on the
/mygfs2fs directory is expanded.
Complete Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
gfs2_grow [Options] {MountPoint | Device} [MountPoint | Device]
gfs2_grow [Options] {MountPoint | Device} [MountPoint | Device]
MountPoint- Specifies the directory where the GFS2 file system is mounted.
Device- Specifies the device node of the file system.
Table 4.3, “GFS2-specific Options Available While Expanding A File System” describes the GFS2-specific options that can be used while expanding a GFS2 file system.
| Option | Description |
|---|---|
-h | Help. Displays a short usage message. |
-q | Quiet. Turns down the verbosity level. |
-r MegaBytes | Specifies the size of the new resource group. The default size is 256MB. |
-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. |
4.7. Adding Journals to a File System Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
The
gfs2_jadd command is used to add journals to a GFS2 file system. You can add journals to a GFS2 file system dynamically at any point without expanding the underlying logical volume. The gfs2_jadd command must be run on a mounted file system, but it needs to be run on only one node in the cluster. All the other nodes sense that the expansion has occurred.
Note
If a GFS2 file system is full, the
gfs2_jadd will fail, even if the logical volume containing the file system has been extended and is larger than the file system. This is because in a GFS2 file system, journals are plain files rather than embedded metadata, so simply extending the underlying logical volume will not provide space for the journals.
Before adding journals to a GFS file system, you can use the
journals option of the gfs2_tool to find out how many journals the GFS2 file system currently contains. The following example displays the number and size of the journals in the file system mounted at /mnt/gfs2.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
gfs2_jadd -j Number MountPoint
gfs2_jadd -j Number MountPoint
Number- Specifies the number of new journals to be added.
MountPoint- Specifies the directory where the GFS2 file system is mounted.
Examples Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
In this example, one journal is added to the file system on the
/mygfs2 directory.
gfs2_jadd -j1 /mygfs2
gfs2_jadd -j1 /mygfs2
In this example, two journals are added to the file system on the
/mygfs2 directory.
gfs2_jadd -j2 /mygfs2
gfs2_jadd -j2 /mygfs2
Complete Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
gfs2_jadd [Options] {MountPoint | Device} [MountPoint | Device]
gfs2_jadd [Options] {MountPoint | Device} [MountPoint | Device]
MountPoint- Specifies the directory where the GFS2 file system is mounted.
Device- Specifies the device node of the file system.
Table 4.4, “GFS2-specific Options Available When Adding Journals” describes the GFS2-specific options that can be used when adding journals to a GFS2 file system.
| Flag | Parameter | Description |
|---|---|---|
-h | Help. Displays short usage message. | |
-J | MegaBytes | Specifies the size of the new journals in megabytes. Default journal size is 128 megabytes. The minimum size is 32 megabytes. To add journals of different sizes to the file system, the gfs2_jadd command must be run for each size journal. The size specified is rounded down so that it is a multiple of the journal-segment size that was specified when the file system was created. |
-j | Number | Specifies the number of new journals to be added by the gfs2_jadd command. The default value is 1. |
-q | Quiet. Turns down the verbosity level. | |
-V | Displays command version information. |
4.8. Data Journaling Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Ordinarily, GFS2 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 for very small files because the file data is written to the journal in addition to the metadata. This advantage rapidly reduces as the file size increases. Writing to medium and larger files will be much slower with data journaling turned on.
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 GFS2 files created in a flagged directory (and all its subdirectories). Existing files with zero length can also have data journaling turned on or off.
Enabling data journaling on a directory sets the directory to "inherit jdata", which indicates that all files and directories subsequently created in that directory are journaled. You can enable and disable data journaling on a file with the
chattr command.
The following commands enable data journaling on the
/mnt/gfs2/gfs2_dir/newfile file and then check whether the flag has been set properly.
chattr +j /mnt/gfs2/gfs2_dir/newfile lsattr /mnt/gfs2/gfs2_dir
[root@roth-01 ~]# chattr +j /mnt/gfs2/gfs2_dir/newfile
[root@roth-01 ~]# lsattr /mnt/gfs2/gfs2_dir
---------j--- /mnt/gfs2/gfs2_dir/newfile
The following commands disable data journaling on the
/mnt/gfs2/gfs2_dir/newfile file and then check whether the flag has been set properly.
chattr -j /mnt/gfs2/gfs2_dir/newfile lsattr /mnt/gfs2/gfs2_dir
[root@roth-01 ~]# chattr -j /mnt/gfs2/gfs2_dir/newfile
[root@roth-01 ~]# lsattr /mnt/gfs2/gfs2_dir
------------- /mnt/gfs2/gfs2_dir/newfile
You can also use the
chattr command to set the j flag on a directory. When you set this flag for a directory, all files and directories subsequently created in that directory are journaled. The following set of commands sets the j flag on the gfs2_dir directory, then checks whether the flag has been set properly. After this, the commands create a new file called newfile in the /mnt/gfs2/gfs2_dir directory and then check whether the j flag has been set for the file. Since the j flag is set for the directory, then newfile should also have journaling enabled.
4.9. Configuring atime Updates Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Each file inode and directory inode has three time stamps associated with it:
ctime— The last time the inode status was changedmtime— The last time the file (or directory) data was modifiedatime— The last time the file (or directory) data was accessed
If
atime updates are enabled as they are by default on GFS2 and other Linux file systems then every time a file is read, its inode needs to be updated.
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 or reduce the frequency of atime updates.
To reduce the effects of
atime updating, you can mount with the noatime option, which disables atime updates on that file system. The noatime Linux mount option can be specified when the file system is mounted, which disables atime updates on that file system.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
mount BlockDevice MountPoint -o noatime
mount BlockDevice MountPoint -o noatime
BlockDevice- Specifies the block device where the GFS2 file system resides.
MountPoint- Specifies the directory where the GFS2 file system should be mounted.
Example Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
In this example, the GFS2 file system resides on the
/dev/vg01/lvol0 and is mounted on directory /mygfs2 with atime updates turned off.
mount /dev/vg01/lvol0 /mygfs2 -o noatime
mount /dev/vg01/lvol0 /mygfs2 -o noatime
4.10. Suspending Activity on a File System Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
You can suspend write activity to a file system by using the
gfs2_tool freeze command. Suspending write activity allows hardware-based device snapshots to be used to capture the file system in a consistent state. The gfs2_tool unfreeze command ends the suspension.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Start Suspension
gfs2_tool freeze MountPoint
gfs2_tool freeze MountPoint
End Suspension
gfs2_tool unfreeze MountPoint
gfs2_tool unfreeze MountPoint
MountPoint- Specifies the file system.
Examples Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
This example suspends writes to file system
/mygfs2.
gfs2_tool freeze /mygfs2
gfs2_tool freeze /mygfs2
This example ends suspension of writes to file system
/mygfs2.
gfs2_tool unfreeze /mygfs2
gfs2_tool unfreeze /mygfs2
4.11. Repairing a File System Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
When nodes fail with the file system mounted, file system journaling allows fast recovery. However, if a storage device loses power or is physically disconnected, file system corruption may occur. (Journaling cannot be used to recover from storage subsystem failures.) When that type of corruption occurs, you can recover the GFS2 file system by using the
fsck.gfs2 command.
Important
The
fsck.gfs2 command must be run only on a file system that is unmounted from all nodes.
Important
You should not check a GFS2 file system at boot time with the
fsck.gfs2 command. The fsck.gfs2 command can not determine at boot time whether the file system is mounted by another node in the cluster. You should run the fsck.gfs2 command manually only after the system boots.
To ensure that the
fsck.gfs2 command does not run on a GFS2 file system at boot time, modify the /etc/fstab file so that the final two columns for a GFS2 file system mount point show "0 0" rather than "1 1" (or any other numbers), as in the following example:
/dev/VG12/lv_svr_home /svr_home gfs2 defaults,noatime,nodiratime,noquota 0 0
/dev/VG12/lv_svr_home /svr_home gfs2 defaults,noatime,nodiratime,noquota 0 0
Note
If you have previous experience using the gfs_fsck command on GFS file systems, note that the
fsck.gfs2 command differs from some earlier releases of gfs_fsck in the in the following ways:
- Pressing Ctrl+C while running the
fsck.gfs2interrupts processing and displays a prompt asking whether you would like to abort the command, skip the rest of the current pass, or continue processing. - You can increase the level of verbosity by using the
-vflag. Adding a second-vflag increases the level again. - You can decrease the level of verbosity by using the
-qflag. Adding a second-qflag decreases the level again. - The
-noption opens a file system as read-only and answersnoto any queries automatically. The option provides a way of trying the command to reveal errors without actually allowing thefsck.gfs2command to take effect.
Refer to the
fsck.gfs2 man page for additional information about other command options.
Running the
fsck.gfs2 command requires system memory above and beyond the memory used for the operating system and kernel. Each block of memory in the GFS2 file system itself requires approximately five bits of additional memory, or 5/8 of a byte. So to estimate how many bytes of memory you will need to run the fsck.gfs2 command on your file system, determine how many blocks the file system contains and multiply that number by 5/8.
For example, to determine approximately how much memory is required to run the
fsck.gfs2 command on a GFS2 file system that is 16TB with a block size of 4K, first determine how many blocks of memory the file system contains by dividing 16Tb by 4K:
17592186044416 / 4096 = 4294967296
17592186044416 / 4096 = 4294967296
Since this file system contains 4294967296 blocks, multiply that number by 5/8 to determine how many bytes of memory are required:
4294967296 * 5/8 = 2684354560
4294967296 * 5/8 = 2684354560
This file system requires approximately 2.6GB of free memory to run the
fsck.gfs2 command. Note that if the block size was 1K, running the fsck.gfs2 command would require four times the memory, or approximately 11GB.
Usage Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
fsck.gfs2 -y BlockDevice
fsck.gfs2 -y BlockDevice
-y- The
-yflag causes all questions to be answered withyes. With the-yflag specified, thefsck.gfs2command does not prompt you for an answer before making changes. BlockDevice- Specifies the block device where the GFS2 file system resides.
Example Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
In this example, the GFS2 file system residing on block device
/dev/testvol/testlv is repaired. All queries to repair are automatically answered with yes.
4.12. Bind Mounts and Context-Dependent Path Names Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
GFS2 file systems do not provide support for Context-Dependent Path Names (CDPNs), which allow you to create symbolic links that point to variable destination files or directories. For this functionality in GFS2, you can use the
bind option of the mount command.
The
bind option of the mount command allows you to remount part of a file hierarchy at a different location while it is still available at the original location. The format of this command is as follows.
mount --bind olddir newdir
mount --bind olddir newdir
After executing this command, the contents of the
olddir directory are available at two locations: olddir and newdir. You can also use this option to make an individual file available at two locations.
For example, after executing the following commands the contents of
/root/tmp will be identical to the contents of the previously mounted /var/log directory.
cd ~root mkdir ./tmp mount --bind /var/log /tmp
[root@menscryfa ~]# cd ~root
[root@menscryfa ~]# mkdir ./tmp
[root@menscryfa ~]# mount --bind /var/log /tmp
Alternately, you can use an entry in the
/etc/fstab file to achieve the same results at mount time. The following /etc/fstab entry will result in the contents of /root/tmp being identical to the contents of the /var/log directory.
/var/log /root/tmp none bind 0 0
/var/log /root/tmp none bind 0 0
After you have mounted the file system, you can use the
mount command to see that the file system has been mounted, as in the following example.
mount | grep /tmp
[root@menscryfa ~]# mount | grep /tmp
/var/log on /root/tmp type none (rw,bind)
With a file system that supports Context-Dependent Path Names, you might have defined the
/bin directory as a Context-Dependent Path Name that would resolve to one of the following paths, depending on the system architecture.
/usr/i386-bin /usr/x86_64-bin /usr/ppc64-bin
/usr/i386-bin
/usr/x86_64-bin
/usr/ppc64-bin
You can achieve this same functionality by creating an empty
/bin directory. Then, using a script or an entry in the /etc/fstab file, you can mount each of the individual architecture directories onto the /bin directory with a mount -bind command. For example, you can use the following command as a line in a script.
mount --bind /usr/i386-bin /bin
mount --bind /usr/i386-bin /bin
Alternately, you can use the following entry in the
/etc/fstab file.
/usr/1386-bin /bin none bind 0 0
/usr/1386-bin /bin none bind 0 0
A bind mount can provide greater flexibility than a Context-Dependent Path Name, since you can use this feature to mount different directories according to any criteria you define (such as the value of
%fill for the file system). Context-Dependent Path Names are more limited in what they can encompass. Note, however, that you will need to write your own script to mount according to a criteria such as the value of %fill.
Warning
When you mount a file system with the
bind option and the original file system was mounted rw, the new file system will also be mounted rw even if you use the ro flag; the ro flag is silently ignored. In this case, the new file system might be marked as ro in the /proc/mounts directory, which may be misleading.
4.13. Bind Mounts and File System Mount Order Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
When you use the
bind option of the mount command, you must be sure that the file systems are mounted in the correct order. In the following example, the /var/log directory must be mounted before executing the bind mount on the /tmp directory:
mount --bind /var/log /tmp
# mount --bind /var/log /tmp
The ordering of file system mounts is determined as follows:
- In general, file system mount order is determined by the order in which the file systems appear in the
fstabfile. The exceptions to this ordering are file systems mounted with the_netdevflag or file systems that have their owninitscripts. - A file system with its own
initscript is mounted later in the initialization process, after the file systems in thefstabfile. - File systems mounted with the
_netdevflag are mounted when the network has been enabled on the system.
If your configuration requires that you create a bind mount on which to mount a GFS2 file system, you can order your
fstab file as follows:
- Mount local file systems that are required for the bind mount.
- Bind mount the directory on which to mount the GFS2 file system.
- Mount the GFS2 file system.
If your configuration requires that you bind mount a local directory or file system onto a GFS2 file system, listing the file systems in the correct order in the
fstab file will not mount the file systems correctly since the GFS2 file system will not be mounted until the GFS2 init script is run. In this case, you should write an init script to execute the bind mount so that the bind mount will not take place until after the GFS2 file system is mounted.
The following script is an example of a custom
init script. This script performs a bind mount of two directories onto two directories of a GFS2 file system. In this example, there is an existing GFS2 mount point at /mnt/gfs2a, which is mounted when the GFS2 init script runs, after cluster startup.
In this example script, the values of the
chkconfig statement indicate the following:
- 345 indicates the run levels that the script will be started in
- 29 is the start priority, which in this case indicates that the script will run at startup time after the GFS2
initscript, which has a start priority of 26 - 73 is the stop priority, which in this case indicates that the script will be stopped during shutdown before the GFS2 script, which has a stop priority of 74
The start and stop values indicate that you can manually perform the indicated action by executing a
service start and a service stop command. For example, if the script is named fredwilma, then you can execute service fredwilma start.
This script should be put in the
/etc/init.d directory with the same permissions as the other scripts in that directory. You can then execute a chkconfig on command to link the script to the indicated run levels. For example, if the script is named fredwilma, then you can execute chkconfig fredwilma on.
4.14. The GFS2 Withdraw Function Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
The GFS2 withdraw function is a data integrity feature of GFS2 file systems in a cluster. If the GFS2 kernel module detects an inconsistency in a GFS2 file system following an I/O operation, the file system becomes unavailable to the cluster. The I/O operation stops and the system waits for further I/O operations to stop with an error, preventing further damage. When this occurs, you can stop any other services or applications manually, after which you can reboot and remount the GFS2 file system to replay the journals. If the problem persists, you can unmount the file system from all nodes in the cluster and perform file system recovery with the
fsck.gfs2 command. The GFS withdraw function is less severe than a kernel panic, which would cause another node to fence the node.
If your system is configured with the
gfs2 startup script enabled and the GFS2 file system is included in the /etc/fstab file, the GFS2 file system will be remounted when you reboot. If the GFS2 file system withdrew because of perceived file system corruption, it is recommended that you run the fsck.gfs2 command before remounting the file system. In this case, in order to prevent your file system from remounting at boot time, you can perform the following procedure:
- Temporarily disable the startup script on the affected node with the following command:
chkconfig gfs2 off
# chkconfig gfs2 offCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Reboot the affected node, starting the cluster software. The GFS2 file system will not be mounted.
- Unmount the file system from every node in the cluster.
- Run the
fsck.gfs2on the file system from one node only to ensure there is no file system corruption. - Re-enable the startup script on the affected node by running the following command:
chkconfig gfs2 on
# chkconfig gfs2 onCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Remount the GFS2 file system from all nodes in the cluster.
An example of an inconsistency that would yield a GFS2 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.
You can override the GFS2 withdraw function by mounting the file system with the
-o errors=panic option specified. When this option is specified, any errors that would normally cause the system to withdraw cause the system to panic instead. This stops the node's cluster communications, which causes the node to be fenced.
Internally, the GFS2 withdraw function works by having the kernel send a message to the
gfs_controld daemon requesting withdraw. The gfs_controld daemon runs the dmsetup program to place the device mapper error target underneath the filesystem preventing further access to the block device. It then tells the kernel that this has been completed. This is the reason for the GFS2 support requirement to always use a CLVM device under GFS2, since otherwise it is not possible to insert a device mapper target.
The purpose of the device mapper error target is to ensure that all future I/O operations will result in an I/O error that will allow the filesystem to be unmounted in an orderly fashion. As a result, when the withdraw occurs, it is normal to see a number of I/O errors from the device mapper device reported in the system logs.
Occasionally, the withdraw may fail if it is not possible for the
dmsetup program to insert the error target as requested. This can happen if there is a shortage of memory at the point of the withdraw and memory cannot be reclaimed due to the problem that triggered the withdraw in the first place.
A withdraw does not always mean that there is an error in GFS2. Sometimes the withdraw function can be triggered by device I/O errors relating to the underlying block device. It is highly recommended to check the logs to see if that is the case if a withdraw occurs.
Appendix A. Converting a File System from GFS to GFS2 Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Use the
gfs2_convert command. To convert a GFS file system to a GFS2 file system.
Warning
Before converting the GFS file system, you must back up the file system, since the conversion process is irreversible and any errors encountered during the conversion can result in the abrupt termination of the program and consequently an unusable file system.
Before converting the GFS file system, you must use the
gfs_fsck command to check the file system and fix any errors.
If the conversion from GFS to GFS2 is interrupted by a power failure or any other issue, restart the conversion tool. Do not attempt to execute the
fsck.gfs2 command on the file system until the conversion is complete.
Note
GFS2 file systems do not provide support for Context-Dependent Path Names (CDPNs), which allow you to create symbolic links that point to variable destination files or directories. To achieve the same functionality as CDPNs in GFS2 file systems, you can use the
bind option of the mount command.
The
gfs2_convert command identifies CDPNs and replaces them with empty directories with the same name. In order to configure bind mounts to replace the CDPNs, however, you need to know the full paths of the link targets of the CDPNs you are replacing. Before converting your file system, you can use the find command to identify the links.
The following command lists the symlinks that point to a
hostname CDPN:
find /mnt/gfs -lname @hostname
[root@smoke-01 gfs]# find /mnt/gfs -lname @hostname
/mnt/gfs/log
Similarly, you can execute the
find command for other CDPNs (mach, os, sys, uid, gid, jid). Note that since CDPN names can be of the form @hostname or {hostname}, you will need to run the find command for each variant.
For more information on bind mounts and context-dependent pathnames in GFS2, see Section 4.12, “Bind Mounts and Context-Dependent Path Names”.
When converting full or nearly full file systems, it is possible that there will not be enough space available to fit all the GFS2 file system data structures. In such cases, the size of all the journals is reduced uniformly such that everything fits in the available space.
- Make a backup of your existing GFS file system.
- Unmount the GFS file system from all nodes in the cluster.
- Execute the
gfs_fsckcommand on the GFS file system to ensure there is no file system corruption. - Execute
gfs2_convert. The system will display warnings and confirmation questions before convertinggfsfilesystemgfsfilesystemto GFS2.
The following example converts a GFS filesystem on block device
/dev/shell_vg/500g to a GFS2 filesystem.
Appendix B. Revision History Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
| Revision History | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Revision 9.0-7 | Mon Sep 8 2014 | |||||||||||||
| ||||||||||||||
| Revision 9.0-5 | Tue Jul 1 2014 | |||||||||||||
| ||||||||||||||
| Revision 9.0-3 | Mon Jun 30 2014 | |||||||||||||
| ||||||||||||||
| Revision 8.0-7 | Mon Sep 30 2013 | |||||||||||||
| ||||||||||||||
| Revision 8.0-5 | Wed Jul 10 2013 | |||||||||||||
| ||||||||||||||
| Revision 8.0-4 | Tue May 28 2013 | |||||||||||||
| ||||||||||||||
| Revision 8.0-3 | Wed May 22 2013 | |||||||||||||
| ||||||||||||||
| Revision 8.0-2 | Tue May 21 2013 | |||||||||||||
| ||||||||||||||
| Revision 7.0-3 | Fri Jan 4 2013 | |||||||||||||
| ||||||||||||||
| Revision 7.0-2 | Wed Aug 29 2012 | |||||||||||||
| ||||||||||||||
| Revision 6.0-3 | Thu Feb 16 2012 | |||||||||||||
| ||||||||||||||
| Revision 6.0-2 | Thu Dec 15 2011 | |||||||||||||
| ||||||||||||||
| Revision 6.0-1 | Thu Nov 10 2011 | |||||||||||||
| ||||||||||||||
| Revision 5.0-1 | Thu Jul 21 2011 | |||||||||||||
| ||||||||||||||
| Revision 4.0-1 | Thu Dec 23 2010 | |||||||||||||
| ||||||||||||||
| Revision 3.0-2 | Tue Aug 3 2010 | |||||||||||||
| ||||||||||||||
| Revision 3.0-1 | Thu Mar 11 2010 | |||||||||||||
| ||||||||||||||
| Revision 2.0-1 | Tue Aug 18 2009 | |||||||||||||
| ||||||||||||||
| Revision 1.0-1 | Thu Jan 29 2009 | |||||||||||||
|
| ||||||||||||||
Index Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
A
- acl mount option, Mounting a File System
- adding journals to a file system, Adding Journals to a File System
- atime, configuring updates, Configuring atime Updates
- mounting with noatime , Configuring atime Updates
- audience, Audience
B
- bind mount
- mount order, Bind Mounts and File System Mount Order
- bind mounts, Bind Mounts and Context-Dependent Path Names
C
- configuration, before, Before Setting Up GFS2
- configuration, initial, Getting Started
- prerequisite tasks, Prerequisite Tasks
D
- data journaling, Data Journaling
F
- file system
- adding journals, Adding Journals to a File System
- atime, configuring updates, Configuring atime Updates
- mounting with noatime , Configuring atime Updates
- bind mounts, Bind Mounts and Context-Dependent Path Names
- context-dependent path names (CDPNs), Bind Mounts and Context-Dependent Path Names
- data journaling, Data Journaling
- growing, Growing a File System
- making, Making a File System
- mount order, Bind Mounts and File System Mount Order
- mounting, Mounting a File System, Special Considerations when Mounting GFS2 File Systems
- quota management, GFS2 Quota Management
- displaying quota limits, Displaying Quota Limits and Usage
- enabling quota accounting, Enabling Quota Accounting
- enabling/disabling quota enforcement, Enabling/Disabling Quota Enforcement
- setting quotas, Setting Quotas
- synchronizing quotas, Synchronizing Quotas
- repairing, Repairing a File System
- suspending activity, Suspending Activity on a File System
- unmounting, Unmounting a File System, Special Considerations when Mounting GFS2 File Systems
- fsck.gfs2 command, Repairing a File System
G
- GFS2
- atime, configuring updates, Configuring atime Updates
- mounting with noatime , Configuring atime Updates
- managing, Managing GFS2
- quota management, GFS2 Quota Management
- displaying quota limits, Displaying Quota Limits and Usage
- enabling quota accounting, Enabling Quota Accounting
- enabling/disabling quota enforcement, Enabling/Disabling Quota Enforcement
- setting quotas, Setting Quotas
- synchronizing quotas, Synchronizing Quotas
- withdraw function, The GFS2 Withdraw Function
- GFS2 file system maximum size, GFS2 Overview
- GFS2-specific options for adding journals table, Complete Usage
- GFS2-specific options for expanding file systems table, Complete Usage
- gfs2_grow command, Growing a File System
- gfs2_jadd command, Adding Journals to a File System
- gfs2_quota command, GFS2 Quota Management
- growing a file system, Growing a File System
I
- initial tasks
- setup, initial, Initial Setup Tasks
- introduction, Introduction
- audience, Audience
M
- making a file system, Making a File System
- managing GFS2, Managing GFS2
- maximum size, GFS2 file system, GFS2 Overview
- mkfs command, Making a File System
- mkfs.gfs2 command options table, Complete Options
- mount command, Mounting a File System
- mount table, Complete Usage
- mounting a file system, Mounting a File System, Special Considerations when Mounting GFS2 File Systems
O
- overview, GFS2 Overview
- configuration, before, Before Setting Up GFS2
P
- path names, context-dependent (CDPNs), Bind Mounts and Context-Dependent Path Names
- preface (see introduction)
- prerequisite tasks
- configuration, initial, Prerequisite Tasks
Q
- quota management, GFS2 Quota Management
- displaying quota limits, Displaying Quota Limits and Usage
- enabling quota accounting, Enabling Quota Accounting
- enabling/disabling quota enforcement, Enabling/Disabling Quota Enforcement
- setting quotas, Setting Quotas
- synchronizing quotas, Synchronizing Quotas
- quota= mount option, Setting Quotas
- quota_quantum tunable parameter, Synchronizing Quotas
R
- repairing a file system, Repairing a File System
S
- setup, initial
- initial tasks, Initial Setup Tasks
- suspending activity on a file system, Suspending Activity on a File System
- system hang at unmount, Special Considerations when Mounting GFS2 File Systems
T
- tables
- GFS2-specific options for adding journals, Complete Usage
- GFS2-specific options for expanding file systems, Complete Usage
- mkfs.gfs2 command options, Complete Options
- mount options, Complete Usage
U
- umount command, Unmounting a File System
- unmount, system hang, Special Considerations when Mounting GFS2 File Systems
- unmounting a file system, Unmounting a File System, Special Considerations when Mounting GFS2 File Systems
W
- withdraw function, GFS2, The GFS2 Withdraw Function
Legal Notice Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Copyright © 2014 Red Hat Inc..
This document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported License. If you distribute this document, or a modified version of it, you must provide attribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be removed.
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, OpenShift, 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.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.