Changed hdd size but Ubuntu vm not reporting proper sizes

omar.migs

New Member
Feb 24, 2024
12
2
3
Hello everyone, and im so happy to join such a great community.
i created an ubuntu vm and assigned it a LVM disk for storage. on the initial setup i made a mistake and only assigned 850 gb, i copied all my files and then i found out i only have 30 gb left of storage. So i wanted to increase the disk size and this is the steps i did:
Code:
qm resize 100 scsi0 +30g
i then logged insisde the vm "ubuntu server 22.04" and this what i did:
Code:
sudo parted -l
it then reported that there is a mismatch and asked if it should fix it and i said Fix
then when i did df -u it shows the old partition size :

Code:
Disk /dev/sda: 945GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  913GB   913GB   ext4

when i do df -h :

Code:
tmpfs           392M  1.3M  390M   1% /run
/dev/sda2       836G  754G   40G  95% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           392M  8.0K  392M   1% /run/user/1000

lsblk reports 880 gb but the partition /dev/sda2 is still the same size :


Code:
sda      8:0    0   880G  0 disk
├─sda1   8:1    0     1M  0 part
└─sda2   8:2    0   850G  0 part /

i tried resize2fs but didnt work. What am i missing .
 
Maybe Ubuntu did not notice the new partition size? Maybe reboot the VM or run partprobe (inside the VM) or something similar. Then resize2fs can extend the ext4 online.
 
Thank you for the reply @leesteken . after reading the docs again i realized that the new added space is just unallocated space so I could see it with :
Bash:
parted print free
then i used parted to extend the partition
Code:
resizepart 2 100%
now it works fine and system is still running luckily.