RHCS6: Extend an existing Logical Volume / GFS2 filesystem

RHCS: Extend an existing Logical Volume / GFS2 filesystem

# Tested on RHEL 6

# We are extending a given GFS2 filesystem like following one by adding 1GB:

df -h /sharedfs
   Filesystem            Size  Used Avail Use% Mounted on
   /dev/mapper/gfsvg-lv_gfs
                      4.0G  259M  3.8G   7% /sharedfs
lvs | grep lv_gfs
     lv_gfs   gfsvg  -wi-ao---   4.00g



# Variable definition

VG=gfsvg
LV=lv_gfs
MNTPT=/sharedfs
SIZETOADD=1GB
FINALSIZE=5GB
        # Final Size



# First of all check if there is available space on the volume group the F.S. belongs to

vgs $VG
     VG    #PV #LV #SN Attr   VSize VFree
     gfsvg   1   1   0 wz--nc 8.00g 4.00g
                                  ^
                                  ^


# Let's extend the logical volume by specifying the size to be added:

lvextend -L +$SIZETOADD $VG/$LV
     Extending logical volume lv_gfs to 5.00 GiB
     Logical volume lv_gfs successfully resized

# or by specifying the final size:
#
# lvextend -L $FINALSIZE $VG/$LV
#      Extending logical volume lv_gfs to 5.00 GiB
#      Logical volume lv_gfs successfully resized


# Test what the tool will do

gfs2_grow -T /dev/$VG/$LV


# ...and then actually resize the GFS2

gfs2_grow /dev/$VG/$LV
   FS: Mount Point: /sharedfs
   FS: Device:      /dev/dm-8
   FS: Size:        1048575 (0xfffff)
   FS: RG size:     65533 (0xfffd)
   DEV: Size:       1310720 (0x140000)
   The file system grew by 1024MB.
   gfs2_grow complete.

# or 'gfs2_grow $MNTPT'


df -h $MNTPT
   Filesystem            Size  Used Avail Use% Mounted on
   /dev/mapper/gfsvg-lv_gfs
                         5.0G  259M  4.8G   6% /sharedfs
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 encrypt a partition using LUKS?
Viewed 2566 times since Fri, Jul 13, 2018
Turbocharge PuTTY with 12 Powerful Add-Ons – Software for Geeks #3
Viewed 15765 times since Sun, Sep 30, 2018
Monitoring bezpieczeństwa Linux: integracja auditd + OSSEC cz. I
Viewed 3175 times since Fri, Apr 5, 2019
LVM: Extend SWAP size by growing existing Logical Volume
Viewed 3237 times since Sat, Jun 2, 2018
Red Hat Enterprise Linux - Allow Root Login From a Specific IP Address Only
Viewed 3546 times since Wed, Oct 3, 2018
Zabijanie wszystkich procesów użytkownika
Viewed 3346 times since Thu, May 24, 2018
Script to Offline and Remove A Disk In Linux
Viewed 2556 times since Mon, Jan 28, 2019
Cron YUM How to use yum-cron to automatically update RHEL/CentOS Linux
Viewed 3266 times since Fri, Oct 26, 2018
How to do a Filesystem Resize (ext3/ext4) on Redhat running on VMware
Viewed 11708 times since Wed, Jul 25, 2018
Linux nslookup Command Examples for DNS Lookup
Viewed 9916 times since Sat, Sep 29, 2018