第 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 -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:
注意
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
警告
请确定您非常熟悉
LockProtoName
和 LockTableName
参数的使用。不正确的 LockProtoName
和 LockTableName
参数使用可能导致文件系统或者锁定空间崩溃。
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 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 第 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).
标签 | 参数 | 描述 | ||||
---|---|---|---|---|---|---|
-c | Megabytes | Sets the initial size of each journal's quota change file to Megabytes . | ||||
-D | 启用调试输出。 | |||||
-h | 帮助,显示可用选项。 | |||||
-J | Megabytes | 以 MB 为单位指定日志大小。默认日志大小为 128MB,最小为 8MB。较大的日志可提高性能,但会比较小的日志占用更多的内存。 | ||||
-j | Number | 指定由 mkfs.gfs2 命令生成的日志数目。挂载文件系统的每个节点都需要一个日志。如果没有指定该选项,则会生成一个日志。对于 GFS2 文件系统,您可以后添加附加日志而不会增大文件系统。 | ||||
-O | 防止 mkfs.gfs2 命令在写入文件系统前进行确认。 | |||||
-p | LockProtoName |
| ||||
-q | 静默,什么都不显示。 | |||||
-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 | 显示命令版本信息。 |