Chapter 4. Managing GFS2 This chapter describes the tasks and commands for managing GFS2 and consists of the following sections: Section 4.1, "Making a File System" Section 4.2, "Mounting a File System" Section 4.3, "Unmounting a File System" Section 4.5, "GFS2 Quota Management" Section 4.6, "Growing a File System" Section 4.7, "Adding Journals to a File System" Section 4.8, "Data Journaling" Section 4.9, "Configuring atime Updates" Section 4.10, "Suspending Activity on a File System" Section 4.11, "Repairing a File System" Section 4.12, "Bind Mounts and Context-Dependent Path Names" Section 4.13, "Bind Mounts and File System Mount Order" Section 4.14, "The GFS2 Withdraw Function" 4.1. Making a File System 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 When creating a clustered GFS2 file system, you can use either of the following formats: When creating a local GFS2 file system, you can use either of the following formats: Note For the Red Hat Enterprise Linux 6 release, Red Hat does not support the use of GFS2 as a single-node file system. 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:FSName ClusterName , the name of the cluster for which the GFS2 file system is being created. FSName , the file system name, can be 1 to 16 characters long. The name must be unique for all lock_dlm file systems over the cluster, and for all file systems ( lock_dlm and lock_nolock ) on each local node. Number Specifies the number of journals to be created by the mkfs.gfs2 command. One journal is required for each node that mounts the file system. For GFS2 file systems, more journals can be added later without growing the file system, as described in Section 4.7, "Adding Journals to a File System" . BlockDevice Specifies a logical or physical volume. Examples In these example, 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 . In these examples, a second lock_dlm file system is made, which can be used in cluster alpha . The file system name is mydata2 . The file system contains eight journals and is created on /dev/vg01/lvol1 . Complete Options Table 4.1, "Command Options: mkfs.gfs2 " describes the mkfs.gfs2 command options (flags and parameters). Table 4.1. Command Options: mkfs.gfs2 Flag Parameter Description -c Megabytes Sets the initial size of each journal's quota change file to Megabytes . -D Enables debugging output. -h Help. Displays available options. -J MegaBytes Specifies the size of the journal in megabytes. Default journal size is 128 megabytes. The minimum size is 8 megabytes. Larger journals improve performance, although they use more memory than smaller journals. -j Number Specifies the number of journals to be created by the mkfs.gfs2 command. One journal is required for each node that mounts the file system. If this option is not specified, one journal will be created. For GFS2 file systems, you can add additional journals at a later time without growing the file system. -O Prevents the mkfs.gfs2 command from asking for confirmation before writing the file system. -p LockProtoName Specifies the name of the locking protocol to use. Recognized locking protocols include: lock_dlm - The standard locking module, required for a clustered file system. lock_nolock - Used when GFS2 is acting as a local file system (one node only). -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 A unique identifier that specifies the lock table field when you use the lock_dlm protocol; the lock_nolock protocol does not use this parameter. This parameter has two parts separated by a colon (no spaces) as follows: ClusterName:FSName . ClusterName is the name of the cluster for which the GFS2 file system is being created; only members of this cluster are permitted to use this file system. 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. -u MegaBytes Specifies the initial size of each journal's unlinked tag file. -V Displays command version information.

Commands:
mkfs.gfs2 -p LockProtoName -t LockTableName -j NumberJournals BlockDevice
mkfs -t gfs2 -p LockProtoName -t LockTableName -j NumberJournals BlockDevice
mkfs.gfs2 -p LockProtoName -j NumberJournals BlockDevice
mkfs -t gfs2 -p LockProtoName -j NumberJournals BlockDevice
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.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