How do I grow or extend a GFS2 file-system on RHEL?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux Server 5 (with Clustering and Cluster Storage)
  • Red Hat Enterprise Linux Server 6, 7, 8 (with the High Availability Add On and Resilient Storage Add Ons)
  • A Global Filesystem 2(gfs2)

Issue

  • How can I safely grow or extend a GFS2 file-system online?

Resolution

  • Make sure that underlying storage is seen by all the cluster nodes:

  • Then extend the volume group if the volume group will be grown. Then extend the logical volume. On RHEL 5, 6, and 7 the cluster nodes should be notified when the metadata has been changed on the vg or lv when extending them. On RHEL 8 all the cluster nodes need to manually refresh the LVM metadata to see the changes made by extending the vg or lv with command 'pvscan && vgscan && lvscan'. For more information see the articles below:

  • Before beginning the grow operation on the GFS2 file-system ensure that there is at least 500MB of free space available on the GFS2 file-system that the operation can use. This is a generous amount of space and can be reduced for smaller file-systems if needed. The gfs2_grow needs to add additional resource groups to manage the new space. gfs2_grow does this by writing to the rindex file. If there are no free blocks available in the filesystem at its current size, and the last block of the rindex file is too full to add another resource group entry, gfs2_grow will be unable to write out the necessary information for gfs2 to be able to use the new space. When this happens, gfs2_grow is unable to grow the filesystem and can damage the filesystem.

  • Once the storage stack has been extended(or if there was already enough space) to accommodate the growing of the GFS2 file-system then run the following command:

      # gfs2_grow /path/to/mount/point
    
  • After the grow has completed use the following command to verify that the new space is available:

      # df /path/to/mount/point
    
  • Example:

      # df -h /mnt/test
      Filesystem                 Size  Used Avail Use% Mounted on
      /dev/mapper/testvg-testlv  9.0G   67M  9.0G   1% /mnt/test
    
    
      # gfs2_grow -v /dev/mapper/testvg-testlv
      Trying to get admin lock...locked.
      Gathering resource group information for /dev/mapper/testvg-testlv
      FS: Mount point:             /mnt/test
      FS: Device:                  /dev/mapper/testvg-testlv
      FS: Size:                    2358269 (0x23fbfd)        # Filesystem size in pages ( 4 kb per page )
      DEV: Length:                 2620416 (0x27fc00)        # Device size in pages ( 4 kb per page )
      The file system will grow by 1024MB.                   
      1 new rindex entries.
      gfs2_grow complete.
    
    
      # df -h /mnt/test
      Filesystem                 Size  Used Avail Use% Mounted on
      /dev/mapper/testvg-testlv   10G   67M   10G   1% /mnt/test
    
SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.