03-11-2022

Extend Virtual Disk on Linux!

The main source:

https://medium.com/@royso/resize-lvm-partition-inside-your-vm-62eb4db618f8

So you are out of space. You also bought space from your VPS provider. Cool, you just need to extend it!

Type the following:

  • fdisk /dev/sda, then press p
  • press d , then press enter (last number is selected, that should be the LVM)
  • press n, so you will create new (accept default number, plus the default start & end cilinder state)
  • press w, so it will be written
  • pvresize /dev/sda2
  • check with vgdisplay and lvdisplay
  • lvextend -l +100%FREE {LV PATH} (use LV Path as attached screen)
  • final step is to call resize2fs {LV PATH}

Now you can check it via df -h :)

© 2024 PappZ. All rights reserved.