Resize logical volume after expanding disk on Ubuntu VM Guest

Disclaimer: This is a quick set of notes I grabbed during this process. It assumes Ubuntu 21.04 installed with default file system setup, resulting in / on a logical volume at /dev/mapper/ubuntu–vg-ubuntu–lv.

After expanding the guest disk size in VMWare ESXi, I logged into the Ubuntu guest.

Possibly Unnecessary #1: reboot the VM.

Possibly Unnecessary #2: before the remaining steps, I noticed that parted complained when I tried to print all:

parted
(parted) print all
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 123 blocks) or continue with the current setting?
Fix/Ignore? Fix

After parted did its thing:

growpart /dev/sda 3
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

You may need to adjust the disk, partition number, or volume paths.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *