Tuesday 6 August 2013

GFS2 cluster setup - step by step



GFS2 nodes
Determine which nodes in the cluster will mount the GFS2 file systems.
Number of file systems
Determine how many GFS2 file systems to create initially. (More file systems can be added later.)
File system name
Determine a unique name for each file system. The name must be unique for all lock_dlm file systems over the cluster. Each file system name is required in the form of a parameter variable. 
Journals
Determine the number of journals for your GFS2 file systems. One journal is required for each node that mounts a GFS2 file system. GFS2 allows you to add journals dynamically at a later point as additional servers mount a file system.
Storage devices and partitions
Determine the storage devices and partitions to be used for creating logical volumes (via CLVM) in the file systems.



GFS CommandGFS2 CommandDescription
mountmountMount a file system. The system can determine whether the file system is a GFS or GFS2 file system type. For information on the GFS2 mount options see the gfs2_mount(8) man page.
umountumountUnmount a file system.
fsck
gfs_fsck
fsck
fsck.gfs2
Check and repair an unmounted file system.
gfs_growgfs2_growGrow a mounted file system.
gfs_jaddgfs2_jaddAdd a journal to a mounted file system.
gfs_mkfs
mkfs -t gfs
mkfs.gfs2
mkfs -t gfs2
Create a file system on a storage device.
gfs_quotagfs2_quotaManage quotas on a mounted file system. As of the Red Hat Enterprise Linux 6.1 release, GFS2 supports the standard Linux quota facilities. For further information on quota management in GFS2, refer to 
gfs_tool
tunegfs2
mount parameters
dmsetup suspend
Configure, tune, or gather information about a file system. The tunegfs2 command is supported as of the Red Hat Enterprise Linux 6.2 release. There is also a gfs2_tool command.
gfs_editgfs2_editDisplay, print, or edit file system internal structures. The gfs2_edit command can be used for GFS file systems as well as GFS2 file system.
gfs_tool setflag jdata/inherit_jdatachattr +j(preferred)Enable journaling on a file or directory.
setfacl/getfaclsetfacl/getfaclSet or get file access control list for a file or directory.
setfattr/getfattrsetfattr/getfattrSet or get the extended attributes of a file.

Create a partition either on shared storage lun or any other normal partition
then format with gfs2 file system.

mkfs.gfs2 -p lock_dlm -t ClusterName:FSName -j NumberJournals BlockDevice

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 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
BlockDevice
Specifies a logical or physical volume
mkfs -t gfs2 -p lock_dlm -t HA:ktsgfs2 -j 2 /dev/vdb1
mount /dev/vdb1 /GFS
chkconfig –level 345 gfs2 on
gfs2_tool list
gfs2_tool df
echo “/dev/vdb1 /GFS gfs2 defaults,noatime,nodiratime 0 0″ >> /etc/fstab

If GFS file system has to be on an lvm then follow below steps.

pvcreate pv_gfs2 /dev/vdb1
vgcreate -c y vg_gfs2 /dev/sdb
lvcreate -n lv_gfs2 -L 2G mytest_gfs2
/etc/init.d/clvmd start


format the lvm via above commands.