Skip to content

Instantly share code, notes, and snippets.

@boddumanohar
Last active February 22, 2021 16:09
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 boddumanohar/b7745a4ee7508164746be927a4050f3f to your computer and use it in GitHub Desktop.
Save boddumanohar/b7745a4ee7508164746be927a4050f3f to your computer and use it in GitHub Desktop.

LVM working

https://www.tecmint.com/wp-content/uploads/2014/08/LVM_extend.jpg

increase virtual box VM size to 80GB

VBoxManage modifyhd '$HOME/VirtualBox VMs/UbuntuServer.vdi' --resize 81920

create a new PV

sudo fdisk -c /dev/sda --> the disk that you just expanded press -->

  1. n,
  2. 4(new partition number),
  3. t
  4. 4 (new partition number)
  5. 8e (partition type)
  6. w -> commit
boddu@boddu:~/github/blob-csi-driver$ sudo lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0                       7:0    0 98.4M  1 loop /snap/core/10823
loop1                       7:1    0 55.4M  1 loop /snap/core18/1944
loop2                       7:2    0 55.5M  1 loop /snap/core18/1988
loop3                       7:3    0 61.6M  1 loop /snap/core20/904
loop4                       7:4    0 69.8M  1 loop /snap/lxd/19032
loop5                       7:5    0 69.9M  1 loop /snap/lxd/19188
loop6                       7:6    0 31.1M  1 loop /snap/snapd/10707
loop7                       7:7    0 31.1M  1 loop /snap/snapd/11036
sda                         8:0    0   80G  0 disk
├─sda1                      8:1    0    1M  0 part
├─sda2                      8:2    0    1G  0 part /boot
├─sda3                      8:3    0   31G  0 part
│ └─ubuntu--vg-ubuntu--lv 253:0    0   29G  0 lvm  /
└─sda4                      8:4    0   48G  0 part
sr0                        11:0    1 1024M  0 rom

you will see a new partition added with all the free space avaiable on that disk. In my case it created sda4

Create a PV

sudo pvcreate /dev/sda4

list the VGs and expand the VG

sudo vgs
sudo vgextend ubuntu-vg /dev/sda4

  Volume group "ubuntu-vg" successfully extended

find the free space in the VG and expand the LV

sudo vgdisplay
sudo lvextend -L +49G /dev/mapper/ubuntu--vg-ubuntu--lv
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment