Chapter 3. Managing GFS2 This chapter describes the tasks and commands for managing GFS2 and consists of the following sections: Section 3.1, "Creating a GFS2 File System" Section 3.2, "Mounting a GFS2 File System" Section 3.3, "Unmounting a GFS2 File System" Section 3.4, "GFS2 Quota Management" Section 3.5, "Growing a GFS2 File System" Section 3.6, "Adding Journals to a GFS2 File System" Section 3.7, "Data Journaling" Section 3.8, "Configuring atime Updates" Section 3.9, "Suspending Activity on a GFS2 File System" Section 3.10, "Repairing a GFS2 File System" Section 3.11, "The GFS2 Withdraw Function" 3.1. Creating a GFS2 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 (needed when specifying the LockTableName parameter) 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 3.5, "Growing a GFS2 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 As of 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 a GFS2 file system in a cluster configuration. It has two parts separated by a colon (no spaces) as follows: ClusterName:FSName ClusterName , the name of the cluster for which the GFS2 file system is being created. FSName , the file system name, can be 1 to 16 characters long. The name must be unique for 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 3.6, "Adding Journals to a GFS2 File System" . BlockDevice Specifies a logical or physical volume. Examples In these examples, lock_dlm is the locking protocol that the file system uses, since this is a clustered file system. The cluster name is alpha , and the file system name is mydata1 . The file system contains eight journals and is created on /dev/vg01/lvol0 . In these examples, a second lock_dlm file system is made, which can be used in cluster alpha . The file system name is mydata2 . The file system contains eight journals and is created on /dev/vg01/lvol1 . Complete Options Table 3.1, "Command Options: mkfs.gfs2 " describes the mkfs.gfs2 command options (flags and parameters). Table 3.1. Command Options: mkfs.gfs2 Flag Parameter Description -c Megabytes Sets the initial size of each journal's quota change file to Megabytes . -D Enables debugging output. -h Help. Displays available options. -J Megabytes Specifies the size of the journal in megabytes. Default journal size is 128 megabytes. The minimum size is 8 megabytes. Larger journals improve performance, although they use more memory than smaller journals. -j Number Specifies the number of journals to be created by the mkfs.gfs2 command. One journal is required for each node that mounts the file system. If this option is not specified, one journal will be created. For GFS2 file systems, you can add additional journals at a later time without growing the file system. -O Prevents the mkfs.gfs2 command from asking for confirmation before writing the file system. -p LockProtoName 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 megabytes. The maximum resource group size is 2048 megabytes. A large resource group size may increase performance on very large file systems. If this is not specified, mkfs.gfs2 chooses the resource group size based on the size of the file system: average size file systems will have 256 megabyte resource groups, and bigger file systems will have bigger RGs for better performance. -t LockTableName 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. 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