Skip to content

Instantly share code, notes, and snippets.

@hardenchant
Created June 14, 2019 17:14
Show Gist options
  • Save hardenchant/9018f729ee189e491fa911d8d53cd5e6 to your computer and use it in GitHub Desktop.
Save hardenchant/9018f729ee189e491fa911d8d53cd5e6 to your computer and use it in GitHub Desktop.
Expand partition in CentOS 7. (vSphere)
# Before that, you must expand disk in vSphere
# /dev/sda - disk to expand
fdisk /dev/sda
n
p
[enter]
[enter]
[enter]
w

reboot
fdisk -l # check new partition
vgextend centos /dev/sda3
lvextend  -L+20G /dev/centos/root
xfs_growfs /dev/centos/root
@hardenchant
Copy link
Author

hardenchant commented Mar 12, 2021

fdisk /dev/sda
n
[enter]
[enter]
[enter]
[enter]
w
partprobe
vgextend ubuntu-vg /dev/sda4
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
resize2fs /dev/ubuntu-vg/ubuntu-lv

quick way:
fdisk /dev/sda && partprobe && vgextend ubuntu-vg /dev/sda4 && lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv && resize2fs /dev/ubuntu-vg/ubuntu-lv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment