Ubuntu Extend full part

3rd October 2024

Step 1: In VmWare, make the partition larger. i did this while the VM was running with no ill effects.

sudo su
[sudo] password for hex:
root@uwazuh:/home/hex# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1G 0 part /boot/efi
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 96.9G 0 part
└─ubuntu–vg-ubuntu–lv 252:0 0 48.5G 0 lvm /
sr0 11:0 1 2.6G 0 rom
root@uwazuh:/home/hex#
root@uwazuh:/home/hex# fdisk /dev/sda

Welcome to fdisk (util-linux 2.39.3).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

GPT PMBR size mismatch (209715199 != 419430399) will be corrected by write.
The backup GPT table is not on the end of the device. This problem will be corrected by write.
This disk is currently in use – repartitioning is probably a bad idea.
It’s recommended to umount all file systems, and swapoff all swap
partitions on this disk.

Command (m for help): d
Partition number (1-3, default 3): 3

Partition 3 has been deleted.

Command (m for help): n
Partition number (3-128, default 3): 3
First sector (6397952-419430366, default 6397952):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (6397952-419430366, default 419428351):

Created a new partition 3 of type ‘Linux filesystem’ and of size 196.9 GiB.
Partition #3 contains a LVM2_member signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): w

The partition table has been altered.
Syncing disks.

root@uwazuh:/home/hex# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1G 0 part /boot/efi
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 196.9G 0 part
└─ubuntu–vg-ubuntu–lv 252:0 0 48.5G 0 lvm /
sr0 11:0 1 2.6G 0 rom
root@uwazuh:/home/hex#
root@uwazuh:/home/hex# pvresize /dev/sda3
Physical volume “/dev/sda3” changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
root@uwazuh:/home/hex# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1G 0 part /boot/efi
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 196.9G 0 part
└─ubuntu–vg-ubuntu–lv 252:0 0 48.5G 0 lvm /
sr0 11:0 1 2.6G 0 rom
root@uwazuh:/home/hex# lvextend –extents +100%FREE –resizefs /dev/ubuntu-vg/ubuntu-lv
Size of logical volume ubuntu-vg/ubuntu-lv changed from 48.47 GiB (12409 extents) to <196.95 GiB (50418 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
resize2fs 1.47.0 (5-Feb-2023)
Filesystem at /dev/mapper/ubuntu–vg-ubuntu–lv is mounted on /; on-line resizing required
old_desc_blocks = 7, new_desc_blocks = 25
The filesystem on /dev/mapper/ubuntu–vg-ubuntu–lv is now 51628032 (4k) blocks long.

root@uwazuh:/home/hex# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1G 0 part /boot/efi
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 196.9G 0 part
└─ubuntu–vg-ubuntu–lv 252:0 0 196.9G 0 lvm /
sr0 11:0 1 2.6G 0 rom
root@uwazuh:/home/hex#

Sources: Medium