Skip to content

Instantly share code, notes, and snippets.

@mikerodionov
Last active August 30, 2022 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikerodionov/39226d58395cde516cc37f471c7eb3e4 to your computer and use it in GitHub Desktop.
Save mikerodionov/39226d58395cde516cc37f471c7eb3e4 to your computer and use it in GitHub Desktop.
CentOS LV resize
# https://docs.microsoft.com/en-us/azure/virtual-machines/linux/resize-os-disk-gpt-partition
# LVM Linux (RHEL/CentOS)
# Confirm partition type (MBR/GPT)
parted
# Check available space
sudo pvs
# Identify LV for / - e.g. sda2 rootvg-rootlv
lsblk -f
# Check available space within VG
vgdisplay rootvg
# Resize to use all disk space
# Install tools
yum install cloud-utils-growpart gdisk
# Determine which disk and partition holds the LVM physical volume or volumes (PV)
pvscan
# Verify partition size - if not all space used expand
lsblk /dev/sda4
# Expand partition
# Confirm partition N
parted -l /dev/sda
# Expand partion
sudo growpart /dev/sda 2
# Verify partition size
lsblk /dev/sda2
# Expand PV
pvresize /dev/sda2
# Verify PV size
pvscan
# List LVs
lsblk /dev/sda2
# Expand LV
sudo lvresize -r -L +110 /dev/mapper/rootvg-optlv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment