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 ------

DISK=/dev/sdc1
VG=gfsvg
LV=lv_gfs_test
MNTPT=/sharedfs
SIZE=5GB
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
Attachments
There are no attachments for this article.
Comments
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
How to create a Systemd service in Linux
Viewed 3024 times since Mon, Dec 7, 2020
ZFS: Snapshots and clones on zfs filesystems
Viewed 3168 times since Sun, Jun 3, 2018
RHEL: Display swap/RAM size
Viewed 3389 times since Sat, Jun 2, 2018
Linux RAID Mdadm Cheat Sheet
Viewed 5509 times since Fri, May 15, 2020
LVM: Remove a Filesystem / Logical Volume
Viewed 2665 times since Sat, Jun 2, 2018
How to encrypt a partition using LUKS?
Viewed 1924 times since Fri, Jul 13, 2018
Secure Remote Logging to Central Log Server Using RSYSLOG on CentOS 6 / CentOS 7 and stunnel
Viewed 4097 times since Sun, Dec 6, 2020
SSH Essentials: Working with SSH Servers, Clients, and Keys
Viewed 4571 times since Wed, Jun 27, 2018
A Quick and Practical Reference for tcpdump
Viewed 12603 times since Fri, Jul 27, 2018
INSTALACJA MIB SNMP W SYSTEMIE CENTOS/RHEL 6
Viewed 13072 times since Fri, Nov 30, 2018