Expanding an LVM Data or Root Volume

How you expand an LVM data or root volume depends on whether you have enabled Online Encryption.

If you want to expand a LVM swap volume, see Expanding an LVM Swap Volume. If you want to expand a Linux root or data partition that is not managed by LVM, see Expanding a Root Partition and Expanding a Linux Data Partition.

Procedure 

  1. Expand the disk using your hypervisor tools.
  2. Extend the underlying volume using your Linux management tools.

    For example, if the disk is an LVM volume called myvg-myvol, you would use:

    # lvextend -L<new size> /dev/myvg/myvol

  3. Resize the crypto mapping so that it matches the volume size. How you do this depends on what type of volume you're working with and whether Online Encryption is enabled or disabled for the volume.

    Select one of the following methods:

    • When Online Encryption is Disabled

      Use the command hcl resize diskname, where diskname is the short form of the disk name, as shown in the hcl status command. For example, myvg-myvol.

      # hcl resize myvg-myvol

      Note: This can be used for both root and data volumes.

    • When Online Encryption is Enabled

      • If the volume is a data volume

        Unmount and detach the data volume, then reattach and remount the data volume.

        # umount /dev/mapper/clear_myvg_myvol
        # hcl detach myvg_myvol
        # hcl attach myvg_myvol
        # mount /dev/mapper/clear_myvg_myvol
      • If the volume is a root volume: 

        Reboot the VM.

        # reboot

    • Tip: You can always use reboot, whether online encryption is enabled or not.

  4. Expand the filesystem. How you do this depends on whether the volume uses the XFS or EXT filesystem. Both methods require you to specify the clear text path to the volume.

    Tip: The clear text path is shown in the hcl status command.

    XFS Filesystems

    Use the xfs_growfs clear_path command, where clear_path is the clear text path to the disk. For a data partition, the default path is /dev/mapper/clear_diskname. For a root partition, the clear text path is /dev/mapper/clear_htroot.

    # xfs_growfs /dev/mapper/clear_myvg_myvol
    meta-data=/dev/mapper/clear_myvg_myvol isize=512    agcount=8, agsize=65536 blks
            =                       sectsz=512   attr=2, projid32bit=1
             =                       crc=1        finobt=0 spinodes=0
    data     =                       bsize=4096   blocks=498688, imaxpct=25
             =                       sunit=0      swidth=0 blks
    naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
    log      =internal               bsize=4096   blocks=2560, version=2
             =                       sectsz=512   sunit=0 blks, lazy-count=1
    realtime =none                   extsz=4096   blocks=0, rtextents=0
    data blocks changed from 498688 to 524288

    EXT Filesystems

    Use the resize2fs clear_path command, where clear_path is the clear text path to the disk. For a data partition, the default path is /dev/mapper/clear_diskname. For a root partition, the clear text path is /dev/mapper/clear_htroot.

    # resize2fs /dev/mapper/clear_myvg-myvol
    # resize2fs /dev/mapper/clear_htroot