Questo contenuto non è disponibile nella lingua selezionata.
Chapter 3. Managing GFS2
This chapter describes the tasks and commands for managing GFS2 and consists of the following sections:
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:
mkfs.gfs2 -pLockProtoName
-tLockTableName
-jNumberJournals BlockDevice
mkfs -t gfs2 -pLockProtoName
-tLockTableName
-jNumberJournals BlockDevice
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.
mkfs.gfs2 -pLockProtoName
-jNumberJournals BlockDevice
mkfs -t gfs2 -pLockProtoName
-jNumberJournals 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 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 alllock_dlm
file systems over the cluster, and for all file systems (lock_dlm
andlock_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
.
# 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
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 -t gfs2 -p lock_dlm -t alpha:mydata2 -j 8 /dev/vg01/lvol1
Complete Options
Table 3.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 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 |
| ||||
-u | Megabytes | Specifies the initial size of each journal's unlinked tag file. | ||||
-V | Displays command version information. |