Pesquisar

Este conteúdo não está disponível no idioma selecionado.

Chapter 4. Managing GFS

download PDF
This chapter describes the tasks and commands for managing GFS and consists of the following sections:

4.1. Creating a File System

You can create a GFS file system with the gfs_mkfs command. A file system is created on an activated LVM volume. The following information is required to execute the gfs_mkfs command:
  • Lock protocol/module name. The lock protocol for a cluster is lock_dlm. The lock protocol when GFS is acting as a local file system (one node only) is lock_nolock.
  • 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 systema.) Make sure to account for additional journals needed for future expansion, as you cannot add journals dynamically to a GFS file system.
When creating a GFS file system, you can use the gfs_mkfs directly, or you can use the mkfs command with the -t parameter specifying a file system of type gfs, followed by the gfs file system options.

Note

Once you have created a GFS file system with the gfs_mkfs command, you cannot decrease the size of the file system. You can, however, increase the size of an existing file system with the gfs_grow command, as described in Section 4.7, “Growing a File System”.

Usage

When creating a clustered GFS file system, you can use either of the following formats:
gfs_mkfs -p LockProtoName -t LockTableName -j NumberJournals BlockDevice
mkfs -t gfs -p LockProtoName -t LockTableName -j NumberJournals BlockDevice
When creating a local file system, you can use either of the following formats:

Note

For the Red Hat Enterprise Linux 5.5 release and later Red Hat does not support the use of GFS as a single-node file system. Red Hat will continue to support single-node GFS file systems for existing customers.
gfs_mkfs -p LockProtoName -j NumberJournals BlockDevice
mkfs -t gfs -p LockProtoName -j NumberJournals 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. The lock protocol when GFS is acting as a local file system (one node only) is lock_nolock.
LockTableName
This parameter is specified for GFS 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 Red Hat cluster for which the GFS file system is being created.
  • FSName, the file system name, can be 1 to 16 characters long, and the name must be unique among all file systems in the cluster.
NumberJournals
Specifies the number of journals to be created by the gfs_mkfs command. One journal is required for each node that mounts the file system. (More journals than are needed can be specified at creation time to allow for future expansion.)
BlockDevice
Specifies a 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.
[root@ask-07 ~]#  gfs_mkfs -p lock_dlm -t alpha:mydata1 -j 8 /dev/vg01/lvol0
This will destroy any data on /dev/vg01/lvol0.

Are you sure you want to proceed? [y/n] y

Device:                    /dev/vg01/lvol0
Blocksize:                 4096
Filesystem Size:           136380192
Journals:                  8
Resource Groups:           2082
Locking Protocol:          lock_dlm
Lock Table:                alpha:mydata1

Syncing...
All Done
[root@ask-07 ~]#  mkfs -t gfs -p lock_dlm -t alpha:mydata1 -j 8 /dev/vg01/lvol0
This will destroy any data on /dev/vg01/lvol0.

Are you sure you want to proceed? [y/n] y

Device:                    /dev/vg01/lvol0
Blocksize:                 4096
Filesystem Size:           136380192
Journals:                  8
Resource Groups:           2082
Locking Protocol:          lock_dlm
Lock Table:                alpha:mydata1

Syncing...
All Done
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.
gfs_mkfs -p lock_dlm -t alpha:mydata2 -j 8 /dev/vg01/lvol1
mkfs -t gfs -p lock_dlm -t alpha:mydata2 -j 8 /dev/vg01/lvol1

Complete Options

Table 4.1, “Command Options: gfs_mkfs describes the gfs_mkfs command options.
Table 4.1. Command Options: gfs_mkfs
FlagParameterDescription
-b BlockSize Sets the file system block size to BlockSize. Default block size is 4096 bytes.
-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 32 megabytes.
-j Number
Specifies the number of journals to be created by the gfs_mkfs command. One journal is required for each node that mounts the file system.
Note: More journals than are needed can be specified at creation time to allow for future expansion.
-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 GFS is acting as a local file system (one node only).
-O  Prevents the gfs_mkfs command from asking for confirmation before writing the file system.
-q  Quiet. Do not display anything.
-r MegaBytes Specifies the size of the resource groups in megabytes. Default resource group size is 256 megabytes.
-s Blocks Specifies the journal-segment size in file system blocks.
-t LockTableName
Used in a clustered file system. This parameter has two parts separated by a colon (no spaces) as follows: ClusterName:FSName.
ClusterName is the name of the Red Hat cluster for which the GFS file system is being created. 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.
-V  Displays command version information.
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja oBlog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

© 2024 Red Hat, Inc.