Expanding VM inconsistency

Ziggy

Contributor
Joined
Oct 7, 2015
Messages
157
I initially setup an ubuntu server VM with 20G of space and subsequently decided to increase that to 50G. I did this by editing the zvol. On reboot the VM cli reports the devices as follows via 'df -h':

Filesystem Size Used Avail Use% Mounted on
tmpfs 97M 1020K 96M 2% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 20G 8.4G 11G 45% /
tmpfs 484M 0 484M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup
/dev/sda2 976M 129M 780M 15% /boot
/dev/sda1 511M 5.3M 506M 2% /boot/efi
tmpfs 97M 4.0K 97M 1% /run/user/1000


I have researched how to expand that volume via the cli and a) am unsure if I have the right advice, and b) found it difficult to understand. So I mounted a gparted iso from the internal virtual cd-rom and it shows the volume as the complete 50G:
1626427980758.png


Any advice on how to resolve this? Thanks.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776

Ziggy

Contributor
Joined
Oct 7, 2015
Messages
157
Thanks Patrick. That guide is very handy and I appreciate the link. I started parted and free space is reported as:

(parted) print free
Model: ATA QEMU HARDDISK (scsi)
Disk /dev/sda: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
17.4kB 1049kB 1031kB Free Space
1 1049kB 538MB 537MB fat32 boot, esp
2 538MB 1612MB 1074MB ext4
3 1612MB 53.7GB 52.1GB


That is, just over a MB of free space. Yet you can see sda is reported as 53.7GB and partition n. 3 as the bulk of that with no free space label under file system. When I proceed to cfdisk, I get this:

1626432926363.png

and 'new' is not available anyway, only 'resize'. I could just delete this vm and start again - I may have to - but I was trying to avoid this as I have a few things configured already, like wireguard.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
So the partition seems to be expanded already. You now need to proceed with the logical volume groups etc.
 

Ziggy

Contributor
Joined
Oct 7, 2015
Messages
157
Thanks. Making progress. So this next step worked:

sudo lvextend -l+100%FREE /dev/ubuntu-vg/ubuntu-lv
Size of logical volume ubuntu-vg/ubuntu-lv changed from 20.00 GiB (5120 extents) to <48.50 GiB (12415 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.


But the 'resizefs' didn't. Input/Output:

sudo resize2fs /dev/mapper/ubuntu-vg/ubuntu-lv
resize2fs 1.45.7 (28-Jan-2021)
open: No such file or directory while opening /dev/mapper/ubuntu-vg/ubuntu-lv


When I checked 'df -h', output shows:

/dev/mapper/ubuntu--vg-ubuntu--lv 20G 8.4G 11G 45% /

Noting the two dashes in this device readout, I tried again with the extra dashes, but same result of no such file or directory.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Please post a copy of the precise last command you tried and the error message.
Please use code tags for commands and output like so:
Code:
this
is
command
text


Thanks,
Patrick
 

Ziggy

Contributor
Joined
Oct 7, 2015
Messages
157
I'm afraid I don't understand your request Patrick.
This is the last command I used:
sudo resize2fs /dev/mapper/ubuntu--vg/ubuntu--lv

This was the output of that command:
resize2fs 1.45.7 (28-Jan-2021)
open: No such file or directory while opening /dev/mapper/ubuntu--vg/ubuntu--lv
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Please format commands and output like this:
Code:
sudo resize2fs /dev/mapper/ubuntu--vg/ubuntu--lv
resize2fs 1.45.7 (28-Jan-2021)
open: No such file or directory while opening /dev/mapper/ubuntu--vg/ubuntu--lv


And I guess from the output of your df command above the correct command line is:
Code:
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv


Notice the subtle difference? Simple typo if it works out, now.
 

Ziggy

Contributor
Joined
Oct 7, 2015
Messages
157
Aw, jeez, how did I miss that? Thanks Patrick. Sorted. If you'll bear with me, in terms of your pointing me to writing code, do I simply write
code:
This is my command

and then
code:
This is my output
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
6F6CFDEA-F809-4045-92C9-E8B1ABA1331F.jpeg
 

Ziggy

Contributor
Joined
Oct 7, 2015
Messages
157
I appreciate your patience. I looked and missed that too. Thank you very much for your help.
 
Top