How you expand an LVM data or root volume depends on whether you have enabled Online Encryption for that volume. If you have, you must use the Offline Resize method. If you are not using Online Encryption, you can resize the volume using the Online Resize method.
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
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
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.
Tip: | You can always use the Offline Resize Method for all volumes, regardless of whether they use Online Encryption. If you are not sure whether Online Encryption is enabled on the volume, use the appropriate Offline Resize Method. |
Select one of the following methods:
Online Resize Method — Usable for both root and data volumes only if 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
Offline Resize Method for Root Volumes — Usable for all root volumes. This method is required for root volumes on which Online Encryption is enabled.
Reboot the VM.
# reboot
Offline Resize Method for Data Volumes — Usable for all data volumes. This method is required for data volumes on which Online Encryption is enabled.
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
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
using 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