RHCS6: Create a new Logical Volume / Global Filesystem 2 (GFS2)

RHCS: Create a new Logical Volume / Global Filesystem 2 (GFS2)

# Tested on RHEL 6

# I included this recipe as part of Red Hat Cluster Suite but, in fact, gfs2 is part of an
# optional package and not part of Red Hat Cluster Suite.

# In any case, to configure gfs2 subsystem we need to install Red Hat Cluster layer first

# Once Red Hat Cluster configured we'll follow following procedure (run commands on all
# nodes making up our cluster except when indicated):

# Required package installation:

yum install lvm2-cluster gfs2-utils

# Change LVM locking type to use built-in cluster locking on all cluster nodes. This
# can be done by either changing "locking-type" to '3' in /etc/lvm/lvm.conf configuration
file or by running:

lvmconf --enable-cluster

# Let's activate and start necessary services

chkconfig gfs2 on
chkconfig clvmd on

service clvmd start
service gfs2 start

# GFS2 construction...

# We'll run following commands only on one of the nodes in the cluster ------

JOURNALS=4                   # The number of journals for gfs2_mkfs. I recommend to
                             # use 2 journals per machine that will mount the fs.

CLUSTERNAME=mycluster        # We will user "clustername" for the lock table field (-t)
                             # that should have the form clustername:fsname. Clustername must
                             # match that in cluster.conf; only members of the cluster are
                             # permitted to use this filesystem. Fsname (1 to  16  characters)
                             # must be unique so I recommend to use clustername:lv_name

pvcreate $DISK

vgcreate $VG $DISK

vgchange -cy $VG

lvcreate -n $LV -L $SIZE $VG

mkfs.gfs2 -j$JOURNALS -p lock_dlm -t $CLUSTERNAME:$LV /dev/$VG/$LV

# ---------------------------------------------------------------------------

# Update /etc/fstab and mount F.S. on every server forming the cluster

echo "/dev/$VG/$LV    $MNTPT       gfs2     defaults     0 0"   >> /etc/fstab

mkdir $MNTPT
mount $MNTPT
0 (0)
Article Rating (No Votes)
Rate this article
There are no attachments for this article.
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
stunnel basics and pki standards
Viewed 918 times since Fri, Sep 28, 2018
How to mount software RAID1 member using mdadm
Viewed 443 times since Wed, Oct 3, 2018
Understanding System auditing with auditd
Viewed 1036 times since Fri, Apr 5, 2019
How setting the TZ environment variable avoids thousands of system calls
Viewed 1093 times since Mon, May 21, 2018
6 easy steps to setup offline two factor authentication in Linux
Viewed 215 times since Mon, Apr 6, 2020
How to Analyze or Read OS Watcher Output in three easy steps -- With Example ?
Viewed 3066 times since Thu, Jun 21, 2018
Cron YUM How to use yum-cron to automatically update RHEL/CentOS Linux
Viewed 417 times since Fri, Oct 26, 2018
How to remove CTRL-M (^M) characters from a file in Linux
Viewed 407 times since Thu, Feb 7, 2019
Przekazywanie portów TCP rinetd
Viewed 1952 times since Thu, May 24, 2018
Using stunnel and TinyProxy to obfuscate HTTP traffic
Viewed 1028 times since Fri, Sep 28, 2018