Skip to content

Instantly share code, notes, and snippets.

@mamedshahmaliyev
Last active June 8, 2020 07:03
Show Gist options
  • Save mamedshahmaliyev/1e1d6090702a051502a2dd0bac2ac965 to your computer and use it in GitHub Desktop.
Save mamedshahmaliyev/1e1d6090702a051502a2dd0bac2ac965 to your computer and use it in GitHub Desktop.
extend linux disk volume size in virtual machina
reboot # if no free sector error occurs
fdisk -l
fdisk /dev/sda
# type n -> p -> 3
# type t -> 3 -> 8e
# type w
reboot
pvcreate /dev/sda3
vgdisplay
vg_name='centos'
vgextend $vg_name /dev/sda3
# vgextend `vgdisplay | awk '{print $3}' | sed -n 2p` /dev/sda3
lvdisplay
lv_root_path='/dev/centos/root'
lvextend $lv_root_path /dev/sda3
resize2fs $lv_root_path
xfs_growfs $lv_root_path # if resize2fs fails
df -h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment