第 3 章 管理 GFS2


本章论述了管理 GFS2 的任务和命令,由以下部分组成:

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_dlm
  • Cluster name (needed when specifying the LockTableName parameter)
  • 日志数目(每个可能挂载文件系统的节点都需要一个日志)
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.

注意

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 第 3.5 节 “Growing a GFS2 File System”.

用法

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 -t gfs2 -p LockProtoName -t LockTableName -j NumberJournals BlockDevice
When creating a local GFS2 file system, you can use either of the following formats:

注意

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

警告

请确定您非常熟悉 LockProtoNameLockTableName 参数的使用。不正确的 LockProtoNameLockTableName 参数使用可能导致文件系统或者锁定空间崩溃。
LockProtoName
指定要使用的锁定协议名称,群集的锁定协议为 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 第 3.6 节 “Adding Journals to a GFS2 File System”.
BlockDevice
指定逻辑卷或者物理卷。

示例

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
在这些示例中,生成了第二个 lock_dlm 文件系统,它可用于群集 alpha。文件系统名为mydata2。文件系统包含八个日志,日志是在 /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

全部选项

表 3.1 “命令选项:mkfs.gfs2 describes the mkfs.gfs2 command options (flags and parameters).
表 3.1. 命令选项:mkfs.gfs2
标签参数描述
-cMegabytes Sets the initial size of each journal's quota change file to Megabytes.
-D 启用调试输出。
-h 帮助,显示可用选项。
-JMegabytes 以 MB 为单位指定日志大小。默认日志大小为 128MB,最小为 8MB。较大的日志可提高性能,但会比较小的日志占用更多的内存。
-jNumber 指定由 mkfs.gfs2 命令生成的日志数目。挂载文件系统的每个节点都需要一个日志。如果没有指定该选项,则会生成一个日志。对于 GFS2 文件系统,您可以后添加附加日志而不会增大文件系统。
-O 防止 mkfs.gfs2 命令在写入文件系统前进行确认。
-pLockProtoName
指定要使用的锁定协议名称,可识别的锁定协议包括:
lock_dlm — 标准锁定模式,用于群集的文件系统。
lock_nolock — 当 GFS2 作为本地文件系统作用时使用(只有一个节点)。
-q 静默,什么都不显示。
-rMegabytes 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.
-tLockTableName
在您使用 lock_dlm 协议时用来指定锁定表格字段的唯一识别程序,lock_nolock 协议不使用这个参数。
这个参数有两个部分,用冒号隔开(没有空格)如下: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,文件系统名称,长度可在 1-16 个字符之间,且必须不同于群集中的其它文件系统名。
-uMegabytesSpecifies the initial size of each journal's unlinked tag file.
-V 显示命令版本信息。
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.